diff --git a/build/config/version b/build/config/version new file mode 100644 index 00000000..819e07a2 --- /dev/null +++ b/build/config/version @@ -0,0 +1 @@ +5.0 diff --git a/build/macOS/020-build-swiftpm.sh b/build/macOS/020-build-swiftpm.sh index 4eda79ee..4a4a69b6 100755 --- a/build/macOS/020-build-swiftpm.sh +++ b/build/macOS/020-build-swiftpm.sh @@ -1,8 +1,6 @@ #!/bin/bash set -ex -unset TOOLCHAINS - BASE_DIR=`pwd` SWIFT_SOURCE=$BASE_DIR/vagrant/out/swift-source diff --git a/build/macOS/030-collect-toolchain.sh b/build/macOS/030-collect-toolchain.sh index a5b7fe9f..4da5b6bc 100755 --- a/build/macOS/030-collect-toolchain.sh +++ b/build/macOS/030-collect-toolchain.sh @@ -1,10 +1,10 @@ #!/bin/bash set -ex -unset TOOLCHAINS xcode_toolchain=$(dirname $(dirname $(dirname $(xcrun --find swift)))) -name=swift-android-5.0 +toolchain_version=`cat build/config/version` +name=swift-android-$toolchain_version out=out/$name out_toolchain=$out/toolchain @@ -48,10 +48,10 @@ pushd $linux_out --include swiftc \ --exclude '*' + ## Bundle SwiftPM cp swift-source/swiftpm/.build/release/swift-build $out_bin - cp -r $xcode_toolchain/usr/lib/swift/pm $out_toolchain/usr/lib/swift - cp -r $xcode_toolchain/usr/lib/swift/macosx $out_toolchain/usr/lib/swift + ## Bundle NDK headers and patch glibc mkdir -p $out_toolchain/ndk-android-21/usr rsync -av $ANDROID_NDK_HOME/sysroot/usr/include $out_toolchain/ndk-android-21/usr @@ -70,6 +70,8 @@ popd rsync -av shims/`uname`/ $out_toolchain rsync -av src/tools/ $out +echo $toolchain_version > $out/VERSION + pushd $(dirname $out) zip -y -r $name.zip $name popd diff --git a/build/upload.sh b/build/upload.sh new file mode 100755 index 00000000..85a9507d --- /dev/null +++ b/build/upload.sh @@ -0,0 +1,71 @@ +#!/bin/bash +set -e + +BINTRAY_USER=${BINTRAY_USER:?BINTRAY_USER env variable should be set} +BINTRAY_API_KEY=${BINTRAY_API_KEY:?BINTRAY_API_KEY env variable should be set} + +ORG=readdle +REPO=swift-android-toolchain +PACKAGE=swift-android-toolchain + +function main { + local version=`cat build/config/version` + + create_version $version + upload_file $version +} + +function create_version { + local version=$1 + + local data="{ + \"name\": \"$version\" + }" + + curl \ + -u$BINTRAY_USER:$BINTRAY_API_KEY \ + -X POST -d "$data" \ + -H "Content-Type: application/json" \ + https://api.bintray.com/packages/$ORG/$REPO/$PACKAGE/versions + + echo +} + +function upload_file { + local version=$1 + + local name="swift-android-${version}" + local filename="${name}.zip" + + curl \ + -u$BINTRAY_USER:$BINTRAY_API_KEY \ + -T out/$filename \ + -H "X-Bintray-Package: $PACKAGE" \ + -H "X-Bintray-Version: $version" \ + -H "X-Bintray-Publish: 1" \ + -H "X-Bintray-Override: 1" \ + https://api.bintray.com/content/$ORG/$REPO/$filename > /dev/null + + show_in_download_list $filename +} + +function show_in_download_list { + local filename=$1 + + local data='{ + "list_in_downloads": true + }' + + curl \ + -u$BINTRAY_USER:$BINTRAY_API_KEY \ + -X PUT -d "$data" \ + -H "Content-Type: application/json" \ + https://api.bintray.com/file_metadata/$ORG/$REPO/$filename > /dev/null +} + +SELF_DIR=$(dirname $0) +BASE_DIR=$SELF_DIR/../ + +pushd $BASE_DIR + main +popd \ No newline at end of file