Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/scripts/install-and-build-with-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -815,12 +815,16 @@ build() {

alias swift='$SWIFT_EXECUTABLE_FOR_ANDROID_SDK'

log "Using NDK at $ANDROID_NDK_HOME"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jakepetroules, swift-build is not using this environment variable properly on the GitHub CI, where it is correctly set to 28c before the build starts, but the internal compile shows it using NDK 27 instead. I tried setting it in $GITHUB_ENV also in the next line, but that made no difference.

This is why I pushed to not have these flaky env vars be the primary way we configure the NDK for SwiftPM, and to always notify the user that the env var is being used and with which NDK path.

Let me know if you have any idea about this bug.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Swift Build checks both ANDROID_NDK_ROOT and ANDROID_NDK_HOME, with the first taking precedence. Since GitHub Actions sets both, _ROOT is pointing to 27 still.

Go ahead and update GitHub actions to set both variables.

It's probably a good idea to emit a diagnostic in Swift Build if those two are set to different values.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, that was it, will clean this up and submit as a workaround for now.


# This can become a single invocation in the future when `swift build` supports multiple Android triples at once
for android_sdk_triple in "${ANDROID_SDK_TRIPLES[@]}" ; do
if [[ "$SWIFT_VERSION_INPUT" == "6.3" || "$SWIFT_VERSION_INPUT" == "nightly-6.3" ]]; then
local build_command="$SWIFT_BUILD_COMMAND --swift-sdk ${android_sdk_triple}"
else
local build_command="$SWIFT_BUILD_COMMAND --swift-sdk ${sdk_name} --triple ${android_sdk_triple}"
# Work around swift-build issue with ANDROID_NDK_ROOT overriding ANDROID_NDK_HOME
export ANDROID_NDK_ROOT="${ANDROID_NDK_HOME}"
fi
if [[ -n "$SWIFT_BUILD_FLAGS" ]]; then
build_command="$build_command $SWIFT_BUILD_FLAGS"
Expand Down
Loading