Skip to content

Commit 49621b3

Browse files
committed
Update build scripts
1 parent 8623d86 commit 49621b3

File tree

5 files changed

+14
-63
lines changed

5 files changed

+14
-63
lines changed

Demo/build-swift-preview.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

Demo/build-swift.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ set -e
33
source swift-define
44

55
# Build with SwiftPM
6-
export JAVA_HOME=$SWIFT_ANDROID_SYSROOT/usr
7-
xcrun --toolchain swift swift build -c $SWIFT_COMPILATION_MODE \
8-
--swift-sdk $SWIFT_TARGET_NAME \
9-
--toolchain $XCTOOLCHAIN \
10-
--package-path $SWIFT_PACKAGE_SRC
6+
ANDROID_NDK_ROOT="" ANDROID_SDK_VERSION=$ANDROID_SDK_VERSION skip android build --arch $SWIFT_TARGET_ARCH --android-api-level $ANDROID_SDK_VERSION
117

128
# Copy compiled Swift package
139
mkdir -p $SRC_ROOT/app/src/main/jniLibs/$ANDROID_ARCH/

Demo/setup.sh

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,17 @@ source swift-define
55
# Install macOS dependencies
66
if [[ $OSTYPE == 'darwin'* ]]; then
77
echo "Install macOS build dependencies"
8+
brew install skiptools/skip/skip
9+
brew update
810
HOMEBREW_NO_AUTO_UPDATE=1 brew install wget cmake ninja android-ndk
9-
10-
# Verify toolchain installed
11-
if [ ! -d ${XCTOOLCHAIN} ]
12-
then
13-
echo "Please install the swift-6.0.3-RELEASE toolchain (or set XCTOOLCHAIN)"
14-
echo "On Mac: https://download.swift.org/swift-6.0.3-release/xcode/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-osx.pkg"
15-
exit 1
16-
fi
17-
fi
18-
19-
# Check swift-autolink-extract exists
20-
if [[ ! -f "${XCTOOLCHAIN}/usr/bin/swift-autolink-extract" ]];
21-
then
22-
echo "Missing symlink '${XCTOOLCHAIN}/usr/bin/swift-autolink-extract'."
23-
echo "We need 'sudo' permission to create it (just this once)."
24-
sudo ln -s swift ${XCTOOLCHAIN}/usr/bin/swift-autolink-extract || exit 1
2511
fi
2612

2713
# Copy Swift libraries
14+
rm -rf $SRC_ROOT/app/src/main/jniLibs/$ANDROID_ARCH/
2815
mkdir -p $SRC_ROOT/app/src/main/jniLibs/$ANDROID_ARCH/
29-
cp -rf $SWIFT_ANDROID_SYSROOT/usr/lib/$ANDROID_LIB/*.so \
16+
cp -rf $SWIFT_ANDROID_LIBS/*.so \
3017
$SRC_ROOT/app/src/main/jniLibs/$ANDROID_ARCH/
3118
# Copy C stdlib
3219
cp -rf $SWIFT_ANDROID_SYSROOT/usr/lib/$ANDROID_LIB/libc++_shared.so \
3320
$SRC_ROOT/app/src/main/jniLibs/$ANDROID_ARCH/
34-
# Copy Swift dependencies
35-
cp -rf $SWIFT_ANDROID_SYSROOT/usr/lib/$ANDROID_LIB/libandroid-spawn.so \
36-
$SRC_ROOT/app/src/main/jniLibs/$ANDROID_ARCH/
21+
echo "Copied Swift libraries"

Demo/swift-define

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ ANDROID_LIB="${ANDROID_LIB:=aarch64-linux-android}"
66
SWIFT_COMPILATION_MODE="${SWIFT_COMPILATION_MODE:=debug}"
77

88
# Version
9-
ANDROID_NDK_VERSION=24
10-
SWIFT_VERSION_SHORT=6.0.3
9+
ANDROID_SDK_VERSION=29
10+
SWIFT_VERSION_SHORT=6.1.1
1111
SWIFT_VERSION=swift-$SWIFT_VERSION_SHORT-RELEASE
12-
SWIFT_TARGET_NAME=$SWIFT_TARGET_ARCH-unknown-linux-android$ANDROID_NDK_VERSION
12+
SWIFT_TARGET_NAME=$SWIFT_TARGET_ARCH-unknown-linux-android$ANDROID_SDK_VERSION
1313
XCTOOLCHAIN=/Library/Developer/Toolchains/$SWIFT_VERSION.xctoolchain
14+
SWIFT_ARTIFACT_BUNDLE=swift-$SWIFT_VERSION_SHORT-RELEASE-android-0.1.artifactbundle
1415

1516
# Paths
16-
SWIFT_SDK=swift-$SWIFT_VERSION_SHORT-release-android-$ANDROID_NDK_VERSION-sdk
17-
SWIFT_ANDROID_SYSROOT=~/.swiftpm/swift-sdks/swift-$SWIFT_VERSION_SHORT-RELEASE-android-24-0.1.artifactbundle/$SWIFT_SDK/android-27c-sysroot
17+
SWIFT_SDK=swift-$SWIFT_VERSION_SHORT-release-android-$ANDROID_SDK_VERSION-sdk
18+
SWIFT_ANDROID_SYSROOT=~/.swiftpm/swift-sdks/$SWIFT_ARTIFACT_BUNDLE/swift-android/ndk-sysroot
19+
SWIFT_ANDROID_LIBS=~/.swiftpm/swift-sdks/$SWIFT_ARTIFACT_BUNDLE/swift-android/swift-resources/usr/lib/swift-$SWIFT_TARGET_ARCH/android/
1820
SWIFT_PACKAGE_SRC=$SRC_ROOT
21+
JAVA_HOME=$SWIFT_ANDROID_SYSROOT/usr
1922

2023
# Configurable
2124
SWIFT_NATIVE_PATH="${SWIFT_NATIVE_PATH:=$XCTOOLCHAIN/usr/bin}"

swift-define

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)