Added build scripts

This commit is contained in:
Julien Eluard 2017-12-12 09:00:46 +01:00 committed by Julien Eluard
parent 8fb2c13e2d
commit 518f68f08f
6 changed files with 68 additions and 13 deletions

View File

@ -1,11 +0,0 @@
#!/usr/bin/env sh
set -eof pipefail
BRANCH=$1
if [[ $# -eq 0 ]] ; then
echo 'Branch required as first argument'
exit 0
fi

36
scripts/build-android.sh Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euf
TARGET=${1:-debug}
CURRENT_DIR="$( cd "$( dirname "$0" )" && pwd )"
. "$CURRENT_DIR/lib/setup/path-support.sh"
source_lib "output.sh"
source_lib "properties.sh"
cecho "Building @b@green[[${TARGET}]] environment"
echo
GRADLE_PROPERTIES="--daemon --parallel -q -b android/build.gradle"
case $TARGET in
debug)
echo "Not supported yet."
## lein do clean, cljsbuild once android && ./android/gradlew ${GRADLE_PROPERTIES} assembleDebug
## echo "Generated android/app/build/outputs/apk/app-debug.apk"
## TODO Blocked by https://github.com/status-im/status-react/issues/2669
exit 1
;;
prod)
STORE_FILE=$(property_gradle 'STATUS_RELEASE_STORE_FILE')
[[ ! -e "${STORE_FILE/#\~/$HOME}" ]] && echo "Please generate keystore first using ./generate-kesytore.sh" && exit 0
lein do clean, with-profile prod cljsbuild once android && ./android/gradlew ${GRADLE_PROPERTIES} assembleRelease
cecho "Generated @b@blueandroid/app/build/outputs/apk/app-release.apk"
echo
exit
;;
*)
echo "Only debug and prod targets are supported"
exit 1
esac

View File

@ -1,6 +1,6 @@
#!/usr/bin/env sh
set -eou pipefail
set -euf pipefail
# TODO Clean up with require STATUS_GO_HOME and STATUS_REACT_HOME

21
scripts/generate-keystore.sh Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euf pipefail
TARGET=${1:-debug}
CURRENT_DIR="$( cd "$( dirname "$0" )" && pwd )"
. "$CURRENT_DIR/lib/setup/path-support.sh"
source_lib "properties.sh"
STORE_FILE=$(property_gradle 'STATUS_RELEASE_STORE_FILE')
STORE_FILE="${STORE_FILE/#\~/$HOME}"
STATUS_RELEASE_STORE_PASSWORD=$(property_gradle 'STATUS_RELEASE_STORE_PASSWORD')
STATUS_RELEASE_KEY_ALIAS=$(property_gradle 'STATUS_RELEASE_KEY_ALIAS')
STATUS_RELEASE_KEY_PASSWORD=$(property_gradle 'STATUS_RELEASE_KEY_PASSWORD')
[[ -e "${STORE_FILE/#\~/$HOME}" ]] && echo "Keystore $STORE_FILE already exists, please manually remove it if you want to regenerate." && exit 0
echo "Generating keystore $STORE_FILE"
keytool -genkey -v -keystore ${STORE_FILE} -keyalg RSA -keysize 2048 -validity 10000 -alias ${STATUS_RELEASE_KEY_ALIAS} \
-storepass ${STATUS_RELEASE_STORE_PASSWORD} -keypass ${STATUS_RELEASE_KEY_PASSWORD} -dname "CN=, OU=, O=, L=, S=, C="

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
function property() {
grep "${2}" ${1}|cut -d'=' -f2
}
function property_gradle() {
property $(repo_path)/android/gradle.properties ${1}
}

View File

@ -1,6 +1,6 @@
#!/usr/bin/env sh
set -eof pipefail
set -euf pipefail
BRANCH=$1
if [[ $# -eq 0 ]] ; then