Skip to content

Commit

Permalink
Dev: resore version/xctoolchain/upload.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Pogonets committed Oct 7, 2019
1 parent 1aa2046 commit 01d1df3
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 6 deletions.
1 change: 1 addition & 0 deletions build/config/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.0
2 changes: 0 additions & 2 deletions build/macOS/020-build-swiftpm.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash
set -ex

unset TOOLCHAINS

BASE_DIR=`pwd`
SWIFT_SOURCE=$BASE_DIR/vagrant/out/swift-source

Expand Down
10 changes: 6 additions & 4 deletions build/macOS/030-collect-toolchain.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
71 changes: 71 additions & 0 deletions build/upload.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 01d1df3

Please sign in to comment.