Skip to content
Snippets Groups Projects
Commit d0fc823b authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Fix gulp file

parent a64e6d1c
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,6 @@ const gulp = require('gulp'), ...@@ -21,7 +21,6 @@ const gulp = require('gulp'),
useref = require('gulp-useref'), useref = require('gulp-useref'),
filter = require('gulp-filter'), filter = require('gulp-filter'),
uglify = require('gulp-uglify'), uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
csso = require('gulp-csso'), csso = require('gulp-csso'),
replace = require('gulp-replace'), replace = require('gulp-replace'),
rev = require('gulp-rev'), rev = require('gulp-rev'),
...@@ -637,9 +636,9 @@ gulp.task('build', [ ...@@ -637,9 +636,9 @@ gulp.task('build', [
'plugin' 'plugin'
]); ]);
gulp.task('ionic:serve:before', ['build', 'watch']); gulp.task('ionic:serve:before', ['build', 'watch'], done => done());
gulp.task('sass', ['config', 'build']); gulp.task('sass', ['license', 'appSass', 'pluginSass'], done => done());
gulp.task('default', ['config', 'build']); gulp.task('default', ['config', 'build'], done => done());
gulp.task('webClean', [], webClean); gulp.task('webClean', [], webClean);
gulp.task('webCopyFiles', ['config', 'sass', 'webClean'], webCopyFiles); gulp.task('webCopyFiles', ['config', 'sass', 'webClean'], webCopyFiles);
......
#!/bin/bash
DIRNAME=$(dirname "$0")
cd $DIRNAME
### Control that the script is run on `dev` branch
branch=`git rev-parse --abbrev-ref HEAD`
if [[ ! "$branch" = "master" ]];
then
echo ">> This script must be run under \`master\` branch"
exit 1
fi
### Get current version (package.json)
current=`grep -oP "version\": \"\d+.\d+.\d+((a|b)[0-9]+)?" package.json | grep -m 1 -oP "\d+.\d+.\d+((a|b)[0-9]+)?"`
if [[ "_$current" == "_" ]]; then
echo "Unable to read the current version in 'package.json'. Please check version format is: x.y.z (x and y should be an integer)."
exit 1;
fi
echo "Current version: $current"
### Get current version for Android
currentAndroid=`grep -oP "android-versionCode=\"[0-9]+\"" config.xml | grep -oP "\d+"`
if [[ "_$currentAndroid" == "_" ]]; then
echo "Unable to read the current Android version in 'config.xml'. Please check version format is an integer."
exit 1;
fi
echo "Current Android version: $currentAndroid"
# Check version format
if [[ ! $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ || ! $3 =~ ^[0-9]+$ ]]; then
echo "Wrong version format"
echo "Usage:"
echo " > ./release.sh [pre|rel] <version> <android-version> <release_description>"
echo "with:"
echo " - pre: use for pre-release"
echo " - rel: for full release"
echo " - version: x.y.z"
echo " - android-version: nnn"
echo " - release_description: a comment on release"
exit 1
fi
echo "new build version: $2"
echo "new build android version: $3"
case "$1" in
rel|pre)
# Change the version in files: 'package.json' and 'config.xml'
sed -i "s/version\": \"$current\"/version\": \"$2\"/g" package.json
currentConfigXmlVersion=`grep -oP "version=\"\d+.\d+.\d+((a|b)[0-9]+)?\"" config.xml | grep -oP "\d+.\d+.\d+((a|b)[0-9]+)?"`
sed -i "s/ version=\"$currentConfigXmlVersion\"/ version=\"$2\"/g" config.xml
sed -i "s/ android-versionCode=\"$currentAndroid\"/ android-versionCode=\"$3\"/g" config.xml
# Change version in file: 'www/manifest.json'
currentManifestJsonVersion=`grep -oP "version\": \"\d+.\d+.\d+((a|b)[0-9]+)?\"" www/manifest.json | grep -oP "\d+.\d+.\d+((a|b)[0-9]+)?"`
sed -i "s/version\": \"$currentManifestJsonVersion\"/version\": \"$2\"/g" www/manifest.json
# Bump the install.sh
sed -i "s/echo \"v.*\" #lastest/echo \"v$2\" #lastest/g" install.sh
;;
*)
echo "No task given"
exit 1
;;
esac
# Load env.sh if exists
if [[ -f "${DIRNAME}/.local/env.sh" ]]; then
echo "Loading .local/env.sh ..."
source "${DIRNAME}/.local/env.sh" $*
fi
# Check the Java version
JAVA_VERSION=`java -version 2>&1 | egrep "(java|openjdk) version" | awk '{print $3}' | tr -d \"`
if [[ $? -ne 0 ]]; then
echo "No Java JRE 1.8 found in machine. This is required for Android artifacts."
exit 1
fi
JAVA_MAJOR_VERSION=`echo ${JAVA_VERSION} | awk '{split($0, array, ".")} END{print array[1]}'`
JAVA_MINOR_VERSION=`echo ${JAVA_VERSION} | awk '{split($0, array, ".")} END{print array[2]}'`
if [[ ${JAVA_MAJOR_VERSION} -ne 1 ]] || [[ ${JAVA_MINOR_VERSION} -ne 8 ]]; then
echo "Require a Java JRE in version 1.8, but found ${JAVA_VERSION}. You can override your default JAVA_HOME in '.local/env.sh'."
exit 1
fi
echo "Java: $JAVA_VERSION"
# force nodejs version to 6
if [[ -d "$NVM_DIR" ]]; then
. $NVM_DIR/nvm.sh
nvm use 6
if [[ $? -ne 0 ]]; then
exit 1
fi
else
echo "nvm (Node version manager) not found (directory $NVM_DIR not found). Please install, and retry"
exit 1
fi
# Update config file
gulp config --env default_fr
echo "----------------------------------"
echo "- Compiling sources..."
echo "----------------------------------"
gulp
echo "----------------------------------"
echo "- Building Android artifact..."
echo "----------------------------------"
rm -rf platforms/android/build/outputs/release/*
ionic build android --release
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "----------------------------------"
echo "- Building web artifact..."
echo "----------------------------------"
# Update config file
gulp config --env default
gulp build:web --release
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "----------------------------------"
echo "- Executing git push, with tag: v$2"
echo "----------------------------------"
# Commit
cd ${DIRNAME}
git reset HEAD
git add package.json config.xml install.sh www/js/config.js www/manifest.json
if [[ $? -ne 0 ]]; then
exit 1
fi
git commit -m "v$2" && git tag "v$2" && git push
if [[ $? -ne 0 ]]; then
exit 1
fi
# Commit android project
cd ${DIRNAME}/platforms/android
git reset HEAD
git add -A
git commit -m "v$2" && git tag "v$2" && git push
if [[ $? -ne 0 ]]; then
exit 1
fi
# Pause (wait propagation to from git.duniter.org to github)
echo " Waiting 40s, for propagation to github..."
sleep 40s
description="$4"
if [[ "_$description" == "_" ]]; then
description="Release v$2"
fi
echo "**********************************"
echo "* Uploading artifacts to Github..."
echo "**********************************"
./github.sh $1 ''"$description"''
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "----------------------------------"
echo "- Building desktop artifacts..."
echo "----------------------------------"
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
if [[ -d "${DIRNAME}/dist/desktop" ]]; then
cd "${DIRNAME}/dist/desktop"
# Fetch last updates
git fetch origin && git merge origin/master || exit 1
# Build desktop assets
./release.sh $2
if [[ $? -ne 0 ]]; then
exit 1
fi
else
echo "ERROR: dist/desktop not found -> Make sure git submodule has been init!"
exit 1
fi;
# back to nodejs version 6
cd ${DIRNAME}
nvm use 6
echo "**********************************"
echo "* Build release succeed !"
echo "**********************************"
#!/bin/bash #!/bin/bash
# Get to the root project # Get to the root project
if [[ "_" == "_${PROJECT_DIR}" ]]; then if [[ "_" == "_${PROJECT_DIR}" ]]; then
SCRIPT_DIR=$(dirname $0) SCRIPT_DIR=$(dirname $0)
...@@ -15,6 +16,10 @@ fi ...@@ -15,6 +16,10 @@ fi
cd ${PROJECT_DIR} cd ${PROJECT_DIR}
# Run the build # Run the build
echo "Running cordova build..." echo "Cleaning previous android APK files..."
ionic cordova build android --warning-mode=none --color rm -rf ${ANDROID_OUTPUT_APK_DEBUG}/*.apk
rm -rf ${ANDROID_OUTPUT_APK_RELEASE}/*.apk
echo "Running cordova build android..."
ionic cordova build android --warning-mode=none --color $*
#ionic cordova build android --warning-mode=none --color --verbose #ionic cordova build android --warning-mode=none --color --verbose
...@@ -21,6 +21,9 @@ ANDROID_SDK_VERSION=r29.0.0 ...@@ -21,6 +21,9 @@ ANDROID_SDK_VERSION=r29.0.0
ANDROID_SDK_TOOLS_VERSION=4333796 ANDROID_SDK_TOOLS_VERSION=4333796
ANDROID_SDK_ROOT=/usr/lib/android-sdk ANDROID_SDK_ROOT=/usr/lib/android-sdk
ANDROID_SDK_TOOLS_ROOT=${ANDROID_SDK_ROOT}/build-tools ANDROID_SDK_TOOLS_ROOT=${ANDROID_SDK_ROOT}/build-tools
ANDROID_OUTPUT_APK=platforms/android/build/outputs/apk
ANDROID_OUTPUT_APK_DEBUG=${ANDROID_OUTPUT_APK}/debug
ANDROID_OUTPUT_APK_RELEASE=${ANDROID_OUTPUT_APK}/release
#JAVA_HOME= #JAVA_HOME=
...@@ -45,6 +48,19 @@ if [[ "_" == "_${JAVA_HOME}" ]]; then ...@@ -45,6 +48,19 @@ if [[ "_" == "_${JAVA_HOME}" ]]; then
echo "No Java installed. Please install java, or set env variable JAVA_HOME " echo "No Java installed. Please install java, or set env variable JAVA_HOME "
exit 1 exit 1
fi fi
# Check the Java version
JAVA_VERSION=`java -version 2>&1 | egrep "(java|openjdk) version" | awk '{print $3}' | tr -d \"`
if [[ $? -ne 0 ]]; then
echo "No Java JRE 1.8 found in machine. This is required for Android artifacts."
exit 1
fi
JAVA_MAJOR_VERSION=`echo ${JAVA_VERSION} | awk '{split($0, array, ".")} END{print array[1]}'`
JAVA_MINOR_VERSION=`echo ${JAVA_VERSION} | awk '{split($0, array, ".")} END{print array[2]}'`
if [[ ${JAVA_MAJOR_VERSION} -ne 1 ]] || [[ ${JAVA_MINOR_VERSION} -ne 8 ]]; then
echo "Require a Java JRE in version 1.8, but found ${JAVA_VERSION}. You can override your default JAVA_HOME in '.local/env.sh'."
exit 1
fi
fi fi
# Checking Android SDK # Checking Android SDK
......
...@@ -94,7 +94,7 @@ angular.module("cesium.config", []) ...@@ -94,7 +94,7 @@ angular.module("cesium.config", [])
} }
}, },
"version": "1.4.15", "version": "1.4.15",
"build": "2019-12-27T18:57:30.124Z", "build": "2019-12-27T19:07:17.137Z",
"newIssueUrl": "https://git.duniter.org/clients/cesium-grp/cesium/issues/new" "newIssueUrl": "https://git.duniter.org/clients/cesium-grp/cesium/issues/new"
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment