[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 { exec {
commandLine "bash", "../../scripts/build_no.sh" commandLine "bash", "../../scripts/version/build_no.sh"
standardOutput = stdOut standardOutput = stdOut
errorOutput = System.err errorOutput = System.err
} }

View File

@ -57,7 +57,7 @@ def doGitRebase() {
def genBuildNumber() { def genBuildNumber() {
def number = sh( def number = sh(
returnStdout: true, returnStdout: true,
script: "${env.WORKSPACE}/scripts/gen_build_no.sh" script: "${env.WORKSPACE}/scripts/version/gen_build_no.sh"
).trim() ).trim()
println "Build Number: ${number}" println "Build Number: ${number}"
return number return number
@ -66,7 +66,7 @@ def genBuildNumber() {
def readBuildNumber() { def readBuildNumber() {
def number = sh( def number = sh(
returnStdout: true, returnStdout: true,
script: "${env.WORKSPACE}/scripts/build_no.sh" script: "${env.WORKSPACE}/scripts/version/build_no.sh"
).trim().toInteger() ).trim().toInteger()
return number 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" echo "version was set in Info.plist"
else else
RELEASE_VERSION=$(cat ../../VERSION) RELEASE_VERSION=$(cat ../../VERSION)
BUILD_NO=$(bash ../scripts/build_no.sh) BUILD_NO=$(bash ../scripts/version/build_no.sh)
# For debugging: # For debugging:
echo "SHORT VERSION: $RELEASE_VERSION" echo "SHORT VERSION: $RELEASE_VERSION"

View File

@ -22,10 +22,10 @@ in stdenv.mkDerivation {
mkFilter { mkFilter {
dirRootsToInclude = [ 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 "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" ]; 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; root = path;
}; };
}; };

View File

@ -26,12 +26,14 @@
# Fail on first error # Fail on first error
set -e set -e
GIT_ROOT=$(git rev-parse --show-toplevel)
DEV_BUILD_NUMBER=9999 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. # 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 if [[ -f "${BUILD_NUMBER_FILE}" ]]; then
echo "Build number file found, using: $(cat ${BUILD_NUMBER_FILE})" 1>&2 echo "Build number file found, using: $(cat ${BUILD_NUMBER_FILE})" 1>&2
cat "${BUILD_NUMBER_FILE}" cat "${BUILD_NUMBER_FILE}"

View File

@ -6,7 +6,7 @@
# that get uploaded to places like: # that get uploaded to places like:
# Apple Store, Play Store, or TestFlight # 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. # when being run in Jenkins build context.
# #
##################################################################### #####################################################################

View File

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