nix: don't generate keystore inside of Nix build
changes: - Stops scripts/generate-keystore.sh runnig for every new TARGET=android shell - Moves running scripts/generate-keystore.sh to keystore Makefile target - Makes generate-keystore.sh accept STATUS_RELEASE_STORE_FILE as env variable - Fixes error about missing lsof from start-react-native.sh - Fixes error about unknown -keystore command in scripts/generate-keystore.sh - Fixes getting OS_NAME without calling Nix shell - Fixes getting TMP_BUILD_NUMBER without calling Nix shell - Adds lsof used in start-react-native.sh to Android release Nix derivation - Simplified how nix/scripts/build.sh appends the --keep flag - Made use of colors.sh in more scripts Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
efa420def4
commit
de53581ef4
22
Makefile
22
Makefile
|
@ -47,6 +47,12 @@ ifdef TARGET_OS
|
||||||
export TARGET ?= $(TARGET_OS)
|
export TARGET ?= $(TARGET_OS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Useful for checking if we are on NixOS
|
||||||
|
OS_NAME := $(shell awk -F= '/^NAME/{print $2}' /etc/os-release)
|
||||||
|
|
||||||
|
# Useful for Andoird release builds
|
||||||
|
TMP_BUILD_NUMBER := $(shell ./scripts/version/gen_build_no.sh | cut -c1-10)
|
||||||
|
|
||||||
# MacOS root is read-only, read nix/README.md for details
|
# MacOS root is read-only, read nix/README.md for details
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
@ -54,9 +60,6 @@ export NIX_IGNORE_SYMLINK_STORE=1
|
||||||
export _NIX_ROOT = /opt/nix
|
export _NIX_ROOT = /opt/nix
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Useful for checking if we are on NixOS
|
|
||||||
OS_NAME ?= $(shell source /etc/os-release && echo $${NAME})
|
|
||||||
|
|
||||||
#----------------
|
#----------------
|
||||||
# Nix targets
|
# Nix targets
|
||||||
#----------------
|
#----------------
|
||||||
|
@ -152,19 +155,24 @@ update-fleets: ##@prepare Download up-to-date JSON file with current fleets stat
|
||||||
| jq --indent 4 --sort-keys . \
|
| jq --indent 4 --sort-keys . \
|
||||||
> resources/config/fleets.json
|
> resources/config/fleets.json
|
||||||
|
|
||||||
|
keystore: export TARGET := keytool
|
||||||
|
keystore: export KEYSTORE_PATH ?= $(HOME)/.gradle/status-im.keystore
|
||||||
|
keystore: ##@prepare Generate a Keystore for signing Android APKs
|
||||||
|
@./scripts/generate-keystore.sh
|
||||||
|
|
||||||
#----------------
|
#----------------
|
||||||
# Release builds
|
# Release builds
|
||||||
#----------------
|
#----------------
|
||||||
release: release-android release-ios ##@build build release for Android and iOS
|
release: release-android release-ios ##@build build release for Android and iOS
|
||||||
|
|
||||||
release-android: export TARGET ?= android
|
release-android: export TARGET := android
|
||||||
release-android: export BUILD_ENV ?= prod
|
release-android: export BUILD_ENV ?= prod
|
||||||
release-android: export BUILD_TYPE ?= nightly
|
release-android: export BUILD_TYPE ?= nightly
|
||||||
release-android: export BUILD_NUMBER ?= $(shell ./scripts/version/gen_build_no.sh | cut -c1-10)
|
release-android: export BUILD_NUMBER ?= $(TMP_BUILD_NUMBER)
|
||||||
release-android: export KEYSTORE_FILE ?= $(HOME)/.gradle/status-im.keystore
|
release-android: export KEYSTORE_PATH ?= $(HOME)/.gradle/status-im.keystore
|
||||||
release-android: export ANDROID_ABI_SPLIT ?= false
|
release-android: export ANDROID_ABI_SPLIT ?= false
|
||||||
release-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86
|
release-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86
|
||||||
release-android: ##@build build release for Android
|
release-android: keystore ##@build build release for Android
|
||||||
scripts/release-android.sh
|
scripts/release-android.sh
|
||||||
|
|
||||||
release-ios: export TARGET ?= ios
|
release-ios: export TARGET ?= ios
|
||||||
|
|
|
@ -219,10 +219,10 @@ android {
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
/* environment variables take precedence over gradle.properties file */
|
/* environment variables take precedence over gradle.properties file */
|
||||||
storeFile file(getEnvOrConfig('STATUS_RELEASE_STORE_FILE').replaceAll("~", System.properties['user.home']))
|
storeFile file(getEnvOrConfig('KEYSTORE_PATH').replaceAll("~", System.properties['user.home']))
|
||||||
storePassword getEnvOrConfig('STATUS_RELEASE_STORE_PASSWORD')
|
storePassword getEnvOrConfig('KEYSTORE_PASSWORD')
|
||||||
keyAlias getEnvOrConfig('STATUS_RELEASE_KEY_ALIAS')
|
keyAlias getEnvOrConfig('KEYSTORE_ALIAS')
|
||||||
keyPassword getEnvOrConfig('STATUS_RELEASE_KEY_PASSWORD')
|
keyPassword getEnvOrConfig('KEYSTORE_KEY_PASSWORD')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
splits {
|
splits {
|
||||||
|
|
|
@ -31,10 +31,10 @@ gradlePluginVersion=3.4.1
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
|
||||||
STATUS_RELEASE_STORE_FILE=~/.gradle/status-im.keystore
|
KEYSTORE_PATH=~/.gradle/status-im.keystore
|
||||||
STATUS_RELEASE_STORE_PASSWORD=password
|
KEYSTORE_PASSWORD=password
|
||||||
STATUS_RELEASE_KEY_ALIAS=status
|
KEYSTORE_ALIAS=status
|
||||||
STATUS_RELEASE_KEY_PASSWORD=password
|
KEYSTORE_KEY_PASSWORD=password
|
||||||
|
|
||||||
# By default we build a mostly universal APK
|
# By default we build a mostly universal APK
|
||||||
ANDROID_ABI_SPLIT=false
|
ANDROID_ABI_SPLIT=false
|
||||||
|
|
|
@ -27,16 +27,16 @@ def bundle() {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
file(
|
file(
|
||||||
credentialsId: 'status-im.keystore',
|
credentialsId: 'status-im.keystore',
|
||||||
variable: 'STATUS_RELEASE_STORE_FILE'
|
variable: 'KEYSTORE_PATH'
|
||||||
),
|
),
|
||||||
string(
|
string(
|
||||||
credentialsId: 'android-keystore-pass',
|
credentialsId: 'android-keystore-pass',
|
||||||
variable: 'STATUS_RELEASE_STORE_PASSWORD'
|
variable: 'KEYSTORE_PASSWORD'
|
||||||
),
|
),
|
||||||
usernamePassword(
|
usernamePassword(
|
||||||
credentialsId: 'android-keystore-key-pass',
|
credentialsId: 'android-keystore-key-pass',
|
||||||
usernameVariable: 'STATUS_RELEASE_KEY_ALIAS',
|
usernameVariable: 'KEYSTORE_ALIAS',
|
||||||
passwordVariable: 'STATUS_RELEASE_KEY_PASSWORD'
|
passwordVariable: 'KEYSTORE_KEY_PASSWORD'
|
||||||
)
|
)
|
||||||
]) {
|
]) {
|
||||||
/* Nix target which produces the final APKs */
|
/* Nix target which produces the final APKs */
|
||||||
|
@ -49,17 +49,17 @@ def bundle() {
|
||||||
'status-im.status-react.build-number': buildNumber,
|
'status-im.status-react.build-number': buildNumber,
|
||||||
],
|
],
|
||||||
safeEnv: [
|
safeEnv: [
|
||||||
'STATUS_RELEASE_KEY_ALIAS',
|
'KEYSTORE_ALIAS',
|
||||||
'STATUS_RELEASE_STORE_PASSWORD',
|
'KEYSTORE_PASSWORD',
|
||||||
'STATUS_RELEASE_KEY_PASSWORD',
|
'KEYSTORE_KEY_PASSWORD',
|
||||||
],
|
],
|
||||||
keepEnv: [
|
keepEnv: [
|
||||||
'ANDROID_ABI_SPLIT',
|
'ANDROID_ABI_SPLIT',
|
||||||
'ANDROID_ABI_INCLUDE',
|
'ANDROID_ABI_INCLUDE',
|
||||||
'STATUS_RELEASE_STORE_FILE',
|
'KEYSTORE_PATH',
|
||||||
],
|
],
|
||||||
sandboxPaths: [
|
sandboxPaths: [
|
||||||
env.STATUS_RELEASE_STORE_FILE,
|
env.KEYSTORE_PATH,
|
||||||
],
|
],
|
||||||
link: false
|
link: false
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, callPackage, mkShell, mergeSh, androidenv, flock, openjdk,
|
{ config, lib, callPackage, mkShell, mergeSh, androidenv, flock, lsof, openjdk,
|
||||||
status-go, localMavenRepoBuilder, projectNodePackage }:
|
status-go, localMavenRepoBuilder, projectNodePackage }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -32,6 +32,7 @@ let
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
mavenAndNpmDeps.drv openjdk gradle
|
mavenAndNpmDeps.drv openjdk gradle
|
||||||
|
lsof # used in start-react-native.sh
|
||||||
flock # used in reset-node_modules.sh
|
flock # used in reset-node_modules.sh
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -45,12 +46,9 @@ in {
|
||||||
inherit buildInputs;
|
inherit buildInputs;
|
||||||
inputsFrom = [ release gradle ];
|
inputsFrom = [ release gradle ];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
pushd "$STATUS_REACT_HOME" > /dev/null
|
# check if node modules changed and if so install them
|
||||||
{
|
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh \
|
||||||
./scripts/generate-keystore.sh
|
"${mavenAndNpmDeps.drv}/project"
|
||||||
# check if node modules changed and if so install them
|
|
||||||
./nix/mobile/reset-node_modules.sh "${mavenAndNpmDeps.drv}/project"
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
(lib.catAttrs "shell" [ status-go mavenAndNpmDeps androidEnv ]);
|
(lib.catAttrs "shell" [ status-go mavenAndNpmDeps androidEnv ]);
|
||||||
|
|
|
@ -20,7 +20,8 @@ let
|
||||||
inherit (config.status-im) build-type;
|
inherit (config.status-im) build-type;
|
||||||
inherit (config.status-im.status-react) build-number;
|
inherit (config.status-im.status-react) build-number;
|
||||||
gradle-opts = (attrByPath ["status-im" "status-react" "gradle-opts"] "" config);
|
gradle-opts = (attrByPath ["status-im" "status-react" "gradle-opts"] "" config);
|
||||||
keystore-file = (attrByPath ["status-im" "status-react" "keystore-file"] "" config); # Path to the .keystore file used to sign the package
|
# Path to the .keystore file used to sign the Android APK
|
||||||
|
keystore-file = (attrByPath ["status-im" "status-react" "keystore-file"] "" config);
|
||||||
baseName = "release-android";
|
baseName = "release-android";
|
||||||
name = "status-react-build-${baseName}";
|
name = "status-react-build-${baseName}";
|
||||||
gradleHome = "$NIX_BUILD_TOP/.gradle";
|
gradleHome = "$NIX_BUILD_TOP/.gradle";
|
||||||
|
@ -48,8 +49,14 @@ in stdenv.mkDerivation {
|
||||||
"modules/react-native-status/android"
|
"modules/react-native-status/android"
|
||||||
"resources"
|
"resources"
|
||||||
];
|
];
|
||||||
dirsToExclude = [ ".git" ".svn" "CVS" ".hg" ".gradle" "build" "intermediates" "libs" "obj" ];
|
dirsToExclude = [
|
||||||
filesToInclude = [ envFileName "status-go-version.json" "VERSION" "react-native.config.js" ".watchmanconfig" ];
|
".git" ".svn" "CVS" ".hg" ".gradle"
|
||||||
|
"build" "intermediates" "libs" "obj"
|
||||||
|
];
|
||||||
|
filesToInclude = [
|
||||||
|
envFileName "VERSION" ".watchmanconfig"
|
||||||
|
"status-go-version.json" "react-native.config.js"
|
||||||
|
];
|
||||||
root = path;
|
root = path;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -69,7 +76,7 @@ in stdenv.mkDerivation {
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
mkdir -p ${gradleHome}
|
mkdir -p ${gradleHome}
|
||||||
|
|
||||||
${if keystore-file != "" then "cp -a --no-preserve=ownership ${keystore-file} ${gradleHome}/; export STATUS_RELEASE_STORE_FILE=${gradleHome}/$(basename ${keystore-file})" else ""}
|
${if keystore-file != "" then "cp -a --no-preserve=ownership ${keystore-file} ${gradleHome}/; export KEYSTORE_PATH=${gradleHome}/$(basename ${keystore-file})" else ""}
|
||||||
|
|
||||||
# Ensure we have the right .env file
|
# Ensure we have the right .env file
|
||||||
cp -f $sourceRoot/${envFileName} $sourceRoot/.env
|
cp -f $sourceRoot/${envFileName} $sourceRoot/.env
|
||||||
|
|
|
@ -51,18 +51,17 @@ nixOpts=(
|
||||||
"--show-trace"
|
"--show-trace"
|
||||||
"--attr ${targetAttr}"
|
"--attr ${targetAttr}"
|
||||||
"${@}"
|
"${@}"
|
||||||
"default.nix"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# This variable allows specifying which env vars to keep for Nix pure shell
|
# This variable allows specifying which env vars to keep for Nix pure shell.
|
||||||
# The separator is a semicolon
|
# The separator is a colon
|
||||||
if [[ -n "${_NIX_KEEP}" ]]; then
|
if [[ -n "${_NIX_KEEP}" ]]; then
|
||||||
nixOpts+=("--keep ${_NIX_KEEP//;/ --keep }")
|
nixOpts+=("--keep ${_NIX_KEEP//,/ --keep }")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the actual build
|
# Run the actual build
|
||||||
echo "Running: nix-build ${nixOpts[@]}"
|
echo "Running: nix-build ${nixOpts[@]} default.nix"
|
||||||
nixResultPath=$(nix-build ${nixOpts[@]})
|
nixResultPath=$(nix-build ${nixOpts[@]} default.nix)
|
||||||
|
|
||||||
echo "Extracting result: ${nixResultPath}"
|
echo "Extracting result: ${nixResultPath}"
|
||||||
extractResults "${nixResultPath}"
|
extractResults "${nixResultPath}"
|
||||||
|
|
|
@ -67,9 +67,9 @@ else
|
||||||
pureDesc='pure '
|
pureDesc='pure '
|
||||||
fi
|
fi
|
||||||
# This variable allows specifying which env vars to keep for Nix pure shell
|
# This variable allows specifying which env vars to keep for Nix pure shell
|
||||||
# The separator is a semicolon
|
# The separator is a colon
|
||||||
if [[ -n "${_NIX_KEEP}" ]]; then
|
if [[ -n "${_NIX_KEEP}" ]]; then
|
||||||
shellArgs+=("--keep ${_NIX_KEEP//;/ --keep }")
|
shellArgs+=("--keep ${_NIX_KEEP//,/ --keep }")
|
||||||
fi
|
fi
|
||||||
echo -e "${GRN}Configuring ${pureDesc}${_NIX_ATTR:-default} Nix shell for target '${TARGET}'...${RST}" 1>&2
|
echo -e "${GRN}Configuring ${pureDesc}${_NIX_ATTR:-default} Nix shell for target '${TARGET}'...${RST}" 1>&2
|
||||||
exec nix-shell ${shellArgs[@]} --run "$@" ${entryPoint}
|
exec nix-shell ${shellArgs[@]} --run "$@" ${entryPoint}
|
||||||
|
|
|
@ -14,14 +14,19 @@ let
|
||||||
buildInputs = with pkgs; [ clojure leiningen flock maven nodejs openjdk ];
|
buildInputs = with pkgs; [ clojure leiningen flock maven nodejs openjdk ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# for running fastlane commands alone
|
|
||||||
fastlane-sh = targets.mobile.fastlane.shell;
|
|
||||||
|
|
||||||
# for 'make watchman-clean'
|
# for 'make watchman-clean'
|
||||||
watchman-sh = pkgs.mkShell {
|
watchman-sh = pkgs.mkShell {
|
||||||
buildInputs = [ pkgs.watchman ];
|
buildInputs = [ pkgs.watchman ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# for running fastlane commands alone
|
||||||
|
fastlane-sh = targets.mobile.fastlane.shell;
|
||||||
|
|
||||||
|
# for 'scripts/generate-keystore.sh'
|
||||||
|
keytool-sh = pkgs.mkShell {
|
||||||
|
buildInputs = [ pkgs.openjdk8 ];
|
||||||
|
};
|
||||||
|
|
||||||
# the default shell that is used when target is not specified
|
# the default shell that is used when target is not specified
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
name = "status-react-shell"; # for identifying all shells
|
name = "status-react-shell"; # for identifying all shells
|
||||||
|
@ -50,6 +55,7 @@ in with pkgs; rec {
|
||||||
lein = leiningen-sh;
|
lein = leiningen-sh;
|
||||||
watchman = watchman-sh;
|
watchman = watchman-sh;
|
||||||
fastlane = fastlane-sh;
|
fastlane = fastlane-sh;
|
||||||
|
keytool = keytool-sh;
|
||||||
adb = targets.mobile.android.adb.shell;
|
adb = targets.mobile.android.adb.shell;
|
||||||
# helpers for use with target argument
|
# helpers for use with target argument
|
||||||
linux = targets.desktop.linux.shell;
|
linux = targets.desktop.linux.shell;
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
VERBOSE_LEVEL=${VERBOSE_LEVEL:-1}
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||||
|
source "${GIT_ROOT}/scripts/colors.sh"
|
||||||
|
|
||||||
RED='\033[0;31m'
|
VERBOSE_LEVEL=${VERBOSE_LEVEL:-1}
|
||||||
GREEN='\033[0;32m'
|
|
||||||
YELLOW='\033[1;33m'
|
|
||||||
NC='\033[0m'
|
|
||||||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||||
OS=$(uname -s)
|
OS=$(uname -s)
|
||||||
if [ -z "$TARGET" ]; then
|
if [ -z "$TARGET" ]; then
|
||||||
|
@ -56,13 +54,13 @@ JS_BUNDLE_PATH="$WORKFOLDER/index.desktop.bundle"
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if [ -z $STATUS_REACT_HOME ]; then
|
if [ -z $STATUS_REACT_HOME ]; then
|
||||||
echo "${RED}STATUS_REACT_HOME environment variable is not defined!${NC}"
|
echo "${RED}STATUS_REACT_HOME environment variable is not defined!${RST}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_windows_target; then
|
if ! is_windows_target; then
|
||||||
if [ -z $QT_PATH ]; then
|
if [ -z $QT_PATH ]; then
|
||||||
echo "${RED}QT_PATH environment variable is not defined!${NC}"
|
echo "${RED}QT_PATH environment variable is not defined!${RST}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -73,7 +71,7 @@ function init() {
|
||||||
if is_windows_target; then
|
if is_windows_target; then
|
||||||
export PATH=$STATUS_REACT_HOME:$PATH
|
export PATH=$STATUS_REACT_HOME:$PATH
|
||||||
if ! program_exists 'conan'; then
|
if ! program_exists 'conan'; then
|
||||||
echo "${RED}Conan package manager not found. Exiting...${NC}"
|
echo "${RED}Conan package manager not found. Exiting...${RST}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -95,7 +93,7 @@ function buildJSBundle() {
|
||||||
# create directory for all work related to bundling
|
# create directory for all work related to bundling
|
||||||
rm -rf $WORKFOLDER
|
rm -rf $WORKFOLDER
|
||||||
mkdir -p $WORKFOLDER
|
mkdir -p $WORKFOLDER
|
||||||
echo -e "${GREEN}Work folder created: $WORKFOLDER${NC}"
|
echo -e "${GRN}Work folder created: $WORKFOLDER${RST}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# from index.desktop.js create javascript bundle and resources folder
|
# from index.desktop.js create javascript bundle and resources folder
|
||||||
|
@ -107,7 +105,7 @@ function buildJSBundle() {
|
||||||
--bundle-output "$JS_BUNDLE_PATH" \
|
--bundle-output "$JS_BUNDLE_PATH" \
|
||||||
--assets-dest "$WORKFOLDER/assets" \
|
--assets-dest "$WORKFOLDER/assets" \
|
||||||
--platform desktop
|
--platform desktop
|
||||||
echo -e "${GREEN}Generating done.${NC}"
|
echo -e "${GRN}Generating done.${RST}"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +115,7 @@ function compile() {
|
||||||
local jsPackagePath=$(joinExistingPath "$STATUS_REACT_HOME" 'desktop/js_files/package.json')
|
local jsPackagePath=$(joinExistingPath "$STATUS_REACT_HOME" 'desktop/js_files/package.json')
|
||||||
|
|
||||||
jq ".=(. + {$jsBundleLine})" "$jsPackagePath" | sponge "$jsPackagePath"
|
jq ".=(. + {$jsBundleLine})" "$jsPackagePath" | sponge "$jsPackagePath"
|
||||||
echo -e "${YELLOW}Added 'desktopJSBundlePath' line to $jsPackagePath:${NC}"
|
echo -e "${YLW}Added 'desktopJSBundlePath' line to $jsPackagePath:${RST}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
local EXTERNAL_MODULES_DIR="$(jq -r '.desktopExternalModules | @tsv | @text' "$jsPackagePath" | tr '\t' ';')"
|
local EXTERNAL_MODULES_DIR="$(jq -r '.desktopExternalModules | @tsv | @text' "$jsPackagePath" | tr '\t' ';')"
|
||||||
|
@ -132,7 +130,7 @@ function compile() {
|
||||||
local bin_dirs=$(jq -r '.dependencies[0].bin_paths | .[]' toolchain/conanbuildinfo.json)
|
local bin_dirs=$(jq -r '.dependencies[0].bin_paths | .[]' toolchain/conanbuildinfo.json)
|
||||||
while read -r bin_dir; do
|
while read -r bin_dir; do
|
||||||
if [ ! -d $bin ]; then
|
if [ ! -d $bin ]; then
|
||||||
echo -e "${RED}Could not find $bin_dir directory from 'toolchain/conanbuildinfo.json', aborting${NC}"
|
echo -e "${RED}Could not find $bin_dir directory from 'toolchain/conanbuildinfo.json', aborting${RST}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
export PATH=$bin_dir:$PATH
|
export PATH=$bin_dir:$PATH
|
||||||
|
@ -157,7 +155,7 @@ function bundleWindows() {
|
||||||
local version_file="${STATUS_REACT_HOME}/VERSION"
|
local version_file="${STATUS_REACT_HOME}/VERSION"
|
||||||
VERSION=$(cat $version_file)
|
VERSION=$(cat $version_file)
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" ]; then
|
||||||
echo "${RED}Could not read version from ${version_file}!${NC}"
|
echo "${RED}Could not read version from ${version_file}!${RST}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -263,7 +261,7 @@ function bundleLinux() {
|
||||||
mv -f ./Status-x86_64.AppImage ..
|
mv -f ./Status-x86_64.AppImage ..
|
||||||
popd
|
popd
|
||||||
|
|
||||||
echo -e "${GREEN}Package ready in ./Status-x86_64.AppImage!${NC}"
|
echo -e "${GRN}Package ready in ./Status-x86_64.AppImage!${RST}"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +335,7 @@ if [[ "$OS" =~ Darwin ]]; then
|
||||||
local targetDepDylib=$(joinExistingPath "/System/Library/Frameworks" "${framework}.framework/${framework}")
|
local targetDepDylib=$(joinExistingPath "/System/Library/Frameworks" "${framework}.framework/${framework}")
|
||||||
|
|
||||||
if [ ! -f "$targetDepDylib" ]; then
|
if [ ! -f "$targetDepDylib" ]; then
|
||||||
echo -e "${RED}FATAL: system framework not found: ${targetDepDylib}${NC}"
|
echo -e "${RED}FATAL: system framework not found: ${targetDepDylib}${RST}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -348,7 +346,7 @@ if [[ "$OS" =~ Darwin ]]; then
|
||||||
local targetDepDylib=$(joinPath "$frameworksDir" "$(basename $depDylib)")
|
local targetDepDylib=$(joinPath "$frameworksDir" "$(basename $depDylib)")
|
||||||
|
|
||||||
if [ ! -f "$targetDepDylib" ]; then
|
if [ ! -f "$targetDepDylib" ]; then
|
||||||
echo -e "${RED}FATAL: macdeployqt should have copied the dependency to ${targetDepDylib}${NC}"
|
echo -e "${RED}FATAL: macdeployqt should have copied the dependency to ${targetDepDylib}${RST}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -436,7 +434,7 @@ function bundleMacOS() {
|
||||||
rm -f Status.app.zip
|
rm -f Status.app.zip
|
||||||
popd
|
popd
|
||||||
|
|
||||||
echo -e "${GREEN}Package ready in $WORKFOLDER/Status.app!${NC}"
|
echo -e "${GRN}Package ready in $WORKFOLDER/Status.app!${RST}"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,5 @@
|
||||||
YLW='\033[1;33m'
|
YLW='\033[1;33m'
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GRN='\033[0;32m'
|
GRN='\033[0;32m'
|
||||||
|
BLD='\033[1m'
|
||||||
RST='\033[0m'
|
RST='\033[0m'
|
||||||
|
|
|
@ -13,34 +13,37 @@ function property_gradle() {
|
||||||
property ${GIT_ROOT}/android/gradle.properties ${1}
|
property ${GIT_ROOT}/android/gradle.properties ${1}
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET=${1:-debug}
|
KEYSTORE_PASSWORD=$(property_gradle 'KEYSTORE_PASSWORD')
|
||||||
|
KEYSTORE_ALIAS=$(property_gradle 'KEYSTORE_ALIAS')
|
||||||
|
KEYSTORE_KEY_PASSWORD=$(property_gradle 'KEYSTORE_KEY_PASSWORD')
|
||||||
|
|
||||||
CURRENT_DIR=$(cd "$(dirname "$0")" && pwd)
|
# Allow Makefile modify Keystore path if necessary
|
||||||
KEYSTORE_FILE=$(property_gradle 'STATUS_RELEASE_STORE_FILE')
|
if [[ -z ${KEYSTORE_PATH} ]]; then
|
||||||
KEYSTORE_FILE=${KEYSTORE_FILE/#\~/$HOME}
|
KEYSTORE_PATH=$(property_gradle 'KEYSTORE_FILE')
|
||||||
STATUS_RELEASE_STORE_PASSWORD=$(property_gradle 'STATUS_RELEASE_STORE_PASSWORD')
|
fi
|
||||||
STATUS_RELEASE_KEY_ALIAS=$(property_gradle 'STATUS_RELEASE_KEY_ALIAS')
|
# Replace ~ with proper absolute path
|
||||||
STATUS_RELEASE_KEY_PASSWORD=$(property_gradle 'STATUS_RELEASE_KEY_PASSWORD')
|
KEYSTORE_PATH=${KEYSTORE_FILE/#\~/$HOME}
|
||||||
|
|
||||||
if [[ -e "${KEYSTORE_FILE}" ]]; then
|
if [[ -e "${KEYSTORE_PATH}" ]]; then
|
||||||
echo -e "${YLW}Keystore file already exists:${RST} ${KEYSTORE_FILE}" > /dev/stderr
|
echo -e "${YLW}Keystore file already exists:${RST} ${KEYSTORE_PATH}" > /dev/stderr
|
||||||
|
echo "${KEYSTORE_PATH}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KEYSTORE_DIR=$(dirname "${KEYSTORE_FILE}")
|
KEYSTORE_DIR=$(dirname "${S/TATUS_RELEASE_STORE_FILE}")
|
||||||
[[ -d $KEYSTORE_DIR ]] || mkdir -p $KEYSTORE_DIR
|
[[ -d $KEYSTORE_DIR ]] || mkdir -p $KEYSTORE_DIR
|
||||||
|
|
||||||
echo "Generating keystore ${KEYSTORE_FILE}" > /dev/stderr
|
echo -e "${GRN}Generating keystore...${RST}" > /dev/stderr
|
||||||
|
|
||||||
keytool -genkey -v \
|
keytool -genkey -v \
|
||||||
-keyalg RSA \
|
-keyalg RSA \
|
||||||
-keysize 2048 \
|
-keysize 2048 \
|
||||||
-validity 10000 \
|
-validity 10000 \
|
||||||
-dname "CN=, OU=, O=, L=, S=, C="
|
-dname "CN=, OU=, O=, L=, S=, C=" \
|
||||||
-keystore "${KEYSTORE_FILE}" \
|
-keystore "${KEYSTORE_PATH}" \
|
||||||
-alias "${STATUS_RELEASE_KEY_ALIAS}" \
|
-alias "${KEYSTORE_ALIAS}" \
|
||||||
-storepass "${STATUS_RELEASE_STORE_PASSWORD}" \
|
-storepass "${KEYSTORE_PASSWORD}" \
|
||||||
-keypass "${STATUS_RELEASE_KEY_PASSWORD}" \
|
-keypass "${KEYSTORE_KEY_PASSWORD}" \
|
||||||
> /dev/stderr
|
> /dev/stderr
|
||||||
|
|
||||||
echo "${KEYSTORE_FILE}"
|
echo "${KEYSTORE_PATH}"
|
||||||
|
|
|
@ -1,17 +1,31 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Needed to fail on must_get_env()
|
||||||
|
set -e
|
||||||
|
|
||||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||||
|
source "${GIT_ROOT}/scripts/colors.sh"
|
||||||
|
|
||||||
|
function must_get_env() {
|
||||||
|
declare -n VAR_NAME="$1"
|
||||||
|
if [[ -n "${VAR_NAME}" ]]; then
|
||||||
|
echo "${VAR_NAME}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo -e "${RED}No required env variable:${RST} ${BLD}${!VAR_NAME}${RST}" 1>&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
config=''
|
config=''
|
||||||
config+="status-im.build-type=\"${BUILD_TYPE}\";"
|
|
||||||
if [ -n "${STATUS_GO_SRC_OVERRIDE}" ]; then
|
if [ -n "${STATUS_GO_SRC_OVERRIDE}" ]; then
|
||||||
config+="status-im.status-go.src-override=\"${STATUS_GO_SRC_OVERRIDE}\";"
|
config+="status-im.status-go.src-override=\"${STATUS_GO_SRC_OVERRIDE}\";"
|
||||||
fi
|
fi
|
||||||
if [ -n "${NIMBUS_SRC_OVERRIDE}" ]; then
|
if [ -n "${NIMBUS_SRC_OVERRIDE}" ]; then
|
||||||
config+="status-im.nimbus.src-override=\"${NIMBUS_SRC_OVERRIDE}\";"
|
config+="status-im.nimbus.src-override=\"${NIMBUS_SRC_OVERRIDE}\";"
|
||||||
fi
|
fi
|
||||||
config+="status-im.status-react.build-number=\"${BUILD_NUMBER}\";"
|
config+="status-im.build-type=\"$(must_get_env BUILD_TYPE)\";"
|
||||||
config+="status-im.status-react.keystore-file=\"${KEYSTORE_FILE}\";"
|
config+="status-im.status-react.build-number=\"$(must_get_env BUILD_NUMBER)\";"
|
||||||
|
config+="status-im.status-react.keystore-file=\"$(must_get_env KEYSTORE_PATH)\";"
|
||||||
nixOpts=(
|
nixOpts=(
|
||||||
"--arg config {${config}}"
|
"--arg config {${config}}"
|
||||||
"--arg env {BUILD_ENV=\"${BUILD_ENV}\";ANDROID_ABI_SPLIT=\"${ANDROID_ABI_SPLIT}\";ANDROID_ABI_INCLUDE=\"${ANDROID_ABI_INCLUDE}\";}"
|
"--arg env {BUILD_ENV=\"${BUILD_ENV}\";ANDROID_ABI_SPLIT=\"${ANDROID_ABI_SPLIT}\";ANDROID_ABI_INCLUDE=\"${ANDROID_ABI_INCLUDE}\";}"
|
||||||
|
@ -24,11 +38,11 @@ if [[ "$OS" =~ Darwin ]]; then
|
||||||
WATCHMAN_SOCKFILE=$(watchman get-sockname --no-pretty | jq -r .sockname)
|
WATCHMAN_SOCKFILE=$(watchman get-sockname --no-pretty | jq -r .sockname)
|
||||||
nixOpts+=(
|
nixOpts+=(
|
||||||
"--argstr watchmanSockPath ${WATCHMAN_SOCKFILE}"
|
"--argstr watchmanSockPath ${WATCHMAN_SOCKFILE}"
|
||||||
"--option extra-sandbox-paths ${KEYSTORE_FILE};${WATCHMAN_SOCKFILE}"
|
"--option extra-sandbox-paths ${KEYSTORE_PATH};${WATCHMAN_SOCKFILE}"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
nixOpts+=(
|
nixOpts+=(
|
||||||
"--option extra-sandbox-paths ${KEYSTORE_FILE}"
|
"--option extra-sandbox-paths ${KEYSTORE_PATH}"
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
RED='\033[0;31m'
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||||
GREEN='\033[0;32m'
|
source "${GIT_ROOT}/scripts/colors.sh"
|
||||||
YELLOW='\033[1;33m'
|
|
||||||
NC='\033[0m'
|
|
||||||
|
|
||||||
METRO_PORT=8081
|
METRO_PORT=8081
|
||||||
METRO_PID="$(lsof -i :${METRO_PORT} | awk 'NR!=1 {print $2}' | sort -u | tr '\r\n' ' ')"
|
METRO_PID="$(lsof -i :${METRO_PORT} | awk 'NR!=1 {print $2}' | sort -u | tr '\r\n' ' ')"
|
||||||
if [ ! -z "$METRO_PID" ]; then
|
if [ ! -z "$METRO_PID" ]; then
|
||||||
echo -e "${YELLOW}TCP port ${METRO_PORT} is required by the Metro packager.\nThe following processes currently have the port open, preventing Metro from starting:${NC}"
|
echo -e "${YLW}TCP port ${METRO_PORT} is required by the Metro packager.\nThe following processes currently have the port open, preventing Metro from starting:${RST}"
|
||||||
ps -fp $METRO_PID
|
ps -fp $METRO_PID
|
||||||
echo -e "${YELLOW}Do you want to terminate them (y/n)?${NC}"
|
echo -e "${YLW}Do you want to terminate them (y/n)?${RST}"
|
||||||
read -n 1 term
|
read -n 1 term
|
||||||
[[ $term == 'y' ]] && kill $METRO_PID
|
[[ $term == 'y' ]] && kill $METRO_PID
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue