Skip to content

[build][android] Use a CMake toolchain file to cross-compile Testing #83260

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
Aug 2, 2025

Conversation

finagolfin
Copy link
Member

@gottesmm and @etcwilde, I believe you two are most familiar with this build-script feature, let me know what you think. I reused the linux toolchain file generation for Android, as they have a lot in common, but can separate the two if wanted. This pull was tested by cross-compiling on my Android CI, and natively on Android in the Termux app.

I will look at cross-compiling Foundation dependencies like libcurl with this new Android toolchain file in a subsequent pull.

@@ -154,12 +154,15 @@ def uses_host_tests(self):
"""
return True

def swift_flags(self, args):
def swift_flags(self, args, resource_path=None):
Copy link
Member Author

Choose a reason for hiding this comment

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

This method is currently used to generate Swift cross-compilation flags for build-script-impl products alone, but I was able to reuse it for Testing by passing in a separate resource_path. That resource_path calculation can only be done externally, where the particular build product is known.

@finagolfin
Copy link
Member Author

@swift-ci test

@xavgru12
Copy link

This looks great and is useful for cross compilation in general!

@finagolfin
Copy link
Member Author

@swift-ci smoke test

@finagolfin
Copy link
Member Author

Updated to refactor a bit and disable a recently failing but unrelated test on 32-bit Android.

@finagolfin
Copy link
Member Author

@swift-ci smoke test macos

@finagolfin
Copy link
Member Author

Ping @etcwilde, any feedback on this small Android-only pull? I'd like to get it into 6.2 next, works well on my CI.

@finagolfin
Copy link
Member Author

Updated to enable a test that now passes and rebased.

@swift-ci smoke test

@finagolfin
Copy link
Member Author

@MaxDesiatov, you've also modified this code, perhaps you can review?

Also, disable a recently failing test for Android armv7 and enable another one
that now passes.
@finagolfin
Copy link
Member Author

Added a validation test, made sure it worked on linux, and rebased.

@swift-ci smoke test

@finagolfin
Copy link
Member Author

Going ahead and merging because this only affects Android, passed the CI, and I want to get it into 6.2 next. If anyone finally reviews it and wants anything changed, I can always do that later.

@finagolfin finagolfin merged commit 09a751f into swiftlang:main Aug 2, 2025
3 checks passed
@finagolfin finagolfin deleted the droid branch August 2, 2025 09:59
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