From d8ed3073016051ecb83971428f6036485a5d8844 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Wed, 5 Jan 2022 14:59:31 +0700 Subject: [PATCH 1/2] chore(android): Add no-daemon flag to build script --- android/Samples/KMSample2/build.sh | 57 ++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/android/Samples/KMSample2/build.sh b/android/Samples/KMSample2/build.sh index 006994776d..df83506ceb 100755 --- a/android/Samples/KMSample2/build.sh +++ b/android/Samples/KMSample2/build.sh @@ -1,10 +1,61 @@ -#!/bin/sh +#!/bin/bash # Build KMSample2 +set -e +set -u + +display_usage ( ) { + echo "build.sh [-no-daemon] [-debug]" + echo + echo "Build KM Sample 2" + echo " -no-daemon Don't start the Gradle daemon. Use for CI" + echo " -debug Compile only Debug variant" + exit 1 +} + +echo Build KMSample2 + # # Prevents 'clear' on exit of mingw64 bash shell # SHLVL=0 -echo Build KMSample2 -./gradlew clean build +NO_DAEMON=false +ONLY_DEBUG=false + +# Parse args +while [[ $# -gt 0 ]] ; do + key="$1" + case $key in + -no-daemon) + NO_DAEMON=true + ;; + -debug) + ONLY_DEBUG=true + ;; + -h|-\?) + display_usage + ;; + esac + shift # past argument +done + +echo +echo "NO_DAEMON: $NO_DAEMON" +echo "ONLY_DEBUG: $ONLY_DEBUG" +echo + +if [ "$NO_DAEMON" = true ]; then + DAEMON_FLAG=--no-daemon +else + DAEMON_FLAG= +fi + +if [ "$ONLY_DEBUG" = true ]; then + BUILD_FLAG=assembleDebug +else + BUILD_FLAG=build +fi + +./gradlew $DAEMON_FLAG clean $BUILD_FLAG + From d9c02a2f86675e9f7a2d5fe5cee40eb033b9836a Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 6 Jan 2022 07:46:33 +0700 Subject: [PATCH 2/2] Update android/Samples/KMSample2/build.sh Co-authored-by: Marc Durdin --- android/Samples/KMSample2/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/Samples/KMSample2/build.sh b/android/Samples/KMSample2/build.sh index df83506ceb..02b7a56b25 100755 --- a/android/Samples/KMSample2/build.sh +++ b/android/Samples/KMSample2/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Build KMSample2 set -e