From d5eb3a7b4c0eb0028da69c390ba7188cd6de883b Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Sat, 28 Dec 2019 13:18:00 +0100 Subject: [PATCH] [fix] Android: revert to minSdkVersion=19 --- config.xml | 2 +- .../060_prepare_android_manifest.js | 2 +- scripts/env-global.sh | 17 +++++++++ scripts/github.sh | 7 ---- scripts/release.sh | 37 ++++++++++--------- 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/config.xml b/config.xml index 818de378..11e63f19 100644 --- a/config.xml +++ b/config.xml @@ -28,7 +28,7 @@ <preference name="KeyboardResizeMode" value="ionic" /> <preference name="xwalkVersion" value="19" /> <preference name="xwalkMultipleApk" value="false" /> - <preference name="android-minSdkVersion" value="20" /> + <preference name="android-minSdkVersion" value="19" /> <preference name="android-targetSdkVersion" value="28" /> <preference name="StatusBarOverlaysWebView" value="false" /> <preference name="StatusBarBackgroundColor" value="#000" /> diff --git a/hooks/after_prepare/060_prepare_android_manifest.js b/hooks/after_prepare/060_prepare_android_manifest.js index e2fb2634..b2c3b7bd 100755 --- a/hooks/after_prepare/060_prepare_android_manifest.js +++ b/hooks/after_prepare/060_prepare_android_manifest.js @@ -31,7 +31,7 @@ if (rootdir) { .pipe(replace(/<uses-sdk [^>]+\/>/g, '')) // add <uses-sdk> (replace 'targetSdkversion' and add tools:overrideLibrary) - .pipe(replace(/(<\/manifest>)/, ' <uses-sdk android:minSdkVersion="20" android:targetSdkVersion="28" tools:overrideLibrary="org.kaliumjni.lib" />\n$1')) + .pipe(replace(/(<\/manifest>)/, ' <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" tools:overrideLibrary="org.kaliumjni.lib" />\n$1')) .pipe(gulp.dest(platformPath)); diff --git a/scripts/env-global.sh b/scripts/env-global.sh index 29cb4942..854db888 100755 --- a/scripts/env-global.sh +++ b/scripts/env-global.sh @@ -14,6 +14,12 @@ if [[ ! -f "${PROJECT_DIR}/package.json" ]]; then fi; echo "Preparing project environment.." + +PROJECT_NAME="cesium" +REPO="duniter/cesium" +REPO_API_URL="https://api.github.com/repos/${REPO}" +REPO_PUBLIC_URL="https://github.com/${REPO}" + NODEJS_VERSION=10 ANDROID_NDK_VERSION=r19c @@ -130,3 +136,14 @@ if [[ ! -d "${PROJECT_DIR}/node_modules" ]]; then cd ${PROJECT_DIR} yarn fi + +# Install project submodules +if [[ ! -d "${PROJECT_DIR}/platforms/android" || ! -d "${PROJECT_DIR}/dist/desktop" ]]; then + echo "Installing project submodules..." + cd ${PROJECT_DIR} + git submodule init && git submodule sync && git submodule update --remote --merge + if [[ $? -ne 0 ]]; then + echo "Unable to sync git submodule. Will not be able to build android and desktop artifacts!" + exit 1 + fi +fi diff --git a/scripts/github.sh b/scripts/github.sh index d2327a26..254df596 100755 --- a/scripts/github.sh +++ b/scripts/github.sh @@ -27,13 +27,6 @@ if [[ "_$current" == "_" ]]; then fi echo "Current version: $current" -### Get repo URL -PROJECT_NAME=cesium -REPO="duniter/cesium" -REPO_API_URL="https://api.github.com/repos/${REPO}" -REPO_PUBLIC_URL="https://github.com/${REPO}" - - ### get auth token GITHUB_TOKEN=$(cat ~/.config/${PROJECT_NAME}/.github) if [[ "_$GITHUB_TOKEN" != "_" ]]; then diff --git a/scripts/release.sh b/scripts/release.sh index 6981ad45..cbc7cab9 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -77,41 +77,41 @@ if [[ $? -ne 0 ]]; then exit 1 fi -cd ${PROJECT_DIR} -git submodule init && git submodule sync && git submodule update --remote --merge -if [[ $? -ne 0 ]]; then - echo "Unable to sync git submodule. Could not build desktop version" - exit 1 -fi - echo "----------------------------------" echo "- Compiling sources..." echo "----------------------------------" -gulp config build --env default_fr - +cd ${PROJECT_DIR} || exit 1 +gulp config build --env default_fr || exit 1 echo "----------------------------------" echo "- Building Android artifact..." echo "----------------------------------" +mkdir -p ${DIST_ANDROID} || exit 1 +rm -rf ${DIST_ANDROID}/*.apk || exit 1 . scripts/build-android.sh --release if [[ $? -ne 0 ]]; then exit 1 fi APK_RELEASE_FILE="${ANDROID_OUTPUT_APK_RELEASE}/android-release.apk" if [[ -f "${APK_RELEASE_FILE}" ]]; then - mkdir -p ${DIST_ANDROID} - cp ${APK_RELEASE_FILE} ${DIST_ANDROID}/${PROJECT_NAME}-v${current}-android.apk + mkdir -p ${DIST_ANDROID} || exit 1 + cp ${APK_RELEASE_FILE} ${DIST_ANDROID}/${PROJECT_NAME}-v$2-android.apk || exit 1 fi; - echo "----------------------------------" echo "- Building web artifact..." echo "----------------------------------" -gulp config webBuild --env default --release +cd ${PROJECT_DIR} || exit 1 +gulp config --env default +gulp webBuild --release if [[ $? -ne 0 ]]; then exit 1 fi - +DIST_WEB_FILE="${DIST_WEB}/${PROJECT_NAME}-v$2-web.zip" +if [[ ! -f "${DIST_WEB_FILE}" ]]; then + echo "ERROR: Missing web artifact at ${DIST_WEB_FILE}" + exit 1 +fi; echo "----------------------------------" echo "- Executing git push, with tag: v$2" @@ -122,7 +122,7 @@ if [[ "_$description" == "_" ]]; then fi # Commit -cd ${PROJECT_DIR} +cd ${PROJECT_DIR} || exit 1 git reset HEAD git add package.json config.xml install.sh www/js/config.js www/manifest.json if [[ $? -ne 0 ]]; then @@ -131,6 +131,7 @@ fi git commit -m "v$2" git tag -f -a "v$2" -m "${description}" git push origin "v$2" +git push if [[ $? -ne 0 ]]; then exit 1 fi @@ -142,6 +143,7 @@ git add -A git commit -m "v$2" git tag -f -a "v$2" -m "${description}" git push origin "v$2" +git push if [[ $? -ne 0 ]]; then exit 1 fi @@ -153,8 +155,7 @@ echo "**********************************" echo " Waiting 40s, for propagation to github..." sleep 40s - -./github.sh $1 ''"$description"'' +. ${PROJECT_DIR}/scripts/github.sh $1 ''"$description"'' if [[ $? -ne 0 ]]; then exit 1 fi @@ -180,7 +181,7 @@ else exit 1 fi; -# back to nodejs version 6 +# Back to nodejs cd ${PROJECT_DIR} nvm use ${NODEJS_VERSION} -- GitLab