From 2760e7e466fcf581d67cc2574241a824fbe158ff Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 25 Jul 2026 22:33:35 +0900 Subject: refactor(json): embed Composer schemas instead of copying them to target build.rs guessed target/ from OUT_DIR to place res/*.json next to the executable (twice, since test binaries live in deps/), and JsonFile resolved them through current_exe(). That made the binary undistributable on its own. The schemas are now include_str!'d and referenced through a shirabe:///res/ URI that SchemaRetriever resolves, keeping the $ref indirection PHP uses for the phar case. The res/ path segment is required so composer-lock-schema.json's relative "./composer-schema.json" reference still resolves. --- crates/shirabe/src/command/config_command.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/src/command') diff --git a/crates/shirabe/src/command/config_command.rs b/crates/shirabe/src/command/config_command.rs index a92c2f59..9e2f4e66 100644 --- a/crates/shirabe/src/command/config_command.rs +++ b/crates/shirabe/src/command/config_command.rs @@ -23,9 +23,9 @@ use shirabe_external_packages::symfony::console::input::InputInterface; use shirabe_external_packages::symfony::console::output::OutputInterface; use shirabe_php_shim::{ InvalidArgumentException, PhpMixed, RuntimeException, array_is_list, array_merge, - escapeshellcmd, exec, explode, file_exists, file_get_contents, implode, in_array, is_array, - is_bool, is_dir, is_numeric, is_object, is_string, json_encode, php_regex, str_replace, strpos, - strtolower, system, touch, var_export, + escapeshellcmd, exec, explode, file_exists, implode, in_array, is_array, is_bool, is_dir, + is_numeric, is_object, is_string, json_encode, php_regex, str_replace, strpos, strtolower, + system, touch, var_export, }; use shirabe_semver::VersionParser; @@ -431,10 +431,7 @@ impl Command for ConfigCommand { // ensure we get {} output for properties which are objects if value.as_array().map(|a| a.is_empty()).unwrap_or(false) { let schema = JsonFile::parse_json( - Some( - &file_get_contents(JsonFile::composer_schema_path()) - .unwrap_or_default(), - ), + Some(JsonFile::COMPOSER_SCHEMA_JSON), Some("composer.schema.json"), )?; let type_value = schema -- cgit v1.3.1