-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[6.2][build] Make it possible to build a cross-compilation toolchain for Android, including Testing #83503
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
[6.2][build] Make it possible to build a cross-compilation toolchain for Android, including Testing #83503
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7f09af2
Support 16 KB page sizes on Android (#81596)
marcprux 9c7ae50
Only bring over supporting change of `generate_linux_toolchain_file()…
finagolfin 2c9dcfe
[build][android] Use a CMake toolchain file to cross-compile Testing …
finagolfin 1d8a95f
[build] Make the new `--cross-compile-build-swift-tools` flag public
finagolfin 5068951
[build] Change Foundation macro checks because of #83422
finagolfin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
# REQUIRES: standalone_build | ||
# UNSUPPORTED: OS=macosx | ||
# UNSUPPORTED: OS=ios | ||
# UNSUPPORTED: OS=tvos | ||
# UNSUPPORTED: OS=watchos | ||
|
||
# RUN: %empty-directory(%t) | ||
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --cmake %cmake --libdispatch --cross-compile-hosts=android-aarch64 --skip-local-build --android --android-ndk %t/ndk/ --android-arch aarch64 2>&1 | %FileCheck %s | ||
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --cmake %cmake --foundation --swift-testing --swift-testing-macros --install-foundation --install-swift-testing-macros --install-llvm --cross-compile-hosts=android-aarch64 --cross-compile-build-swift-tools=False --android --android-ndk %t/ndk/ --android-arch aarch64 2>&1 | %FileCheck %s | ||
|
||
# CHECK: -DCMAKE_Swift_FLAGS{{.*}}-target {{.*}}unknown-linux-android{{.*}} -sdk | ||
# CHECK: -DCMAKE_SYSTEM_NAME=Android {{.*}} -DCMAKE_ANDROID_NDK | ||
# CHECK: pushd {{.*}}/llvm-android-aarch64 | ||
# CHECK-NOT: cmake --build {{.*}}/llvm-android-aarch64 --config | ||
# CHECK-NOT: cmake --build {{.*}}/llvm-android-aarch64 {{.*}} install-llvm | ||
# CHECK: cmake {{.*}}-DSWIFT_INCLUDE_TOOLS:BOOL=FALSE{{.*}}/swift | ||
# CHECK: Skipping building Foundation Macros for android-aarch64, because the host tools are not being built | ||
# CHECK: Skipping installing Foundation Macros for android-aarch64, because the host tools are not being built | ||
# CHECK: Skipping building Testing Macros for android-aarch64, because the host tools are not being built | ||
# CHECK: Skipping installing Testing Macros for android-aarch64, because the host tools are not being built | ||
# CHECK: cmake {{.*}}-DCMAKE_TOOLCHAIN_FILE:PATH={{.*}}swifttesting-android-aarch64/BuildScriptToolchain.cmake | ||
# CHECK: -DCMAKE_Swift_FLAGS=-target aarch64-unknown-linux-android{{.*}} -sdk |
6 changes: 5 additions & 1 deletion
6
validation-test/BuildSystem/cmark_crosscompile_using_toolchain_always.test
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
# REQUIRES: standalone_build | ||
# REQUIRES: OS=macosx | ||
|
||
# RUN: %empty-directory(%t) | ||
# RUN: mkdir -p %t | ||
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --install-all --cmake %cmake --skip-build-llvm --skip-build-swift 2>&1 | %FileCheck %s | ||
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --install-all --cmake %cmake --skip-build-llvm --skip-build-swift --cross-compile-hosts=android-aarch64 --skip-local-build --android --android-ndk %t/ndk/ 2>&1 | %FileCheck --check-prefix=ANDROID %s | ||
|
||
# CHECK: DRY_RUN! Writing Toolchain file to path:{{.*}}BuildScriptToolchain.cmake | ||
# CHECK: cmake {{.*}}-DCMAKE_TOOLCHAIN_FILE:PATH={{.*}}BuildScriptToolchain.cmake {{.*}}cmark | ||
|
||
# ANDROID: DRY_RUN! Writing Toolchain file to path:{{.*}}cmark-android-aarch64/BuildScriptToolchain.cmake | ||
# ANDROID: cmake {{.*}}-DCMAKE_TOOLCHAIN_FILE:PATH={{.*}}cmark-android-aarch64/BuildScriptToolchain.cmake | ||
# ANDROID: -DCMAKE_Swift_FLAGS=-target aarch64-unknown-linux-android |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what it means to cross-compile for Android from an iPhone, Apple TV, or an Apple Watch.
These should likely remain unsupported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, nobody is suggesting that: 😄 these are merely CI exclusions that determine whether this Android
build-script
-related test will be run as part of a CI run targeting those Darwin platforms. Mishal disabled this test for those Darwin platforms four years ago in de148ad and 0ebceda because of some weird CI errors at that time, but I figured that these BuildSystem tests had matured since then and tried removing these exclusions in trunk a couple weeks ago, with macOS/iOS/watchOS now passing and no complaints from whatever internal CI runs any more of those platform tests.The idea here is simply to clean up unnecessary platform exclusions that are no longer needed, not to pave the way to cross-compile from an Apple TV for Android. 😃 If you think that we should keep some of these exclusions because they may break some internal Apple CI, just let me know which and I will modify this pull to keep them. However, since nobody has reported any breakage in trunk for the last week and a half since these Darwin exclusions were removed, I think it's safe to clean up these legacy exclusions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's keep this disabled for iOS, tvOS, and watchOS. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@etcwilde, what are you worried might go wrong exactly? As I noted in one of the original trunk pulls that I added with this 6.2 pull, these BuildSystem tests are already disabled on remote test executors. I believe they are still run when simply targeting iOS/tvOS/watchOS from macOS because they are unaware of that target OS for the CI, ie they are only aware that the host is macOS, so now that this test works on macOS, it works for all Darwin platforms.
If you think these BuildSystem tests don't make sense to run again for each of the non-macOS Darwin platforms, I suggest you modify that lit.local.cfg separately to disable them. My removal of these lines here is purely procedural: they all work now so I remove unnecessary logic, just like they were disabled four years ago by Mishal because they were failing then.