From a78393b1cb37c69358d2ccfba64154d5967ad3c4 Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Thu, 2 Jan 2020 18:29:19 +0100 Subject: [PATCH] [fix] Fix G1-test default nodes --- app/config.json | 6 +++- scripts/env-android.sh | 14 ++++++++-- scripts/env-global.sh | 5 +++- scripts/install-android-sdk-tools.sh | 42 ++++++++++++++++++++++++++++ scripts/run-android.sh | 4 +-- 5 files changed, 65 insertions(+), 6 deletions(-) create mode 100755 scripts/install-android-sdk-tools.sh diff --git a/app/config.json b/app/config.json index b0b28239..5ffff82c 100644 --- a/app/config.json +++ b/app/config.json @@ -252,7 +252,7 @@ } }, "node": { - "host": "g1-test.duniter.org", + "host": "gtest.jytou.fr", "port": 443 }, "fallbackNodes": [ @@ -263,6 +263,10 @@ { "host": "gtest.jytou.fr", "port": 443 + }, + { + "host": "g1-test.duniter.org", + "port": 443 } ], "plugins":{ diff --git a/scripts/env-android.sh b/scripts/env-android.sh index 2949ceba..b1a4e19a 100755 --- a/scripts/env-android.sh +++ b/scripts/env-android.sh @@ -3,7 +3,7 @@ # Get to the root project if [[ "_" == "_${PROJECT_DIR}" ]]; then SCRIPT_DIR=$(dirname $0) - PROJECT_DIR=$(cd ${SCRIPT_DIR}/.. && pwd) + PROJECT_DIR=$(cd "${SCRIPT_DIR}/.." && pwd) export PROJECT_DIR fi; @@ -25,7 +25,17 @@ echo " - using Gradle: ${CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL}" echo " - using Java: ${JAVA_HOME}" echo " - project dir: ${PROJECT_DIR}" -cd ${PROJECT_DIR} + +# Prepare Android SDK tools +if [[ ! -d "${ANDROID_SDK_TOOLS_ROOT}" ]]; then + cd "${PROJECT_DIR}/scripts" + ./install-android-sdk-tools.sh + if [[ $? -ne 0 ]]; then + exit 1 + fi +fi + +cd "${PROJECT_DIR}" # Prepare Android platform if [[ ! -d "${PROJECT_DIR}/platforms/android" ]]; then diff --git a/scripts/env-global.sh b/scripts/env-global.sh index 854db888..f515ea49 100755 --- a/scripts/env-global.sh +++ b/scripts/env-global.sh @@ -26,7 +26,7 @@ ANDROID_NDK_VERSION=r19c ANDROID_SDK_VERSION=r29.0.0 ANDROID_SDK_TOOLS_VERSION=4333796 ANDROID_SDK_ROOT=/usr/lib/android-sdk -ANDROID_SDK_TOOLS_ROOT=${ANDROID_SDK_ROOT}/build-tools +ANDROID_SDK_TOOLS_ROOT=${ANDROID_SDK_ROOT}/tools ANDROID_OUTPUT_APK=${PROJECT_DIR}/platforms/android/build/outputs/apk ANDROID_OUTPUT_APK_DEBUG=${ANDROID_OUTPUT_APK}/debug ANDROID_OUTPUT_APK_RELEASE=${ANDROID_OUTPUT_APK}/release @@ -39,6 +39,9 @@ DIST_ANDROID=${PROJECT_DIR}/dist/android GRADLE_VERSION=4.10.3 CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=https\://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip +# Export Android SDK tools to path +export PATH=${ANDROID_SDK_TOOLS_ROOT}/bin:$PATH + # Override with a local file, if any if [[ -f "${PROJECT_DIR}/.local/env.sh" ]]; then echo "Loading environment variables from: '.local/env.sh'" diff --git a/scripts/install-android-sdk-tools.sh b/scripts/install-android-sdk-tools.sh new file mode 100755 index 00000000..5ddce274 --- /dev/null +++ b/scripts/install-android-sdk-tools.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +. ./env-global.sh + +test -e "${ANDROID_SDK_ROOT}" || mkdir -p "${ANDROID_SDK_ROOT}" + +if [[ ! -d "${ANDROID_SDK_TOOLS_ROOT}/bin" ]]; then + echo "Installing Android SDK tools..." + test -e "sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip" || wget -kL https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip + test -e "${ANDROID_SDK_TOOLS_ROOT}" || unzip -qq sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip -d "${ANDROID_SDK_TOOLS}" + test -e "${ANDROID_SDK_TOOLS_ROOT}" && rm "sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip" +fi + +mkdir -p ${ANDROID_SDK_ROOT}/licenses +echo 8933bad161af4178b1185d1a37fbf41ea5269c55 > ${ANDROID_SDK_ROOT}/licenses/android-sdk-license +echo 601085b94cd77f0b54ff86406957099ebe79c4d6 > ${ANDROID_SDK_ROOT}/licenses/android-googletv-license +echo 33b6a2b64607f11b759f320ef9dff4ae5c47d97a > ${ANDROID_SDK_ROOT}/licenses/google-gdk-license +yes | sdkmanager --licenses + +mkdir -p ~/.android +touch ~/.android/repositories.cfg + +echo y | sdkmanager "platform-tools" --sdk_root=${ANDROID_SDK_ROOT} | tee sdkmanager.log + +echo y | sdkmanager "extras;android;m2repository" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "extras;google;m2repository" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log + +echo y | sdkmanager "build-tools;23.0.2" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "build-tools;23.0.3" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "build-tools;25.0.2" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "build-tools;27.0.3" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "build-tools;28.0.3" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "build-tools;29.0.2" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log + +echo y | sdkmanager "platforms;android-16" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "platforms;android-21" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "platforms;android-23" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "platforms;android-24" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "platforms;android-25" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "platforms;android-27" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "platforms;android-28" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log +echo y | sdkmanager "platforms;android-29" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log diff --git a/scripts/run-android.sh b/scripts/run-android.sh index f645cd8c..f6ccd375 100755 --- a/scripts/run-android.sh +++ b/scripts/run-android.sh @@ -17,7 +17,7 @@ cd ${PROJECT_DIR} # Run the build echo "Building Android application..." -ionic cordova build android --warning-mode=none --color --device +ionic cordova build android --warning-mode=none --color echo "Running Android application..." -native-run android --app ${PROJECT_DIR}/platforms/android/build/outputs/apk/debug/android-debug.apk --device +native-run android --app ${PROJECT_DIR}/platforms/android/build/outputs/apk/debug/android-debug.apk $* -- GitLab