Skip to content

[embedded] Add a embedded-libraries CMake target to simplify the test dependencies #73870

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
Jun 24, 2024

Conversation

kubamracek
Copy link
Contributor

NFC, just to simplify the repetitive CMake code in test/CMakeLists.txt.

Copy link
Contributor

@drodriguez drodriguez left a comment

Choose a reason for hiding this comment

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

LGTM. When I started adding the code I don't know if some library had a little bit more if in front of it and might not have been available all the time (maybe embedded concurrency?), so I wanted to be safe.

@@ -164,6 +164,8 @@ elseif(BOOTSTRAPPING_MODE STREQUAL "OFF")
endif()

if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
add_custom_target(embedded-libraries ALL)
Copy link
Contributor

Choose a reason for hiding this comment

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

ALL should not be needed for a helper target for the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

apologies for the very late reply :)

I think I need an "ALL" somewhere, either here on the "umbrella" target (embedded-libraries) or on the individual libraries. I think I'd like to think about embedded-libraries not just as a helper for tests, but rather as a top-level target for building embedded libraries in general. In which case, it should be "ALL" so that it gets built even if you are not running tests. Would it make sense to keep "ALL" here (and remove on the individual libraries)? See the new diff.

Copy link
Contributor

Choose a reason for hiding this comment

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

ALL is, in my opinion, a code smell in CMake, since it allows you to avoid setting the right dependencies. Only "top level" targets (targets that nobody depends on) should be added to ALL (again, in my opinion).

With ALL in targets, when somebody does not use cmake --build all and use a reduced set of installation components, many dependencies are missing because the default CI systems always build all and people forget to set up the dependencies properly because it works for free in CI.

This is mostly a "nit". I was pointing out that it is not necessary because the dependencies are well setup at the moment. Still unnecessary with the newer version of the PR, if I am not mistaken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the explanation! I guess the concrete reason why I think I still need "ALL" here is that if I drop it, running ninja in the build directory will not build the embedded libraries. Same with running build-script without a -t. But we do build the regular stdlib in those cases.

@kubamracek kubamracek added the embedded Embedded Swift label Jun 3, 2024
@kubamracek kubamracek force-pushed the embedded-libraries-cmake branch from e5e4bba to 2e9d59e Compare June 17, 2024 17:42
@kubamracek
Copy link
Contributor Author

@swift-ci please test

@kubamracek kubamracek force-pushed the embedded-libraries-cmake branch from 2e9d59e to dda68d6 Compare June 20, 2024 02:27
@kubamracek
Copy link
Contributor Author

@swift-ci please test Windows platform

@kubamracek kubamracek force-pushed the embedded-libraries-cmake branch from dda68d6 to c4b52c3 Compare June 22, 2024 04:43
@kubamracek
Copy link
Contributor Author

@swift-ci please test

@kubamracek
Copy link
Contributor Author

@swift-ci please test Windows platform

@kubamracek kubamracek force-pushed the embedded-libraries-cmake branch from c4b52c3 to fc9edc8 Compare June 23, 2024 16:10
@kubamracek
Copy link
Contributor Author

@swift-ci please test

@kubamracek kubamracek force-pushed the embedded-libraries-cmake branch from fc9edc8 to 6eeef12 Compare June 23, 2024 20:08
@kubamracek
Copy link
Contributor Author

@swift-ci please test

@kubamracek kubamracek merged commit fb0a1b9 into swiftlang:main Jun 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedded Embedded Swift
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants