Skip to content

[cmake] Unify usage of create_symlink/copy across the build files. #72202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

drodriguez
Copy link
Contributor

In several places, there was the same or similar code to either do a symlink or use copy/copy_if_different/copy_directory in Windows systems. The checks were also slightly different in some cases.

There is a SWIFT_COPY_OR_SYMLINK that can be controlled as a CMake option, and uses CMAKE_HOST_UNIX as default. Change all cases that I can find to use that value. Also create a parallel value SWIFT_COPY_OR_SYMLINK_DIR to apply to directories.

There is still a couple of cases that are specific to macOS SourceKit framework which I have left as-is, since symlinks is probably the only right thing to do there.

There's a case for Windows specifically that uses symlinks (in https://github.com/apple/swift/blob/523f80769487b0fea30880ca98c42470f740ff02/cmake/modules/SwiftConfigureSDK.cmake#L502) which I have not modified as well.

@drodriguez drodriguez requested review from compnerd and etcwilde March 8, 2024 23:25
@drodriguez drodriguez requested a review from a team as a code owner March 8, 2024 23:25
@drodriguez
Copy link
Contributor Author

@swift-ci please test

In several places, there was the same or similar code to either do
a symlink or use copy/copy_if_different/copy_directory in Windows
systems. The checks were also slightly different in some cases.

There is a `SWIFT_COPY_OR_SYMLINK` that can be controlled as a CMake
option, and uses `CMAKE_HOST_UNIX` as default. Change all cases that
I can find to use that value. Also create a parallel value
`SWIFT_COPY_OR_SYMLINK_DIR` to apply to directories.

There is still a couple of cases that are specific to macOS SourceKit
framework which I have left as-is, since symlinks is probably the only
right thing to do there.

There's a case for Windows specifically that uses symlinks (in
https://github.com/apple/swift/blob/523f80769487b0fea30880ca98c42470f740ff02/cmake/modules/SwiftConfigureSDK.cmake#L502)
which I have not modified as well.
@drodriguez drodriguez force-pushed the symlinks-everywhere branch from e58f407 to aafe886 Compare March 9, 2024 02:58
@drodriguez
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

Thanks for this cleanup!

@drodriguez drodriguez merged commit 42e43ed into swiftlang:main Mar 10, 2024
@drodriguez drodriguez deleted the symlinks-everywhere branch March 10, 2024 02:04
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