Make target-spec json file extensions case-insensitive by boozook · Pull Request #127389 · rust-lang/rust (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

boozook

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Jul 5, 2024

@boozook boozook marked this pull request as ready for review

July 5, 2024 23:32

tgross35

boozook

jieyouxu

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jul 6, 2024

@bors

…sensitive, r=

Support target-spec json file extension in various cases

Currently user's target json file can have only json ext, but cannot have `JSON' or any other strange form.

This is a little fix with added support of case-insensitive file-ext for user specified target only. That means that not supported in following cases:

Performance cost:

Almost without changes. Comparison using eq_ignore_ascii_case for only latest ext_len chars of the OsStr (as bytes).

Testing

How to test:

  1. rustc --print target-spec-json -Zunstable-options > ./some-target.JSON
  2. remove is-builtin field from the some-target.JSON or set to false
  3. rustc --print target-spec-json -Zunstable-options --target=some-target.JSON should work
  4. rustc --print target-spec-json -Zunstable-options --target=some-target should work on case-insensitive FS
  5. rustc --print cfg --target=some-target should work too, on case-insensitive FS

Tests added.

Implementation note

I've separated the comparison into a method for potential future use instead of just str.ends_with(".json") and to maintain compatibility. The method is public for the same reasons.

Fixes rust-lang#127387 issue.

try-job: test-various try-job: armhf-gnu try-job: x86_64-msvc try-job: aarch64-apple

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jul 6, 2024

@bors

…sensitive, r=

Support target-spec json file extension in various cases

Currently user's target json file can have only json ext, but cannot have `JSON' or any other strange form.

This is a little fix with added support of case-insensitive file-ext for user specified target only. That means that not supported in following cases:

Performance cost:

Almost without changes. Comparison using eq_ignore_ascii_case for only latest ext_len chars of the OsStr (as bytes).

Testing

How to test:

  1. rustc --print target-spec-json -Zunstable-options > ./some-target.JSON
  2. remove is-builtin field from the some-target.JSON or set to false
  3. rustc --print target-spec-json -Zunstable-options --target=some-target.JSON should work
  4. rustc --print target-spec-json -Zunstable-options --target=some-target should work on case-insensitive FS
  5. rustc --print cfg --target=some-target should work too, on case-insensitive FS

Tests added.

Implementation note

I've separated the comparison into a method for potential future use instead of just str.ends_with(".json") and to maintain compatibility. The method is public for the same reasons.

Fixes rust-lang#127387 issue.

try-job: test-various try-job: armhf-gnu try-job: x86_64-msvc try-job: aarch64-apple

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jul 6, 2024

@bors

…sensitive, r=

Support target-spec json file extension in various cases

Currently user's target json file can have only json ext, but cannot have `JSON' or any other strange form.

This is a little fix with added support of case-insensitive file-ext for user specified target only. That means that not supported in following cases:

Performance cost:

Almost without changes. Comparison using eq_ignore_ascii_case for only latest ext_len chars of the OsStr (as bytes).

Testing

How to test:

  1. rustc --print target-spec-json -Zunstable-options > ./some-target.JSON
  2. remove is-builtin field from the some-target.JSON or set to false
  3. rustc --print target-spec-json -Zunstable-options --target=some-target.JSON should work
  4. rustc --print target-spec-json -Zunstable-options --target=some-target should work on case-insensitive FS
  5. rustc --print cfg --target=some-target should work too, on case-insensitive FS

Tests added.

Implementation note

I've separated the comparison into a method for potential future use instead of just str.ends_with(".json") and to maintain compatibility. The method is public for the same reasons.

Fixes rust-lang#127387 issue.

try-job: test-various try-job: armhf-gnu try-job: x86_64-msvc try-job: aarch64-apple

@tgross35 tgross35 changed the titleSupport target-spec json file extension in various cases Make target-spec json file extensions case insensitive

Dec 7, 2024

@tgross35 tgross35 changed the titleMake target-spec json file extensions case insensitive Make target-spec json file extensions case-insensitive

Dec 7, 2024

@davidtwco davidtwco added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Feb 18, 2025