Skip to content

Conversation

ramonasuncion
Copy link
Contributor

@ramonasuncion ramonasuncion commented Sep 30, 2025

Changed %target-build-swift-dylib(([^)]+)) to %target-build-swift-dylib(([^)]+?)([^/()]+))

Group 1 now captures the pat and group 2 captures the file name

Captured the basename directly in the regex instead of using a subshell since Lit's internal shell does not support

Partially address #84407

Changed %target-build-swift-dylib\(([^)]+)\) to
%target-build-swift-dylib\(([^)]+?)([^/()]+)\)

Group 1 now captures the "prefix" and group 2 captures the final word

Captured the basename directly in the regex instead of using a subshell since
Lit's internal shell does not support
@hnrklssn
Copy link
Contributor

@swift-ci please smoke test

test/lit.cfg Outdated
config.substitutions.append(('%target-run', config.target_run))
config.substitutions.append(('%target-jit-run', subst_target_jit_run))
config.substitutions.append(('%target-build-swift-dylib\(([^)]+)\)', config.target_build_swift_dylib))
config.substitutions.append(('%target-build-swift-dylib\(([^)]+?)([^/()]+)\)', config.target_build_swift_dylib))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment describing that the file name is captured by \2 and the rest of the path by \1? Regexes are notoriously hard to read.

Copy link
Contributor

@hnrklssn hnrklssn Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and also you'll likely need to adjust this to handle Windows paths as well. But if you want you can wait for the Windows test results to arrive to know for sure.

@ramonasuncion
Copy link
Contributor Author

Do I need to update all the other config.target_build_swift_dylib, since -parse-as-library -emit-library -o \1 should now include \2?

@hnrklssn
Copy link
Contributor

Do I need to update all the other [config.target](http://config.target)_build_swift_dylib, since -parse-as-library -emit-library -o \1 should now include \2?

Ah yup, those also need to be updated

@ramonasuncion ramonasuncion changed the title Rework lit.cfg regex to avoid basename subshell in substituion Rework lit.cfg regex to avoid basename subshell in substitution Sep 30, 2025
@hnrklssn
Copy link
Contributor

@swift-ci please smoke test

@ramonasuncion
Copy link
Contributor Author

🙌 It passed!

@hnrklssn hnrklssn merged commit c4b2366 into swiftlang:main Sep 30, 2025
3 checks passed
@ramonasuncion ramonasuncion deleted the fix-lit-regex-basename branch September 30, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants