[Fix 8635] About showed "Version ()" instead of Version 0.14.0 (201908...) on Android

Fixes #8635 by adding VERSION and BUILD_NUMBER files in the correct nix
template and updating bash script in order to prevent it from failing,
due to the git repository being not initialized in the nix environment.

Move scripts/build_no.sh and scripts/gen_build_no.sh to
scripts/version/build_no.sh to prevent Nix from rebuilding when
unrelated scripts are touched.

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
MajorTomSec 2019-08-23 19:16:08 +02:00 committed by Andrey Shovkoplyas
parent 397b193de2
commit 5dbac2b1d9
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
7 changed files with 13 additions and 11 deletions

View File

@ -112,7 +112,7 @@ def getVersionCode = { ->
}
exec {
commandLine "bash", "../../scripts/build_no.sh"
commandLine "bash", "../../scripts/version/build_no.sh"
standardOutput = stdOut
errorOutput = System.err
}

View File

@ -57,7 +57,7 @@ def doGitRebase() {
def genBuildNumber() {
def number = sh(
returnStdout: true,
script: "${env.WORKSPACE}/scripts/gen_build_no.sh"
script: "${env.WORKSPACE}/scripts/version/gen_build_no.sh"
).trim()
println "Build Number: ${number}"
return number
@ -66,7 +66,7 @@ def genBuildNumber() {
def readBuildNumber() {
def number = sh(
returnStdout: true,
script: "${env.WORKSPACE}/scripts/build_no.sh"
script: "${env.WORKSPACE}/scripts/version/build_no.sh"
).trim().toInteger()
return number
}

View File

@ -23,7 +23,7 @@ if [[ $(git ls-files -m "StatusIm/Info.plist") = *"Info.plist"* ]]; then
echo "version was set in Info.plist"
else
RELEASE_VERSION=$(cat ../../VERSION)
BUILD_NO=$(bash ../scripts/build_no.sh)
BUILD_NO=$(bash ../scripts/version/build_no.sh)
# For debugging:
echo "SHORT VERSION: $RELEASE_VERSION"

View File

@ -22,10 +22,10 @@ in stdenv.mkDerivation {
mkFilter {
dirRootsToInclude = [
"components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src" "env/prod" "prod" # Taken from project.clj :profiles :prod :cljsbuild :builds :android :source-paths
"resources" "status-modules/cljs" "status-modules/resources"
"resources" "status-modules/cljs" "status-modules/resources" "scripts/version"
];
dirsToExclude = [ ".git" ".svn" "CVS" ".hg" ".gradle" "build" "intermediates" "libs" "obj" ];
filesToInclude = [ "build.clj" "externs.js" "project.clj" "prepare-modules.js" ];
filesToInclude = [ "build.clj" "externs.js" "project.clj" "prepare-modules.js" "VERSION" "BUILD_NUMBER"];
root = path;
};
};

View File

@ -26,12 +26,14 @@
# Fail on first error
set -e
GIT_ROOT=$(git rev-parse --show-toplevel)
DEV_BUILD_NUMBER=9999
BUILD_NUMBER_FILE="${GIT_ROOT}/BUILD_NUMBER"
SCRIPTPATH="$(cd "$(dirname "$0")" ; pwd -P)"
ROOT_PATH="${SCRIPTPATH}/../../"
BUILD_NUMBER_FILE="${ROOT_PATH}/BUILD_NUMBER"
# If running under Jenkins use a timestamp-based build number.
# That build number is generated by the scripts/gen_build_no.sh script.
# That build number is generated by the scripts/version/gen_build_no.sh script.
if [[ -f "${BUILD_NUMBER_FILE}" ]]; then
echo "Build number file found, using: $(cat ${BUILD_NUMBER_FILE})" 1>&2
cat "${BUILD_NUMBER_FILE}"

View File

@ -6,7 +6,7 @@
# that get uploaded to places like:
# Apple Store, Play Store, or TestFlight
#
# The result of this script is used by scripts/build_no.sh
# The result of this script is used by scripts/version/build_no.sh
# when being run in Jenkins build context.
#
#####################################################################

View File

@ -22,7 +22,7 @@
(System/exit 1))))
(defmacro get-build-no []
(-> (shell/sh "bash" "./scripts/build_no.sh")
(-> (shell/sh "bash" "./scripts/version/build_no.sh")
:out
(string/replace "\n" "")))