diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-25 22:33:35 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-25 22:33:35 +0900 |
| commit | 2760e7e466fcf581d67cc2574241a824fbe158ff (patch) | |
| tree | 8890233bcde7bc0eebafebd53e865576959fa8e1 /crates/shirabe/src/command/config_command.rs | |
| parent | 53f4444c5ac9cc1c14749afb7ba2c3ccd1929889 (diff) | |
| download | php-shirabe-2760e7e466fcf581d67cc2574241a824fbe158ff.tar.gz php-shirabe-2760e7e466fcf581d67cc2574241a824fbe158ff.tar.zst php-shirabe-2760e7e466fcf581d67cc2574241a824fbe158ff.zip | |
refactor(json): embed Composer schemas instead of copying them to target
build.rs guessed target/<profile> 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.
Diffstat (limited to 'crates/shirabe/src/command/config_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/config_command.rs | 11 |
1 files changed, 4 insertions, 7 deletions
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 |
