From 05f4002a2a3a2f93e1e8542f33d2cde94a448560 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 19 Jun 2015 12:13:55 +0100 Subject: [PATCH 1/3] Build script for Debian Add a script which builds the project on Debian and produces an apk. This makes creating test builds a little easier --- tools/debian_build.sh | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 tools/debian_build.sh diff --git a/tools/debian_build.sh b/tools/debian_build.sh new file mode 100755 index 000000000..51b8d4457 --- /dev/null +++ b/tools/debian_build.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# This script is intended to be used on Debian systems for building +# the project. It has been tested with Debian 8 + +USERNAME=$USER +SIGNING_NAME='k-9' + +cd .. + +PROJECT_HOME=$(pwd) + +sudo apt-get install build-essential default-jdk android-tools-adb \ + lib32stdc++6 lib32z1 lib32z1-dev gradle + +if [ ! -d ~/Android ]; then + echo -n 'Download android studio from http://developer.android.com/sdk/' + echo -n 'index.html and extract it to the the home folder, install, open' + echo -n 'the Sdk Manager and install Android 17 and Sdk tools for 19.1, ' + echo 'then press any key...' + read -n 1 -s + cd ~/Android/Sdk/tools + echo '' + echo '' + echo -n 'You need to have pretty much everything installed. ' + echo 'It will take some time.' + ./android sdk + cd $PROJECT_HOME +fi + +echo "sdk.dir=/home/$USERNAME/Android/Sdk" > local.properties + +# install Gradle (if is not installed yet) and then execute Gradle +./gradlew build + +#cd ~/develop/$PROJECT_NAME/build/outputs/apk +#keytool -genkey -v -keystore example.keystore -alias \ +# "$SIGNING_NAME" -keyalg RSA -keysize 4096 +#jarsigner -verbose -keystore example.keystore \ +# k9mail-release-unsigned.apk "$SIGNING_NAME" + +# cleaning up +cd $PROJECT_HOME/k9mail/build/outputs/apk +if [ ! -f k9mail-release-unsigned.apk ]; then + echo 'k9mail-release-unsigned.apk was not found' + exit 648 +fi +echo 'Build script ended successfully' +echo -n 'apk is available at: ' +echo "$PROJECT_HOME/k9mail/build/outputs/apk/k9mail-release-unsigned.apk" +exit 0 From d16d95d8401ecda49f91e1e978cf77bd52aedfa1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 21 Jun 2015 18:21:48 +0100 Subject: [PATCH 2/3] Use standalone sdk This makes the build script a bit more independent from Debian specifically --- tools/debian_build.sh | 61 +++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/tools/debian_build.sh b/tools/debian_build.sh index 51b8d4457..1dd565785 100755 --- a/tools/debian_build.sh +++ b/tools/debian_build.sh @@ -5,33 +5,50 @@ USERNAME=$USER SIGNING_NAME='k-9' +SDK_VERSION='r24.3.3' +SDK_DIR=$HOME/android-sdk cd .. PROJECT_HOME=$(pwd) -sudo apt-get install build-essential default-jdk android-tools-adb \ - lib32stdc++6 lib32z1 lib32z1-dev gradle +sudo apt-get install build-essential default-jdk \ + lib32stdc++6 lib32z1 lib32z1-dev -if [ ! -d ~/Android ]; then - echo -n 'Download android studio from http://developer.android.com/sdk/' - echo -n 'index.html and extract it to the the home folder, install, open' - echo -n 'the Sdk Manager and install Android 17 and Sdk tools for 19.1, ' - echo 'then press any key...' - read -n 1 -s - cd ~/Android/Sdk/tools - echo '' - echo '' - echo -n 'You need to have pretty much everything installed. ' - echo 'It will take some time.' - ./android sdk - cd $PROJECT_HOME +if [ ! -d $SDK_DIR ]; then + mkdir -p $SDK_DIR fi +cd $SDK_DIR -echo "sdk.dir=/home/$USERNAME/Android/Sdk" > local.properties +# download the SDK +if [ ! -f $SDK_DIR/android-sdk_$SDK_VERSION-linux.tgz ]; then + wget http://dl.google.com/android/android-sdk_$SDK_VERSION-linux.tgz + tar -xzvf android-sdk_$SDK_VERSION-linux.tgz +fi +SDK_DIR=$SDK_DIR/android-sdk-linux -# install Gradle (if is not installed yet) and then execute Gradle -./gradlew build +echo 'Check that you have the SDK tools installed for Android 17, SDK 19.1' +if [ ! -f $SDK_DIR/tools/android ]; then + echo "$SDK_DIR/tools/android not found" + exit -1 +fi +cd $SDK_DIR +chmod -R 0755 $SDK_DIR +chmod a+rx $SDK_DIR/tools + +ANDROID_HOME=$SDK_DIR +echo "sdk.dir=$SDK_DIR" > $ANDROID_HOME/local.properties +PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools + +android sdk +cd $PROJECT_HOME + + +if [ ! -f $SDK_DIR/tools/templates/gradle/wrapper/gradlew ]; then + echo "$SDK_DIR/tools/templates/gradle/wrapper/gradlew not found" + exit -2 +fi +. $SDK_DIR/tools/templates/gradle/wrapper/gradlew build #cd ~/develop/$PROJECT_NAME/build/outputs/apk #keytool -genkey -v -keystore example.keystore -alias \ @@ -41,11 +58,11 @@ echo "sdk.dir=/home/$USERNAME/Android/Sdk" > local.properties # cleaning up cd $PROJECT_HOME/k9mail/build/outputs/apk -if [ ! -f k9mail-release-unsigned.apk ]; then - echo 'k9mail-release-unsigned.apk was not found' - exit 648 +if [ ! -f k9mail-debug.apk ]; then + echo 'k9mail-debug.apk was not found' + exit -3 fi echo 'Build script ended successfully' echo -n 'apk is available at: ' -echo "$PROJECT_HOME/k9mail/build/outputs/apk/k9mail-release-unsigned.apk" +echo "$PROJECT_HOME/k9mail/build/outputs/apk/k9mail-debug.apk" exit 0 From 17a2309bb99843cbf08f95780061a06acf11b379 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 24 Jun 2015 09:08:40 +0100 Subject: [PATCH 3/3] Use https to download SDK --- tools/debian_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/debian_build.sh b/tools/debian_build.sh index 1dd565785..65dbd0dbc 100755 --- a/tools/debian_build.sh +++ b/tools/debian_build.sh @@ -22,7 +22,7 @@ cd $SDK_DIR # download the SDK if [ ! -f $SDK_DIR/android-sdk_$SDK_VERSION-linux.tgz ]; then - wget http://dl.google.com/android/android-sdk_$SDK_VERSION-linux.tgz + wget https://dl.google.com/android/android-sdk_$SDK_VERSION-linux.tgz tar -xzvf android-sdk_$SDK_VERSION-linux.tgz fi SDK_DIR=$SDK_DIR/android-sdk-linux