diff --git a/tools/README b/tools/README new file mode 100644 index 0000000..8da3320 --- /dev/null +++ b/tools/README @@ -0,0 +1 @@ +This directory holds tools for continuous integration building via jenkins atm. diff --git a/tools/android/packaging/apksign b/tools/android/packaging/apksign new file mode 100755 index 0000000..29d41c3 --- /dev/null +++ b/tools/android/packaging/apksign @@ -0,0 +1,19 @@ +#!/bin/bash +usage(){ + echo "Usage: $0 []" + exit 1 +} + +[[ $# -lt 3 ]] && usage + +WORKSPACE=${WORKSPACE:-$( cd $(dirname $0)/../../.. ; pwd -P )} + +SIGN_STORE=$1 +SIGN_STOREPASS=$2 +SIGN_KEY=$3 +SIGN_KEYPASS=$4 + +echo "Signing..." +jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore $SIGN_STORE -storepass $SIGN_STOREPASS $SIGN_KEYPASS_OPT $WORKSPACE/app/build/outputs/apk/app-release-unsigned.apk $SIGN_KEY +$ZIPALIGN_JENKINS -f 4 $WORKSPACE/app/build/outputs/apk/app-release-unsigned.apk $WORKSPACE/kore-release.apk +echo "$WORKSPACE/kore-release.apk created" diff --git a/tools/buildsteps/build-release b/tools/buildsteps/build-release new file mode 100644 index 0000000..b1cc409 --- /dev/null +++ b/tools/buildsteps/build-release @@ -0,0 +1,4 @@ +WORKSPACE=${WORKSPACE:-$( cd $(dirname $0)/../.. ; pwd -P )} +export ANDROID_HOME=$SDK_PATH_KORE + +cd $WORKSPACE;./gradlew assembleRelease diff --git a/tools/buildsteps/package b/tools/buildsteps/package new file mode 100644 index 0000000..c1a4538 --- /dev/null +++ b/tools/buildsteps/package @@ -0,0 +1,55 @@ +WORKSPACE=${WORKSPACE:-$( cd $(dirname $0)/../.. ; pwd -P )} + +$RUN_SIGNSTEP + +function getBranchName () +{ + local branchName + branchName=`git symbolic-ref HEAD 2>/dev/null || echo detached` + + if [ "$branchName" != "detached" ] # if we are not detached + then + #we are attached - use the branchname then + if echo $branchName | grep pr 2>&1 > /dev/null + then + #if this is a pull request branch - fetch the pr number and prefix with "PR" + #refs/heads/number/head + echo PR$(echo $branchName | awk '{gsub(".*/pr/","");print $1}' | awk '{gsub("/.*","");print $1}') + else + #if we are on a normal branch - fetch branchname + #refs/heads/branchname + echo $branchName | awk '{gsub(".*/","");print $1}' + fi + else + #if we are in detached head state + #fetch the first non-pullrequest branch we can find with HEAD + #also only grep in remotes that match current GITHUB_REPO + git branch -r --contains HEAD | sed "/origin\/pr\//d" | grep $GITHUB_REPO | head -n1 | awk '{gsub(".*/","");print $1}' + fi +} + + +function getBuildRevDateStr () +{ + local revStr + #fetch date-rev + revStr=`git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}' 2>/dev/null` + if [ "$?" == "0" ] + then + #fetch the first branch containing head + revStr=$revStr"-"$(getBranchName) + if [ "$?" == "0" ] + then + echo $revStr + else + echo "Unknown" + fi + else + echo "Unknown" + fi +} + +#rename for upload +#e.x. kore-20130314-8c2fb31.apk. +UPLOAD_FILENAME="kore-$(getBuildRevDateStr).apk" +cd $WORKSPACE;mv *.apk $UPLOAD_FILENAME