Skip to content
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
69800e6
Run the compiler validation suite for Android
marcprux May 26, 2025
e350942
Add --build-compiler option
marcprux May 27, 2025
fcde0f1
Add --cross-compile-build-swift-tools=0 from https://github.com/swift…
marcprux May 27, 2025
53aa633
Build with --build-llvm=0
marcprux May 28, 2025
60c3370
Check out Yams for Swift 6.1.1 build
marcprux May 28, 2025
63f3750
Add --llvm-ninja-targets-for-cross-compile-hosts=help
marcprux May 28, 2025
bfb9e50
Install pre-requisites
marcprux May 29, 2025
c527b1d
Install build prerequisites
marcprux Jun 2, 2025
ef3f51e
Only setup local toolchain if build-compiler is not 0
marcprux Jun 2, 2025
84e885a
Fix Yams version checkout
marcprux Jun 2, 2025
cdbd187
Quote arguments to build scripts
marcprux Jun 2, 2025
060c871
Permit empty host-toolchain argument in build.sh
marcprux Jun 2, 2025
163220d
Fix check for BUILD_COMPILER
marcprux Jun 2, 2025
f8db216
Re-order Docker PATH to system clang is used before Swift toolchain c…
marcprux Jun 3, 2025
a9942a2
Use --host-test to skip attempt to test on connected device/emulator
marcprux Jun 3, 2025
1cbf01e
Install clang in Dockerfile
marcprux Jun 4, 2025
383fb46
Add --skip-test-linux flag to build
marcprux Jun 5, 2025
af85033
Remove more folders to free up space
marcprux Jun 6, 2025
d78eb9e
Update patches
marcprux Jun 6, 2025
f7d1437
Add docker-specific CI variants that run the compiler validation tests
marcprux Jun 7, 2025
4e6f935
meaningless edit
finagolfin Jun 7, 2025
1692659
Update pull_request.yml to stop the 6.1 release builds
finagolfin Jun 7, 2025
287e81d
Update pull_request.yml to really only build the full docker compiler…
finagolfin Jun 7, 2025
e438467
Update README.md with meaningless edit to bump build
finagolfin Jun 8, 2025
324a3b7
Update build.sh to skip testing XCTest for linux, as a handful of the…
finagolfin Jun 9, 2025
02485be
Update build.sh to disable building libTesting and for 16K memory pag…
finagolfin Jun 9, 2025
d070103
Update build.sh to skip testing Foundation for linux, which requires …
finagolfin Jun 9, 2025
ee9529b
Update build.sh to not build each arch in a separate build directory
finagolfin Jun 10, 2025
4b99b11
Update Dockerfile to use clang 19 instead
finagolfin Jun 10, 2025
896ba60
Add self-hosted runner CI variant
marcprux Jun 13, 2025
9b9d56b
Fix CI workflow syntax
marcprux Jun 13, 2025
a157ab3
Update CI runner config
marcprux Jun 13, 2025
f8c0ffd
Update CI runner config
marcprux Jun 13, 2025
73ccf2e
Fix name of self-hosted CI runner
marcprux Jun 13, 2025
4af2892
Re-order arch run sequence
marcprux Jun 14, 2025
60e2543
Update CI for self-hosted runner
marcprux Jun 14, 2025
87b297a
Build for self-hosted runner
marcprux Jun 14, 2025
67a5291
Add swift-6.2-branch to self-hosted run matrix
marcprux Jun 15, 2025
6c3a1ba
Update build.sh to disable aarch64 temporarily, as we know it built fine
finagolfin Jun 15, 2025
b30c138
Update pull_request.yml to disable non-compiler builds, as they all w…
finagolfin Jun 15, 2025
3a0189b
Run compiler validation on self-hosted with increased timeout
marcprux Jun 15, 2025
929ff18
Update build-docker to only build for armv7
finagolfin Jun 16, 2025
28fbe55
Update pull_request.yml to disable self-hosted builds temporarily
finagolfin Jun 16, 2025
eaa140e
Update pull_request.yml to build the full compiler in github runners …
finagolfin Jun 16, 2025
f0b6057
Update build-docker to build for aarch64 first
finagolfin Jun 23, 2025
1161e56
Update toolchain-vars.sh to use older trunk snapahot toolchain that d…
finagolfin Jun 24, 2025
52108a8
Update toolchain-vars.sh to only download the latest release compiler…
finagolfin Jun 25, 2025
718b96c
Update build-docker to only build for armv7 again
finagolfin Jun 25, 2025
8eb389a
Update toolchain-vars.sh to fix setting branch variable
finagolfin Jun 25, 2025
86dff6b
Update build-docker to build for all three supported arches
finagolfin Jun 25, 2025
16c19f5
Update pull_request.yml to try self-hosted runs again
finagolfin Jun 25, 2025
ae32e31
Update build.sh to only install SDK components and remove linux stdlib
finagolfin Jun 27, 2025
0346d7f
Tolerate missing linux folder when attempting to clean up unnecessary…
marcprux Jun 29, 2025
c6e85b8
Fix extraCLIOptions in swift-toolset.json
marcprux Jun 29, 2025
c01a313
gcpdw
marcprux Jun 29, 2025
d0d85bb
Fix patch application
marcprux Jun 29, 2025
341bf54
Update apply-patches.sh to remove unused changes
finagolfin Jun 29, 2025
b77748a
Update swift-android-testing-except-release.patch to add Testing fix
finagolfin Jun 29, 2025
1bbe96b
Update swift-android.patch to remove unneeded patches
finagolfin Jun 29, 2025
3006f75
Update build.sh to try and fix Testing and clean up the bundle more
finagolfin Jun 29, 2025
d413bdb
marcprux Jun 29, 2025
266ecdb
Fix README.md
marcprux Jun 29, 2025
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
49 changes: 35 additions & 14 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -23,27 +23,38 @@ jobs:
*.log
android-build:
name: Build Android ${{ matrix.build-type }} ${{ matrix.swift-version }} ${{ matrix.arch }} SDK
name: Android ${{ matrix.build-type }} ${{ matrix.swift-version }} ${{ matrix.arch }} ${{ matrix.runner }} (compiler=${{ matrix.build-compiler }})
strategy:
fail-fast: false
matrix:
#build-type: ['docker']
build-type: ['docker', 'local']
# blank arch builds all (aarch64,x86_64,armv7)
#arch: ['']
# builds only x86_64 to speed up the validation
#arch: ['x86_64']
# build both the quick (x86_64) and complete (aarch64,x86_64,armv7) SDKs
arch: ['x86_64', '']
swift-version: ['release', 'swift-6.2-branch', 'development']
runs-on: ubuntu-24.04
include:
- swift-version: 'swift-6.2-branch'
build-type: 'docker'
build-compiler: '1'
runner: 'self-hosted'
- swift-version: 'development'
build-type: 'docker'
build-compiler: '1'
runner: 'self-hosted'
- swift-version: 'swift-6.2-branch'
build-type: 'docker'
build-compiler: '0'
runner: 'ubuntu-24.04'
- swift-version: 'development'
build-type: 'docker'
build-compiler: '0'
runner: 'ubuntu-24.04'
runs-on: ${{ matrix.runner }}
# 15 hour timeout
timeout-minutes: 900
steps:
- name: Free Disk Space
if: ${{ matrix.runner != 'self-hosted' }}
run: |
df -h
# brings available space from 25G to 32G
# otherwise we sometimes run out of space during the build
sudo rm -rf /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/share/chromium /usr/local/share/powershell /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/share/chromium /usr/local/share/powershell /usr/share/dotnet /opt/ghc /opt/hostedtoolcache /usr/local/graalvm/ /usr/local/.ghcup/ /usr/local/lib/node_modules /usr/local/share/boost
sudo docker image prune --all --force
sudo docker builder prune -a
df -h
@@ -53,6 +64,8 @@ jobs:
# these variabes are used by build-docker and build-local
# to determine which Swift version to build for
echo "BUILD_SCHEME=${{ matrix.swift-version }}" >> $GITHUB_ENV
# pass the build-compiler matrix through to the build script
echo "BUILD_COMPILER=${{ matrix.build-compiler }}" >> $GITHUB_ENV
echo "TARGET_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV
echo "WORKDIR=${{ runner.temp }}/swift-android-sdk" >> $GITHUB_ENV
- name: Checkout repository
@@ -61,7 +74,7 @@ jobs:
if: ${{ matrix.build-type == 'local' }}
working-directory: swift-ci/sdks/android
run: |
sudo apt install -q ninja-build patchelf
sudo apt install -q patchelf build-essential cmake ninja-build python3 golang git gnupg2 libcurl4-openssl-dev libedit-dev libicu-dev libncurses5-dev libpython3-dev libsqlite3-dev libxml2-dev rsync uuid-dev uuid-runtime tzdata curl unzip
./build-local ${BUILD_SCHEME} ${WORKDIR}
- name: Build Android SDK (Docker)
if: ${{ matrix.build-type == 'docker' }}
@@ -99,6 +112,9 @@ jobs:
if [[ "${{ matrix.build-type }}" == 'local' ]]; then
ARTIFACT_NAME="${ARTIFACT_NAME}-local"
fi
if [[ "${{ matrix.build-compiler }}" == '1' ]]; then
ARTIFACT_NAME="${ARTIFACT_NAME}-hostbuild"
fi
# artifacts need a unique name so we suffix with the matrix arch(s)
if [[ ! -z "${{ matrix.arch }}" ]]; then
ARTIFACT_NAME="${ARTIFACT_NAME}-$(echo ${{ matrix.arch }} | tr ',' '-')"
@@ -117,6 +133,7 @@ jobs:
name: ${{ steps.info.outputs.artifact-name }}
path: ${{ steps.info.outputs.artifact-path }}
- name: Cleanup
if: ${{ matrix.runner != 'self-hosted' }}
run: |
# need to free up some space or else when installing we get: No space left on device
df -h
@@ -125,6 +142,7 @@ jobs:
sudo docker builder prune -a
df -h
- name: Install artifactbundle
if: ${{ matrix.runner != 'self-hosted' }}
shell: bash
run: |
set -ex
@@ -135,6 +153,7 @@ jobs:
echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV
- name: Create Demo Project
if: ${{ matrix.runner != 'self-hosted' }}
run: |
cd ${{ runner.temp }}
mkdir DemoProject
@@ -149,6 +168,7 @@ jobs:
echo 'import Android' >> Sources/DemoProject/DemoProject.swift
- name: Test Demo Project on Android
uses: skiptools/swift-android-action@main
if: ${{ matrix.runner != 'self-hosted' }}
with:
# only test for the complete arch SDK build to speed up CI
#run-tests: ${{ matrix.arch == '' }}
@@ -157,14 +177,15 @@ jobs:
installed-swift: ${{ steps.info.outputs.swift-root }}

- name: Checkout swift-algorithms
if: ${{ matrix.runner != 'self-hosted' }}
uses: actions/checkout@v4
with:
repository: apple/swift-algorithms
path: swift-algorithms
- name: Test swift-algorithms
if: ${{ matrix.runner != 'self-hosted' }}
uses: skiptools/swift-android-action@main
with:
run-tests: ${{ matrix.arch == '' }}
package-path: swift-algorithms
installed-sdk: ${{ steps.info.outputs.sdk-id }}
installed-swift: ${{ steps.info.outputs.swift-root }}
3 changes: 2 additions & 1 deletion swift-ci/sdks/android/Dockerfile
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ ARG SWIFT_TOOLCHAIN_URL=
RUN apt-get -q update \
&& DEBIAN_FRONTEND=noninteractive apt-get -q install -y \
build-essential \
clang-19 \
cmake \
ninja-build \
python3 \
@@ -54,7 +55,7 @@ ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
COPY scripts/install-swift.sh /scripts/install-swift.sh
RUN chmod ugo+x /scripts/install-swift.sh
RUN /scripts/install-swift.sh /usr/local/swift
ENV PATH="/usr/local/swift/bin:${PATH}"
ENV PATH="/usr/lib/llvm-19/bin:/usr/local/swift/bin:${PATH}"

ARG ANDROID_NDK_VERSION=

15 changes: 8 additions & 7 deletions swift-ci/sdks/android/build-docker
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ source ./scripts/toolchain-vars.sh

# Check-out and patch the sources
./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-tag ${SWIFT_TAG}
${WORKDIR}/source/swift-android-patches/apply-patches.sh ${WORKDIR}/source/swift-project
./patches/apply-patches.sh ${WORKDIR}/source/swift-project

mkdir -p ${WORKDIR}/products
chmod ugo+rwx ${WORKDIR}/products
@@ -59,9 +59,10 @@ $DOCKER run -i --rm \
-v ${WORKDIR}/products:/products:rw \
${CONTAINER_NAME} \
/scripts/build.sh \
--source-dir /source \
--products-dir /products \
--host-toolchain /usr/local/swift \
--android-api ${ANDROID_API} \
--ndk-home /usr/local/ndk/${ANDROID_NDK_VERSION} \
--archs ${TARGET_ARCHS}
--source-dir "/source" \
--products-dir "/products" \
--host-toolchain "/usr/local/swift" \
--build-compiler "${BUILD_COMPILER}" \
--android-api "${ANDROID_API}" \
--ndk-home "/usr/local/ndk/${ANDROID_NDK_VERSION}" \
--archs "${TARGET_ARCHS}"
35 changes: 19 additions & 16 deletions swift-ci/sdks/android/build-local
Original file line number Diff line number Diff line change
@@ -25,16 +25,18 @@ WORKDIR=$(realpath ${WORKDIR})
HOST_OS=ubuntu$(lsb_release -sr)
source ./scripts/toolchain-vars.sh

SWIFT_ROOT=${WORKDIR}/host-toolchain
HOST_TOOLCHAIN=$SWIFT_ROOT/$SWIFT_BASE/usr
if [[ ! -d "$HOST_TOOLCHAIN" ]]; then
./scripts/install-swift.sh ${HOST_TOOLCHAIN}
fi
if [[ "${BUILD_COMPILER}" != "1" ]]; then
SWIFT_ROOT=${WORKDIR}/host-toolchain
HOST_TOOLCHAIN=$SWIFT_ROOT/$SWIFT_BASE/usr
if [[ ! -d "$HOST_TOOLCHAIN" ]]; then
./scripts/install-swift.sh ${HOST_TOOLCHAIN}
fi

$HOST_TOOLCHAIN/bin/swift --version
$HOST_TOOLCHAIN/bin/swift --version

# ensure the correct Swift is first in the PATH
export PATH=$HOST_TOOLCHAIN/bin:$PATH
# ensure the correct Swift is first in the PATH
export PATH=$HOST_TOOLCHAIN/bin:$PATH
fi

export ANDROID_NDK_HOME=${WORKDIR}/ndk/${ANDROID_NDK_VERSION}

@@ -50,15 +52,16 @@ fi

# Check-out and patch the sources
./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-tag ${SWIFT_TAG}
${WORKDIR}/source/swift-android-patches/apply-patches.sh ${WORKDIR}/source/swift-project
./patches/apply-patches.sh ${WORKDIR}/source/swift-project

mkdir -p ${WORKDIR}/products

./scripts/build.sh \
--source-dir ${WORKDIR}/source \
--products-dir ${WORKDIR}/products \
--build-dir ${WORKDIR}/build \
--host-toolchain ${HOST_TOOLCHAIN} \
--android-api ${ANDROID_API} \
--ndk-home ${ANDROID_NDK_HOME} \
--archs ${TARGET_ARCHS}
--source-dir "${WORKDIR}/source" \
--products-dir "${WORKDIR}/products" \
--build-dir "${WORKDIR}/build" \
--build-compiler "${BUILD_COMPILER}" \
--host-toolchain "${HOST_TOOLCHAIN}" \
--android-api "${ANDROID_API}" \
--ndk-home "${ANDROID_NDK_HOME}" \
--archs "${TARGET_ARCHS}"
23 changes: 23 additions & 0 deletions swift-ci/sdks/android/patches/apply-patches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash -ex

patches_dir=$(dirname $(realpath -- "${BASH_SOURCE[0]}"))
cd ${1}

case "${BUILD_SCHEME}" in
swift-*-branch)
git apply -v -C1 ${patches_dir}/swift-android.patch
git apply -v -C1 ${patches_dir}/swift-android-testing-except-release.patch
;;
development)
git apply -v -C1 ${patches_dir}/swift-android.patch
git apply -v -C1 ${patches_dir}/swift-android-trunk-libdispatch.patch
git apply -v -C1 ${patches_dir}/swift-android-testing-except-release.patch
;;
*)
echo "$0: invalid BUILD_SCHEME=${BUILD_SCHEME}"
exit 1
;;
esac

# disable backtrace() for Android (needs either API33+ or libandroid-execinfo, or to manually add in backtrace backport)
perl -pi -e 's;os\(Android\);os\(AndroidDISABLED\);g' swift-testing/Sources/Testing/SourceAttribution/Backtrace.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
diff --git a/swift/test/ClangImporter/pcm-emit-direct-cc1-mode.swift b/swift/test/ClangImporter/pcm-emit-direct-cc1-mode.swift
index f5048b9e3d5..c227ef7b77d 100644
--- a/swift/test/ClangImporter/pcm-emit-direct-cc1-mode.swift
+++ b/swift/test/ClangImporter/pcm-emit-direct-cc1-mode.swift
@@ -9,7 +9,7 @@
// CHECK-DUMP: Module map file: {{.*[/\\]}}Inputs{{/|\\}}custom-modules{{/|\\}}module.modulemap

// Verify that the clang command-line used is cc1
-// RUN: %FileCheck -check-prefix CHECK-CLANG -DTRIPLE=%target-triple %s < %t.diags.txt
+// RUN: %FileCheck -check-prefix CHECK-CLANG -DTRIPLE=%module-target-triple %s < %t.diags.txt
// CHECK-CLANG: clang importer cc1 args
// CHECK-CLANG-SAME: '-o' '{{.*[/\\]}}script.pcm' '-fsyntax-only' '-x' 'objective-c' '{{.*[/\\]}}module.modulemap' '-triple' '[[TRIPLE]]'
// CHECK-CLANG-SAME: '-fmodules'
diff --git a/swift/test/IRGen/abitypes_arm.swift b/swift/test/IRGen/abitypes_arm.swift
index 9428294483d..52bd8b10145 100644
--- a/swift/test/IRGen/abitypes_arm.swift
+++ b/swift/test/IRGen/abitypes_arm.swift
@@ -11,6 +11,6 @@ class Foo {
}
}

-// armv7: define internal void @makeOne(ptr noalias sret({{.*}}) align 4 %agg.result, float{{( noundef)?}} %f, float{{( noundef)?}} %s)
+// armv7: define internal void @makeOne(ptr{{( dead_on_unwind)?}} noalias{{( writable)?}} sret({{.*}}) align 4 %agg.result, float{{( noundef)?}} %f, float{{( noundef)?}} %s)
// armv7s: define internal void @makeOne(ptr noalias sret({{.*}}) align 4 %agg.result, float %f, float %s)
// armv7k: define internal %struct.One @makeOne(float {{.*}}%f, float {{.*}}%s)
diff --git a/swift/test/Interop/Cxx/class/constructors-copy-module-interface.swift b/swift/test/Interop/Cxx/class/constructors-copy-module-interface.swift
index 042c10e7d1d..254f6543b58 100644
--- a/swift/test/Interop/Cxx/class/constructors-copy-module-interface.swift
+++ b/swift/test/Interop/Cxx/class/constructors-copy-module-interface.swift
@@ -1,4 +1,5 @@
// RUN: %target-swift-ide-test -print-module -module-to-print=Constructors -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
+// XFAIL: OS=linux-androideabi

// CHECK: struct TemplatedCopyConstructor
// CHECK: struct TemplatedCopyConstructorWithExtraArg
diff --git a/swift/test/Interop/Cxx/class/constructors-diagnostics.swift b/swift/test/Interop/Cxx/class/constructors-diagnostics.swift
index aac01480660..8fa99fae7fb 100644
--- a/swift/test/Interop/Cxx/class/constructors-diagnostics.swift
+++ b/swift/test/Interop/Cxx/class/constructors-diagnostics.swift
@@ -2,6 +2,7 @@

// This test uses -verify-additional-file, which do not work well on Windows.
// UNSUPPORTED: OS=windows-msvc
+// XFAIL: OS=linux-androideabi

import Constructors

diff --git a/swift/test/Interop/Cxx/class/constructors-module-interface.swift b/swift/test/Interop/Cxx/class/constructors-module-interface.swift
index bf189b6e302..d2c3d65f03e 100644
--- a/swift/test/Interop/Cxx/class/constructors-module-interface.swift
+++ b/swift/test/Interop/Cxx/class/constructors-module-interface.swift
@@ -1,4 +1,5 @@
// RUN: %target-swift-ide-test -print-module -module-to-print=Constructors -I %S/Inputs/ -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
+// XFAIL: OS=linux-androideabi

// CHECK: struct ExplicitDefaultConstructor {
// CHECK-NEXT: init()
diff --git a/swift/test/Interop/Cxx/class/constructors-silgen.swift b/swift/test/Interop/Cxx/class/constructors-silgen.swift
index b1624ccccfe..79cbdf170de 100644
--- a/swift/test/Interop/Cxx/class/constructors-silgen.swift
+++ b/swift/test/Interop/Cxx/class/constructors-silgen.swift
@@ -1,4 +1,5 @@
// RUN: %target-swiftxx-frontend -I %S/Inputs -Xllvm -sil-print-types -emit-silgen %s | %FileCheck %s
+// XFAIL: OS=linux-androideabi

import Constructors

diff --git a/swift/test/Interop/Cxx/class/constructors-typechecker.swift b/swift/test/Interop/Cxx/class/constructors-typechecker.swift
index 8ce10b1ca75..52ff4104b83 100644
--- a/swift/test/Interop/Cxx/class/constructors-typechecker.swift
+++ b/swift/test/Interop/Cxx/class/constructors-typechecker.swift
@@ -1,4 +1,5 @@
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -enable-experimental-cxx-interop
+// XFAIL: OS=linux-androideabi

import Constructors

diff --git a/swift/test/Interop/Cxx/class/custom-new-operator-irgen.swift b/swift/test/Interop/Cxx/class/custom-new-operator-irgen.swift
index 74e692c9db2..0423493afac 100644
--- a/swift/test/Interop/Cxx/class/custom-new-operator-irgen.swift
+++ b/swift/test/Interop/Cxx/class/custom-new-operator-irgen.swift
@@ -5,4 +5,4 @@ import CustomNewOperator
var x = callsCustomNew()

// Make sure the definition of `operator new` is emitted.
-// CHECK: define {{.*}} @{{_ZnwmPv15container_new_t|"\?\?2@YAPEAX_KPEAXUcontainer_new_t@@@Z"}}
+// CHECK: define {{.*}} @{{_Znw(j|m)Pv15container_new_t|"\?\?2@YAPEAX_KPEAXUcontainer_new_t@@@Z"}}
diff --git a/swift/test/SILOptimizer/package-cmo-serialize-tables.swift b/swift/test/SILOptimizer/package-cmo-serialize-tables.swift
index 382ff2e8080..f061374b2a1 100644
--- a/swift/test/SILOptimizer/package-cmo-serialize-tables.swift
+++ b/swift/test/SILOptimizer/package-cmo-serialize-tables.swift
@@ -19,7 +19,7 @@

// Temporarily disabling on watchOS (both arm64_32 & armv7k):
// rdar://140330692 (🟠 OSS Swift CI: oss-swift_tools-RA_stdlib-DA_test-device-non_executable failed...
-// UNSUPPORTED: OS=watchos
+// UNSUPPORTED: OS=watchos, OS=linux-androideabi

//--- main.swift

diff --git a/swift/test/SILOptimizer/throws_prediction.swift b/swift/test/SILOptimizer/throws_prediction.swift
index f7f2664b2de..01d36e127c6 100644
--- a/swift/test/SILOptimizer/throws_prediction.swift
+++ b/swift/test/SILOptimizer/throws_prediction.swift
@@ -16,7 +16,7 @@
// RUN: -sil-verify-all -module-name=test -emit-sil \
// RUN: | %FileCheck --check-prefix CHECK-DISABLED %s

-// UNSUPPORTED: CPU=armv7k || CPU=arm64_32
+// UNSUPPORTED: CPU=armv7k, CPU=arm64_32, CPU=armv7

// CHECK-DISABLED-NOT: normal_count

diff --git a/swift/utils/swift_build_support/swift_build_support/products/product.py b/swift/utils/swift_build_support/swift_build_support/products/product.py
index 274b6037305..bf0f7fcf671 100644
--- a/swift/utils/swift_build_support/swift_build_support/products/product.py
+++ b/swift/utils/swift_build_support/swift_build_support/products/product.py
@@ -212,7 +212,7 @@ class Product(object):
if self.args.cross_compile_hosts:
if self.is_darwin_host(host_target):
install_destdir = self.host_install_destdir(host_target)
- else:
+ elif self.args.cross_compile_append_host_target_to_destdir:
install_destdir = os.path.join(install_destdir, self.args.host_target)
return targets.toolchain_path(install_destdir,
self.args.install_prefix)
diff --git a/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake b/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake
index 468dc61..a90ae3d 100644
--- a/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake
+++ b/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake
@@ -2,6 +2,10 @@
set(print_target_info_invocation "${CMAKE_Swift_COMPILER}" -print-target-info)
if(CMAKE_Swift_COMPILER_TARGET)
list(APPEND print_target_info_invocation -target ${CMAKE_Swift_COMPILER_TARGET})
+else()
+ set(arg_list ${CMAKE_Swift_FLAGS})
+ separate_arguments(arg_list)
+ list(APPEND print_target_info_invocation ${arg_list})
endif()
execute_process(COMMAND ${print_target_info_invocation} OUTPUT_VARIABLE target_info_json)
message(CONFIGURE_LOG "Swift Target Info: ${print_target_info_invocation}\n"
diff --git a/swift-testing/cmake/modules/PlatformInfo.cmake b/swift-testing/cmake/modules/PlatformInfo.cmake
index 94c60ef..ab8a491 100644
--- a/swift-testing/cmake/modules/PlatformInfo.cmake
+++ b/swift-testing/cmake/modules/PlatformInfo.cmake
@@ -9,6 +9,10 @@
set(print_target_info_invocation "${CMAKE_Swift_COMPILER}" -print-target-info)
if(CMAKE_Swift_COMPILER_TARGET)
list(APPEND print_target_info_invocation -target ${CMAKE_Swift_COMPILER_TARGET})
+else()
+ set(arg_list ${CMAKE_Swift_FLAGS})
+ separate_arguments(arg_list)
+ list(APPEND print_target_info_invocation ${arg_list})
endif()
execute_process(COMMAND ${print_target_info_invocation} OUTPUT_VARIABLE target_info_json)
message(CONFIGURE_LOG "Swift Target Info: ${print_target_info_invocation}\n"
61 changes: 61 additions & 0 deletions swift-ci/sdks/android/patches/swift-android-testing-release.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
diff --git a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py b/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py
index b6bfa5760ef..324d1a77eea 100644
--- a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py
+++ b/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py
@@ -51,7 +51,7 @@ class SwiftTesting(product.Product):
return False

def should_install(self, host_target):
- return self.args.install_swift_testing_macros
+ return self.args.install_swift_testing

def _cmake_product(self, host_target):
build_root = os.path.dirname(self.build_dir)
diff --git a/swift-corelibs-foundation/Sources/CoreFoundation/CFPlatform.c b/swift-corelibs-foundation/Sources/CoreFoundation/CFPlatform.c
index 90f4aa78..0429425b 100644
--- a/swift-corelibs-foundation/Sources/CoreFoundation/CFPlatform.c
+++ b/swift-corelibs-foundation/Sources/CoreFoundation/CFPlatform.c
@@ -1948,7 +1948,7 @@ CF_CROSS_PLATFORM_EXPORT void *_CFReallocf(void *ptr, size_t size) {
#endif
}

-#if TARGET_OS_ANDROID
+#if TARGET_OS_ANDROID && __ANDROID_API__ < 28

#include <dlfcn.h>
#include <spawn.h>
@@ -2277,6 +2277,10 @@ CF_EXPORT int _CFPosixSpawnFileActionsAddClose(_CFPosixSpawnFileActionsRef file_
return _CFPosixSpawnFileActionsAddCloseImpl(file_actions, filedes);
}

+CF_EXPORT int _CFPosixSpawnFileActionsChdir(_CFPosixSpawnFileActionsRef file_actions, const char *path) {
+ return ENOSYS;
+}
+
CF_EXPORT int _CFPosixSpawn(pid_t *_CF_RESTRICT pid, const char *_CF_RESTRICT path, _CFPosixSpawnFileActionsRef file_actions, _CFPosixSpawnAttrRef _Nullable _CF_RESTRICT attrp, char *_Nullable const argv[_Nullable _CF_RESTRICT], char *_Nullable const envp[_Nullable _CF_RESTRICT]) {
_CFPosixSpawnInitialize();
return _CFPosixSpawnImpl(pid, path, file_actions, attrp, argv, envp);
@@ -2279,7 +2279,7 @@ CF_EXPORT int _CFPosixSpawnFileActionsAddClose(_CFPosixSpawnFileActionsRef file_
}

CF_EXPORT int _CFPosixSpawnFileActionsChdir(_CFPosixSpawnFileActionsRef file_actions, const char *path) {
- #if defined(__GLIBC__) && !__GLIBC_PREREQ(2, 29)
+ #if defined(__GLIBC__) && !__GLIBC_PREREQ(2, 29) || (defined(__ANDROID__) && __ANDROID_API__ < 34)
// Glibc versions prior to 2.29 don't support posix_spawn_file_actions_addchdir_np, impacting:
// - Amazon Linux 2 (EoL mid-2025)
return ENOSYS;
diff --git a/swift-testing/cmake/modules/SwiftModuleInstallation.cmake b/swift-testing/cmake/modules/SwiftModuleInstallation.cmake
index 1553725..d9f9e5b 100644
--- a/swift-testing/cmake/modules/SwiftModuleInstallation.cmake
+++ b/swift-testing/cmake/modules/SwiftModuleInstallation.cmake
@@ -75,6 +75,10 @@ function(_swift_testing_install_target module)
set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info)
if(CMAKE_Swift_COMPILER_TARGET)
list(APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET})
+ else()
+ set(arg_list ${CMAKE_Swift_FLAGS})
+ separate_arguments(arg_list)
+ list(APPEND module_triple_command ${arg_list})
endif()
execute_process(COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json)
string(JSON module_triple GET "${target_info_json}" "target" "moduleTriple")
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
diff --git a/swift/test/Misc/verify-swift-feature-testing.test-sh b/swift/test/Misc/verify-swift-feature-testing.test-sh
index 3f36fc979cb..8713ae8fea8 100755
--- a/swift/test/Misc/verify-swift-feature-testing.test-sh
+++ b/swift/test/Misc/verify-swift-feature-testing.test-sh
@@ -98,7 +98,6 @@ def find_matches(swift_src_root):
# `-enable-upcoming-feature` in the test directories.
output = subprocess.check_output(
[
- "git",
"grep",
"--extended-regexp",
"--recursive",
diff --git a/swift/test/Reflection/conformance_descriptors.swift b/swift/test/Reflection/conformance_descriptors.swift
index b114f764552..e1bd98c08f4 100644
--- a/swift/test/Reflection/conformance_descriptors.swift
+++ b/swift/test/Reflection/conformance_descriptors.swift
@@ -5,6 +5,7 @@
//
// Temporarily disable on AArch64 Linux (rdar://88451721)
// UNSUPPORTED: OS=linux-gnu && CPU=aarch64
+// XFAIL: OS=linux-android

// rdar://100558042
// UNSUPPORTED: CPU=arm64e
diff --git a/swift/test/Reflection/typeref_decoding.swift b/swift/test/Reflection/typeref_decoding.swift
index e0a3b4465a3..c01af893eda 100644
--- a/swift/test/Reflection/typeref_decoding.swift
+++ b/swift/test/Reflection/typeref_decoding.swift
@@ -10,6 +10,7 @@

// FIXME: rdar://127796117
// UNSUPPORTED: OS=linux-gnu && CPU=aarch64
+// XFAIL: OS=linux-android

// RUN: %target-build-swift -target %target-swift-5.2-abi-triple -Xfrontend -enable-anonymous-context-mangled-names %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift -parse-as-library -emit-module -emit-library %no-fixup-chains -module-name TypesToReflect -o %t/%target-library-name(TypesToReflect)
// RUN: %target-build-swift -target %target-swift-5.2-abi-triple -Xfrontend -enable-anonymous-context-mangled-names %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift %S/Inputs/main.swift -emit-module -emit-executable %no-fixup-chains -module-name TypesToReflect -o %t/TypesToReflect
diff --git a/swift-corelibs-libdispatch/cmake/modules/SwiftSupport.cmake b/swift-corelibs-libdispatch/cmake/modules/SwiftSupport.cmake
index 3da519e..e2dd8ed 100644
--- a/swift-corelibs-libdispatch/cmake/modules/SwiftSupport.cmake
+++ b/swift-corelibs-libdispatch/cmake/modules/SwiftSupport.cmake
@@ -4,6 +4,10 @@ if(NOT dispatch_MODULE_TRIPLE)
set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info)
if(CMAKE_Swift_COMPILER_TARGET)
list(APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET})
+ else()
+ set(arg_list ${CMAKE_Swift_FLAGS})
+ separate_arguments(arg_list)
+ list(APPEND module_triple_command ${arg_list})
endif()
execute_process(COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json)

diff --git a/swift-corelibs-libdispatch/src/swift/CMakeLists.txt b/swift-corelibs-libdispatch/src/swift/CMakeLists.txt
index 38bef37..d0ddf98 100644
--- a/swift-corelibs-libdispatch/src/swift/CMakeLists.txt
+++ b/swift-corelibs-libdispatch/src/swift/CMakeLists.txt
@@ -15,6 +15,7 @@ add_library(swiftDispatch
Source.swift
Time.swift
Wrapper.swift)
+set(CMAKE_SHARED_LINKER_FLAGS "")
target_compile_options(swiftDispatch PRIVATE
"SHELL:-Xcc -fblocks"
"SHELL:-Xcc -fmodule-map-file=${PROJECT_SOURCE_DIR}/dispatch/module.modulemap"
103 changes: 103 additions & 0 deletions swift-ci/sdks/android/patches/swift-android.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
diff --git a/swift/utils/build-script-impl b/swift/utils/build-script-impl
index 16e05052609..7ab8cebfab8 100755
--- a/swift/utils/build-script-impl
+++ b/swift/utils/build-script-impl
@@ -2622,6 +2622,7 @@ for host in "${ALL_HOSTS[@]}"; do
echo "Cleaning the libdispatch build directory"
call rm -rf "${LIBDISPATCH_BUILD_DIR}"
fi
+ call ln -sf "${SWIFT_BUILD_PATH}/lib/swift" "${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib"

cmake_options=(
-DENABLE_SWIFT=YES
diff --git a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py b/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py
index 324d1a77eea..e88601a8701 100644
--- a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py
+++ b/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py
@@ -13,6 +13,9 @@
import os

from build_swift.build_swift.versions import Version
+from ..host_specific_configuration \
+ import HostSpecificConfiguration
+from ..targets import StdlibDeploymentTarget

from . import cmake_product
from . import product
@@ -115,6 +117,22 @@ class SwiftTestingCMakeShim(cmake_product.CMakeProduct):
# FIXME: If we build macros for the builder, specify the path.
self.cmake_options.define('SwiftTesting_MACRO', 'NO')

+ if host_target.startswith('android') and self.is_cross_compile_target(host_target):
+ host_config = HostSpecificConfiguration(host_target, self.args)
+ self.cmake_options.extend(host_config.cmake_options)
+ flags = '-target %s-unknown-linux-android%s ' % (self.args.android_arch,
+ self.args.android_api_level)
+
+ flags += '-resource-dir %s/lib/swift ' % (
+ self.host_install_destdir(host_target) + self.args.install_prefix)
+
+ ndk_path = StdlibDeploymentTarget.get_target_for_name(host_target).platform.ndk_toolchain_path(self.args)
+ flags += '-sdk %s/sysroot ' % (ndk_path)
+ flags += '-tools-directory %s/bin' % (ndk_path)
+ self.cmake_options.define('CMAKE_Swift_FLAGS', flags)
+ self.cmake_options.define('CMAKE_CXX_COMPILER_WORKS', 'True')
+ self.cmake_options.define('CMAKE_FIND_ROOT_PATH', self.args.cross_compile_deps_path)
+
self.generate_toolchain_file_for_darwin_or_linux(
host_target, override_macos_deployment_version=override_deployment_version)
self.build_with_cmake([], self.args.build_variant, [],
diff --git a/swift-corelibs-foundation/CMakeLists.txt b/swift-corelibs-foundation/CMakeLists.txt
index 7f290d16..95366592 100644
--- a/swift-corelibs-foundation/CMakeLists.txt
+++ b/swift-corelibs-foundation/CMakeLists.txt
@@ -51,6 +51,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
endif()
endif()

+set(CMAKE_SHARED_LINKER_FLAGS "")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
diff --git a/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake b/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake
index cbdfc2a..bb4121d 100644
--- a/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake
+++ b/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake
@@ -37,6 +37,10 @@ function(_swift_foundation_install_target module)
set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info)
if(CMAKE_Swift_COMPILER_TARGET)
list(APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET})
+ else()
+ set(arg_list ${CMAKE_Swift_FLAGS})
+ separate_arguments(arg_list)
+ list(APPEND module_triple_command ${arg_list})
endif()
execute_process(COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json)
string(JSON module_triple GET "${target_info_json}" "target" "moduleTriple")
diff --git a/swift-testing/CMakeLists.txt b/swift-testing/CMakeLists.txt
index 1be9a4b..bd7b1bd 100644
--- a/swift-testing/CMakeLists.txt
+++ b/swift-testing/CMakeLists.txt
@@ -28,6 +28,7 @@ list(APPEND CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake/modules
${PROJECT_SOURCE_DIR}/cmake/modules/shared)

+set(CMAKE_SHARED_LINKER_FLAGS "")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
diff --git a/swift-testing/cmake/modules/TargetTriple.cmake b/swift-testing/cmake/modules/TargetTriple.cmake
index e087cc4..02f3a95 100644
--- a/swift-testing/cmake/modules/TargetTriple.cmake
+++ b/swift-testing/cmake/modules/TargetTriple.cmake
@@ -10,6 +10,10 @@
set(SWT_TARGET_INFO_COMMAND "${CMAKE_Swift_COMPILER}" -print-target-info)
if(CMAKE_Swift_COMPILER_TARGET)
list(APPEND SWT_TARGET_INFO_COMMAND -target ${CMAKE_Swift_COMPILER_TARGET})
+else()
+ set(arg_list ${CMAKE_Swift_FLAGS})
+ separate_arguments(arg_list)
+ list(APPEND SWT_TARGET_INFO_COMMAND ${arg_list})
endif()
execute_process(COMMAND ${SWT_TARGET_INFO_COMMAND} OUTPUT_VARIABLE SWT_TARGET_INFO_JSON)
string(JSON SWT_TARGET_TRIPLE GET "${SWT_TARGET_INFO_JSON}" "target" "unversionedTriple")
98 changes: 76 additions & 22 deletions swift-ci/sdks/android/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ function groupend {

function usage {
cat <<EOF
usage: build.sh --source-dir <path> --products-dir <path> --ndk-home <path> --host-toolchain <path>
usage: build.sh --source-dir <path> --products-dir <path> --ndk-home <path>
[--name <sdk-name>] [--version <version>] [--build-dir <path>]
[--archs <arch>[,<arch> ...]]
@@ -63,6 +63,7 @@ Options:
--source-dir <path> Specify the path in which the sources can be found.
--ndk-home <path> Specify the path to the Android NDK
--host-toolchain <tc> Specify the path to the host Swift toolchain
--build-compiler <bc> Whether to build and validate the host compiler
--products-dir <path> Specify the path in which the products should be written.
--build-dir <path> Specify the path in which intermediates should be stored.
--android-api <api> Specify the Android API level
@@ -130,6 +131,8 @@ while [ "$#" -gt 0 ]; do
ndk_home="$2"; shift ;;
--host-toolchain)
host_toolchain="$2"; shift ;;
--build-compiler)
build_compiler="$2"; shift ;;
--build-dir)
build_dir="$2"; shift ;;
--android-api)
@@ -155,7 +158,7 @@ done
# Change the commas for spaces
archs="${archs//,/ }"

if [[ -z "$source_dir" || -z "$products_dir" || -z "$ndk_home" || -z "$host_toolchain" ]]; then
if [[ -z "$source_dir" || -z "$products_dir" || -z "$ndk_home" ]]; then
usage
exit 1
fi
@@ -234,8 +237,10 @@ export ANDROID_NDK_HOME=$ndk_home
export ANDROID_NDK=$ndk_home

echo "Swift found at ${swift_dir}"
echo "Host toolchain found at ${host_toolchain}"
${host_toolchain}/bin/swift --version
if [[ ! -z "${host_toolchain}" ]]; then
echo "Host toolchain found at ${host_toolchain}"
${host_toolchain}/bin/swift --version
fi
echo "Android NDK found at ${ndk_home}"
${ndk_installation}/bin/clang --version
echo "Building for ${archs}"
@@ -262,11 +267,31 @@ function run() {

for arch in $archs; do
case $arch in
armv7) target_host="arm-linux-androideabi"; compiler_target_host="armv7a-linux-androideabi$android_api"; android_abi="armeabi-v7a" ;;
aarch64) target_host="aarch64-linux-android"; compiler_target_host="$target_host$android_api"; android_abi="arm64-v8a" ;;
x86_64) target_host="x86_64-linux-android"; compiler_target_host="$target_host$android_api"; android_abi="x86_64" ;;
x86) target_host="x86-linux-android"; compiler_target_host="$target_host$android_api"; android_abi="x86" ;;
*) echo "Unknown architecture '$1'"; usage; exit 0 ;;
armv7)
target_host="arm-linux-androideabi"
compiler_target_host="armv7a-linux-androideabi$android_api"
android_abi="armeabi-v7a"
;;
aarch64)
target_host="aarch64-linux-android"
compiler_target_host="$target_host$android_api"
android_abi="arm64-v8a"
;;
x86_64)
target_host="x86_64-linux-android"
compiler_target_host="$target_host$android_api"
android_abi="x86_64"
;;
x86)
target_host="x86-linux-android"
compiler_target_host="$target_host$android_api"
android_abi="x86"
;;
*)
echo "Unknown architecture '$1'"
usage
exit 0
;;
esac

sdk_root=${build_dir}/sdk_root/${arch}
@@ -378,35 +403,62 @@ for arch in $archs; do
RelWithDebInfo) build_type_flag="--release-debuginfo" ;;
esac

# use an out-of-tree build folder, otherwise subsequent arch builds have conflicts
export SWIFT_BUILD_ROOT=${build_dir}/$arch/swift-project
case $build_compiler in
1|true|yes|YES)
build_cmark=""
local_build=""
build_llvm="1"
build_swift_tools="1"
validation_test="1"
native_swift_tools_path=""
native_clang_tools_path=""
;;
*)
build_cmark="--skip-build-cmark"
local_build="--skip-local-build"
build_llvm="0"
build_swift_tools="0"
validation_test="0"
native_swift_tools_path="--native-swift-tools-path=$host_toolchain/bin"
native_clang_tools_path="--native-clang-tools-path=$host_toolchain/bin"
;;
esac

# use an out-of-tree build folder
export SWIFT_BUILD_ROOT=${build_dir}/swift-project

./swift/utils/build-script \
$build_type_flag \
--reconfigure \
--no-assertions \
--validation-test=$validation_test \
--android \
--android-ndk=$ndk_home \
--android-arch=$arch \
--android-api-level=$android_api \
--native-swift-tools-path=$host_toolchain/bin \
--native-clang-tools-path=$host_toolchain/bin \
--cross-compile-hosts=android-$arch \
--cross-compile-deps-path=$sdk_root \
--install-destdir=$sdk_root \
--build-llvm=0 \
--build-swift-tools=0 \
--skip-build-cmark \
--skip-local-build \
--build-llvm=$build_llvm \
--build-swift-tools=$build_swift_tools \
${native_swift_tools_path} \
${native_clang_tools_path} \
${build_cmark} \
${local_build} \
--host-test \
--skip-test-linux \
--skip-test-xctest --skip-test-foundation \
--build-swift-static-stdlib \
--swift-install-components='compiler;clang-resource-dir-symlink;license;stdlib;sdk-overlay' \
--install-swift \
--install-libdispatch \
--install-foundation \
--xctest --install-xctest \
--swift-testing --install-swift-testing \
--cross-compile-append-host-target-to-destdir=False \
--extra-cmake-options='-DCMAKE_EXTRA_LINK_FLAGS="-Wl,-z,max-page-size=16384"'

--cross-compile-build-swift-tools=0 \
--llvm-ninja-targets-for-cross-compile-hosts=help \
--cross-compile-append-host-target-to-destdir=False
# --extra-cmake-options='-DCMAKE_EXTRA_LINK_FLAGS="-Wl,-z,max-page-size=16384"'
# need to remove symlink that gets created in the NDK to the previous arch's build
# or else we get errors like:
# error: could not find module '_Builtin_float' for target 'x86_64-unknown-linux-android'; found: aarch64-unknown-linux-android, at: /home/runner/work/_temp/swift-android-sdk/ndk/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/swift/android/_Builtin_float.swiftmodule
@@ -477,7 +529,9 @@ for arch in $archs; do
arch_triple="arm-linux-androideabi"
fi

rm -r lib/swift{,_static}/clang
# need force rm in case linux is not present (when not running tests)
rm -rf lib/swift{,_static}/{FrameworkABIBaseline,_InternalSwiftScan,_InternalSwiftStaticMirror,clang,embedded,host,linux,migrator}
rm -rf lib/lib*.so
mv lib/swift lib/swift-$arch
ln -s ../swift/clang lib/swift-$arch/clang

@@ -622,7 +676,7 @@ cat > swift-toolset.json <<EOF
{
"cCompiler": { "extraCLIOptions": ["-fPIC"] },
"swiftCompiler": { "extraCLIOptions": ["-Xclang-linker", "-fuse-ld=lld"] },
"linker": { "extraCLIOptions": ["-z,max-page-size=16384"] },
"linker": { "extraCLIOptions": ["-z", "max-page-size=16384"] },
"schemaVersion": "1.0"
}
EOF
21 changes: 12 additions & 9 deletions swift-ci/sdks/android/scripts/fetch-source.sh
Original file line number Diff line number Diff line change
@@ -89,8 +89,8 @@ fi
if [[ -z "${BORINGSSL_VERSION}" ]]; then
BORINGSSL_VERSION=fips-20220613
fi
if [[ -z "${SWIFT_ANDROID_PATCHES_VERSION}" ]]; then
SWIFT_ANDROID_PATCHES_VERSION=main
if [[ -z "${YAMS_VERSION}" ]]; then
YAMS_VERSION=5.0.6
fi

clone_with_ssh=false
@@ -158,6 +158,16 @@ fi
popd >/dev/null
groupend

# Fetch yams (needed for Swift 6.1.x)
groupstart "Fetching yams"
pushd swift-project >/dev/null
[[ -d yams ]] || git clone ${github}jpsim/Yams.git yams
pushd yams >/dev/null 2>&1
git checkout ${YAMS_VERSION}
popd >/dev/null 2>&1
popd >/dev/null
groupend

# Fetch libxml2
groupstart "Fetching libxml2"
[[ -d libxml2 ]] || git clone ${github}GNOME/libxml2.git
@@ -182,10 +192,3 @@ git checkout ${BORINGSSL_VERSION}
popd >/dev/null 2>&1
groupend

# Fetch BoringSSL
groupstart "Fetching Patches"
[[ -d swift-android-patches ]] || git clone https://github.com/swift-android-sdk/swift-android-sdk swift-android-patches
pushd swift-android-patches >/dev/null 2>&1
git checkout ${SWIFT_ANDROID_PATCHES_VERSION}
popd >/dev/null 2>&1
groupend
22 changes: 15 additions & 7 deletions swift-ci/sdks/android/scripts/toolchain-vars.sh
Original file line number Diff line number Diff line change
@@ -13,14 +13,16 @@
# obtain the latest toolchain for building.

OS=$(echo $HOST_OS | tr -d '.')
# e.g., "swift-6.1-RELEASE"
# there is no latest-build.yml for releases, so we need to get it from the API
RELEASE_TAG=$(curl -fsSL https://www.swift.org/api/v1/install/releases.json | jq -r '.[-1].tag')
# e.g., "swift-6.1-release"
RELEASE_BRANCH=$(echo "${RELEASE_TAG}" | tr '[A-Z]' '[a-z]')

case "${BUILD_SCHEME}" in
release)
# e.g., "swift-6.1-RELEASE"
# there is no latest-build.yml for releases, so we need to get it from the API
export SWIFT_TAG=$(curl -fsSL https://www.swift.org/api/v1/install/releases.json | jq -r '.[-1].tag')
# e.g., "swift-6.1-release"
export SWIFT_BRANCH=$(echo "${SWIFT_TAG}" | tr '[A-Z]' '[a-z]')
export SWIFT_TAG=$RELEASE_TAG
export SWIFT_BRANCH=$RELEASE_BRANCH
;;
development|swift-*-branch)
# e.g., swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-15-a
@@ -35,5 +37,11 @@ case "${BUILD_SCHEME}" in
esac

SWIFT_BASE=$SWIFT_TAG-$HOST_OS
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS/$SWIFT_TAG/$SWIFT_BASE.tar.gz"

case $BUILD_COMPILER in
1|true|yes|YES)
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$RELEASE_BRANCH/$OS/$RELEASE_TAG/$RELEASE_TAG-$HOST_OS.tar.gz"
;;
*)
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS/$SWIFT_TAG/$SWIFT_BASE.tar.gz"
;;
esac