From f329ca9bdf9f816db55001b6afc43215860df3e8 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Thu, 2 May 2019 13:29:10 +0200 Subject: [PATCH] Add comments to STATUS_GO_VERSION to avoid manual editing Signed-off-by: Pedro Pombeiro --- STATUS_GO_SHA256 | 2 ++ STATUS_GO_VERSION | 2 ++ .../react-native-status/android/build.gradle | 2 +- .../desktop/CMakeLists.txt | 1 + nix/status-go/default.nix | 7 +++--- scripts/update-status-go.sh | 25 +++++++++++++------ 6 files changed, 27 insertions(+), 12 deletions(-) diff --git a/STATUS_GO_SHA256 b/STATUS_GO_SHA256 index cef7a0e944..ca984b6a11 100644 --- a/STATUS_GO_SHA256 +++ b/STATUS_GO_SHA256 @@ -1 +1,3 @@ +## DO NOT EDIT THIS FILE BY HAND. USE `scripts/update-status-go.sh ` instead + 1iixi6f6r3rqb671x3xzki8cibrbhrr312sh32vd13np9hcdwf0w diff --git a/STATUS_GO_VERSION b/STATUS_GO_VERSION index c44bf2d83a..af710d2bdf 100644 --- a/STATUS_GO_VERSION +++ b/STATUS_GO_VERSION @@ -1 +1,3 @@ +## DO NOT EDIT THIS FILE BY HAND. USE `scripts/update-status-go.sh ` instead + v0.23.0-beta.10 diff --git a/modules/react-native-status/android/build.gradle b/modules/react-native-status/android/build.gradle index 4dcf92e4a3..8289d6fe32 100644 --- a/modules/react-native-status/android/build.gradle +++ b/modules/react-native-status/android/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' def getStatusGoVersion = { -> version = new File('../STATUS_GO_VERSION').text - return version.replaceAll("\\s","") + return version.tokenize('\n').last().replaceAll("\\s","") } android { diff --git a/modules/react-native-status/desktop/CMakeLists.txt b/modules/react-native-status/desktop/CMakeLists.txt index c623218db1..9b97049dd9 100755 --- a/modules/react-native-status/desktop/CMakeLists.txt +++ b/modules/react-native-status/desktop/CMakeLists.txt @@ -18,6 +18,7 @@ if (WIN32) file(STRINGS "../../../STATUS_GO_OWNER" STATUS_GO_OWNER) file(STRINGS "../../../STATUS_GO_VERSION" STATUS_GO_VERSION) + list(GET STATUS_GO_VERSION -1 STATUS_GO_VERSION) if (CUSTOM_STATUSGO_BUILD_DIR_PATH) set(StatusGo_ROOT ${CUSTOM_STATUSGO_BUILD_DIR_PATH}) diff --git a/nix/status-go/default.nix b/nix/status-go/default.nix index e455d50be2..7e453352c4 100644 --- a/nix/status-go/default.nix +++ b/nix/status-go/default.nix @@ -3,13 +3,14 @@ with stdenv; let + extractStatusGoConfig = f: lib.last (lib.splitString "\n" (lib.fileContents f)); gomobile = pkgs.callPackage ./gomobile { inherit (androidPkgs) platform-tools; inherit composeXcodeWrapper xcodewrapperArgs; }; - version = lib.fileContents ../../STATUS_GO_VERSION; # TODO: Simplify this path search with lib.locateDominatingFile owner = lib.fileContents ../../STATUS_GO_OWNER; + version = extractStatusGoConfig ../../STATUS_GO_VERSION; # TODO: Simplify this path search with lib.locateDominatingFile + sha256 = extractStatusGoConfig ../../STATUS_GO_SHA256; repo = "status-go"; - goPackagePath = "github.com/${owner}/${repo}"; rev = version; - sha256 = lib.fileContents ../../STATUS_GO_SHA256; + goPackagePath = "github.com/${owner}/${repo}"; mobileConfigs = { android = { name = "android"; diff --git a/scripts/update-status-go.sh b/scripts/update-status-go.sh index b943b6b8d6..51bce08439 100755 --- a/scripts/update-status-go.sh +++ b/scripts/update-status-go.sh @@ -23,15 +23,24 @@ if [ $# -eq 0 ]; then exit 1 fi -STATUSGO_OWNER="$(cat ${GIT_ROOT}/STATUS_GO_OWNER)" -STATUSGO_VERSION="v${1#"v"}" -if [ "$STATUSGO_OWNER" == 'status-im' ] && [ "$STATUSGO_VERSION" != "$1" ]; then +STATUS_GO_OWNER="$(cat ${GIT_ROOT}/STATUS_GO_OWNER)" +STATUS_GO_VERSION="v${1#"v"}" +if [ "$STATUS_GO_OWNER" == 'status-im' ] && [ "$STATUS_GO_VERSION" != "$1" ]; then echo "status-go release branches should include the v prefix!" - echo "Please create a new branch called $STATUSGO_VERSION" + echo "Please create a new branch called $STATUS_GO_VERSION" exit 1 fi -STATUSGO_VERSION=$1 -STATUSGO_SHA256=$(nix-prefetch-url --unpack https://github.com/${STATUSGO_OWNER}/status-go/archive/${STATUSGO_VERSION}.zip) +STATUS_GO_VERSION=$1 +STATUS_GO_SHA256=$(nix-prefetch-url --unpack https://github.com/${STATUS_GO_OWNER}/status-go/archive/${STATUS_GO_VERSION}.zip) -echo $STATUSGO_VERSION > ${GIT_ROOT}/STATUS_GO_VERSION -echo $STATUSGO_SHA256 > ${GIT_ROOT}/STATUS_GO_SHA256 + +cat << EOF > ${GIT_ROOT}/STATUS_GO_VERSION +## DO NOT EDIT THIS FILE BY HAND. USE \`scripts/update-status-go.sh \` instead + +$STATUS_GO_VERSION +EOF +cat << EOF > ${GIT_ROOT}/STATUS_GO_SHA256 +## DO NOT EDIT THIS FILE BY HAND. USE \`scripts/update-status-go.sh \` instead + +$STATUS_GO_SHA256 +EOF