Skip to content

Commit 2a9eaf7

Browse files
committed
Android SDK build
1 parent 0ea2a35 commit 2a9eaf7

File tree

3 files changed

+30
-7793
lines changed

3 files changed

+30
-7793
lines changed

.github/workflows/pull_request.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,27 @@ jobs:
8080
cd DemoProject
8181
${{ steps.paths.outputs.swift-path }} --version
8282
${{ steps.paths.outputs.swift-path }} package init
83-
${{ steps.paths.outputs.swift-path }} build --build-tests --swift-sdk x86_64-swift-android
83+
echo 'import Foundation' >> Sources/DemoProject/DemoProject.swift
84+
echo 'import FoundationEssentials' >> Sources/DemoProject/DemoProject.swift
85+
echo 'import FoundationXML' >> Sources/DemoProject/DemoProject.swift
86+
echo 'import FoundationNetworking' >> Sources/DemoProject/DemoProject.swift
87+
echo 'import Concurrency' >> Sources/DemoProject/DemoProject.swift
88+
echo 'import Dispatch' >> Sources/DemoProject/DemoProject.swift
89+
echo 'import Android' >> Sources/DemoProject/DemoProject.swift
90+
#${{ steps.paths.outputs.swift-path }} build --build-tests --swift-sdk x86_64-unknown-linux-android
91+
${{ steps.paths.outputs.swift-path }} build --swift-sdk x86_64-unknown-linux-android
92+
- name: Build swift-algorithms
93+
run: |
94+
cd ${{ runner.temp }}
95+
git clone https://github.com/apple/swift-algorithms.git
96+
cd swift-algorithms
97+
${{ steps.paths.outputs.swift-path }} build --build-tests --swift-sdk x86_64-unknown-linux-android
8498
- name: Test Swift Package on Android
8599
# TODO: need to implement installed-sdk option in swift-android-action
86100
if: false
87101
uses: skiptools/swift-android-action@main
88102
with:
89103
package-path: ${{ runner.temp }}/DemoProject
90-
installed-sdk: x86_64-swift-android
104+
installed-sdk: x86_64-unknown-linux-android
91105
installed-swift: ${{ steps.paths.outputs.swift-path }}
92106

swift-ci/sdks/android/scripts/build.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,6 @@ for arch in $archs; do
359359
# use an out-of-tree build folder, otherwise subsequent arch builds have conflicts
360360
export SWIFT_BUILD_ROOT=${build_dir}/$arch/swift-project
361361

362-
# need to remove symlink that gets created in the NDK to the previous arch's build
363-
# or else we get errors like:
364-
# 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
365-
rm -f $ndk_toolchain/sysroot/usr/lib/swift
366-
367362
./swift/utils/build-script \
368363
$build_type_flag \
369364
--reconfigure \
@@ -391,6 +386,12 @@ for arch in $archs; do
391386

392387
#--clean-install-destdir \
393388
#--clean \
389+
390+
391+
# need to remove symlink that gets created in the NDK to the previous arch's build
392+
# or else we get errors like:
393+
# 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
394+
rm -f $ndk_toolchain/sysroot/usr/lib/swift
394395
quiet_popd
395396
groupend
396397
done
@@ -400,7 +401,8 @@ groupstart "Bundling SDK"
400401

401402
sdk_name=swift-${swift_version}-android-${android_api}-${android_sdk_version}
402403
#sdk_base=android-27c-sysroot
403-
sdk_base=swift-android
404+
#sdk_base=swift-unknown-android
405+
sdk_base=unknown-linux-android
404406
#sdk_root="${sdk_base}-${android_sdk_version}.sdk"
405407
sdk_root="${sdk_base}.sdk"
406408

@@ -432,6 +434,8 @@ EOF
432434

433435
cd "$sdk_name/$sdk_base"
434436

437+
cp -a ${ndk_toolchain}/sysroot sysroot
438+
435439
cat > swift-sdk.json <<EOF
436440
{
437441
"schemaVersion": "4.0",
@@ -449,12 +453,11 @@ EOF
449453
fi
450454
cat >> swift-sdk.json <<EOF
451455
"${arch}-${sdk_base}": {
452-
"toolsetPaths": [
453-
"swift-toolset.json"
454-
],
455-
"sdkRootPath": "${sdk_root}/${arch}",
456+
"sdkRootPath": "sysroot",
457+
"sdkRootPathXXX": "${sdk_root}/${arch}",
456458
"swiftResourcesPath": "${sdk_root}/${arch}/usr/lib/swift",
457-
"swiftStaticResourcesPath": "${sdk_root}/${arch}/usr/lib/swift_static"
459+
"swiftStaticResourcesPath": "${sdk_root}/${arch}/usr/lib/swift_static",
460+
"toolsetPaths": [ "swift-toolset.json" ]
458461
EOF
459462
done
460463

0 commit comments

Comments
 (0)