cleanup of shell scripts
Changes: - Add missing lazy assignment for OS_NAME, fixes double Nix shells - Moved `scripts/add-nix-gcroots.sh` to `nix/scripts/gcroots.sh` - Moved Nix package manager setup to `nix/scripts/setup.sh` - Created `nix/scripts/source.sh` to reuse in all Nix scripts - Created `STARTING_GUIDE.md` with instructions for contributors - Created `scripts/colors.sh` for definition of shell colors - Removed `scripts/setup` in favor of `nix/scripts/setup.sh` - Removed all of `scripts/lib` since it was useless Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
eb1cc65a3d
commit
46bd2b2e4c
8
Makefile
8
Makefile
|
@ -55,7 +55,7 @@ export _NIX_ROOT = /opt/nix
|
|||
endif
|
||||
|
||||
# Useful for checking if we are on NixOS
|
||||
OS_NAME = $(shell grep -oP '^NAME=\K\w(.*)' /etc/os-release)
|
||||
OS_NAME ?= $(shell source /etc/os-release && echo $${NAME})
|
||||
|
||||
#----------------
|
||||
# Nix targets
|
||||
|
@ -91,7 +91,7 @@ endif
|
|||
|
||||
nix-add-gcroots: export TARGET := default
|
||||
nix-add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected
|
||||
scripts/add-nix-gcroots.sh
|
||||
nix/scripts/gcroots.sh
|
||||
|
||||
nix-update-gradle: ##@nix Update maven nix expressions based on current gradle setup
|
||||
nix/mobile/android/maven-and-npm-deps/maven/generate-nix.sh
|
||||
|
@ -160,8 +160,8 @@ release: release-android release-ios ##@build build release for Android and iOS
|
|||
release-android: export TARGET ?= android
|
||||
release-android: export BUILD_ENV ?= prod
|
||||
release-android: export BUILD_TYPE ?= nightly
|
||||
release-android: export BUILD_NUMBER ?= 9999
|
||||
release-android: export STORE_FILE ?= $(HOME)/.gradle/status-im.keystore
|
||||
release-android: export BUILD_NUMBER ?= $(shell ./scripts/version/gen_build_no.sh | cut -c1-10)
|
||||
release-android: export KEYSTORE_FILE ?= $(HOME)/.gradle/status-im.keystore
|
||||
release-android: export ANDROID_ABI_SPLIT ?= false
|
||||
release-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86
|
||||
release-android: ##@build build release for Android
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
# Description
|
||||
|
||||
This document provides information on how to start developing Status App.
|
||||
|
||||
# Getting Started
|
||||
|
||||
To start developing start a shell for platform you are interested in.
|
||||
```
|
||||
make shell TARGET=android
|
||||
```
|
||||
This step will take a while the first time as it will download all dependencies.
|
||||
|
||||
To build the app, your can simply run on of the following:
|
||||
```
|
||||
make release-android
|
||||
make release-ios
|
||||
```
|
||||
For more `make` targets run `make help`.
|
||||
|
||||
# Manual Steps
|
||||
|
||||
There are a few manual steps you might want to do in order to start contributing.
|
||||
|
||||
## Genymotion Virtualization
|
||||
|
||||
Optionally set up Genymotion if you don't want to use Android Virtual Device:
|
||||
|
||||
https://www.genymotion.com
|
||||
|
||||
## Android Development Environment
|
||||
|
||||
You can also setup Android Development Environment + Simulator:
|
||||
|
||||
https://facebook.github.io/react-native/docs/getting-started.html
|
||||
|
||||
## Configure GitHub Account
|
||||
|
||||
The optimal way of pushing to GitHubis using SSH instead of user/pass auth.
|
||||
|
||||
It's recommented that you [add your public SSH key to your GitHub account](https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account).
|
||||
|
||||
## Configure GPG Keys for signing commits
|
||||
|
||||
In order to increase security we require all commits in `status-react` repo to be signed with a GPG key.
|
||||
|
||||
Steps:
|
||||
1. [Generate a new GPG key](https://help.github.com/en/github/authenticating-to-github/generating-a-new-gpg-key)
|
||||
2. [Setup Git to use your GPG key](https://help.github.com/en/github/authenticating-to-github/telling-git-about-your-signing-key)
|
||||
3. [Setup Git to sign commits](https://help.github.com/en/github/authenticating-to-github/signing-commits)
|
||||
4. [Setup GitHub to validate commits](https://help.github.com/en/github/authenticating-to-github/adding-a-new-gpg-key-to-your-github-account)
|
|
@ -106,3 +106,11 @@ If copying from Nix Cache times out you can adjust the timeout by changing [`nix
|
|||
```conf
|
||||
stalled-download-timeout = 9001
|
||||
```
|
||||
|
||||
### `extra-sandbox-paths` Is a Restricted Setting
|
||||
|
||||
When building Android on NixOS you might encounter the following error:
|
||||
```
|
||||
ignoring the user-specified setting 'extra-sandbox-paths', because it is a restricted setting and you are not a trusted user
|
||||
```
|
||||
You can mitigate this by setting the [`nix.trustedUsers`](https://nixos.org/nixos/options.html#nix.trustedusers) property.
|
||||
|
|
|
@ -4,6 +4,8 @@ set -e
|
|||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
resultPath="${GIT_ROOT}/result/"
|
||||
source "${GIT_ROOT}/scripts/colors.sh"
|
||||
source "${GIT_ROOT}/nix/scripts/source.sh"
|
||||
|
||||
# cleanup for artifacts created during builds
|
||||
function cleanup() {
|
||||
|
@ -11,12 +13,12 @@ function cleanup() {
|
|||
trap - EXIT ERR INT QUIT
|
||||
# do the actual cleanup, ignore failure
|
||||
if ${GIT_ROOT}/nix/scripts/clean.sh "${nixResultPath}"; then
|
||||
echo "Successful cleanup!"
|
||||
echo -e "${GRN}Successful cleanup!${RST}"
|
||||
elif [[ -n "${JENKINS_URL}" ]]; then
|
||||
# in CI removing some paths can fail due to parallel builds
|
||||
echo "Ignoring cleanup failure in CI."
|
||||
echo -e "${YLW}Ignoring cleanup failure in CI.${RST}"
|
||||
else
|
||||
echo "Failed cleanup!"
|
||||
echo -e "${RED}Failed cleanup!${RST}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
@ -32,14 +34,11 @@ function extractResults() {
|
|||
ls -l "${resultPath}"
|
||||
}
|
||||
|
||||
# Load Nix profile
|
||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||
|
||||
targetAttr="${1}"
|
||||
shift
|
||||
|
||||
if [[ -z "${targetAttr}" ]]; then
|
||||
echo "First argument is mandatory and has to specify the Nix attribute!"
|
||||
echo -e "${RED}First argument is mandatory and has to specify the Nix attribute!${RST}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -68,4 +67,4 @@ nixResultPath=$(nix-build ${nixOpts[@]})
|
|||
echo "Extracting result: ${nixResultPath}"
|
||||
extractResults "${nixResultPath}"
|
||||
|
||||
echo "SUCCESS"
|
||||
echo -e "${GRN}SUCCESS${RST}"
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
set -e
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
source "${GIT_ROOT}/nix/scripts/source.sh"
|
||||
|
||||
function log() { echo "$@" 1>&2; }
|
||||
|
||||
# helpers for getting related paths in Nix store
|
||||
|
@ -93,4 +96,4 @@ fi
|
|||
toDelete=$(printf '%s\n' "${toDelete[@]}" | sort | uniq)
|
||||
|
||||
log "Deleting..."
|
||||
nix-store --ignore-liveness --delete ${toDelete[@]}
|
||||
nix-store --delete ${toDelete[@]}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -z "${IN_NIX_SHELL}" ]]; then
|
||||
echo "Remember to call 'make shell'!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -Eeu
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
source "${GIT_ROOT}/nix/scripts/source.sh"
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
|
||||
rm -rf .nix-gcroots
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
source "${GIT_ROOT}/scripts/colors.sh"
|
||||
|
||||
NIX_VERSION="2.3.2"
|
||||
NIX_INSTALL_URL="https://nixos.org/releases/nix/nix-${NIX_VERSION}/install"
|
||||
|
||||
function install_nix() {
|
||||
# Don't break people's profiles
|
||||
export NIX_INSTALLER_NO_MODIFY_PROFILE=1
|
||||
# Fix for installing on MacOS Catalina
|
||||
export NIX_IGNORE_SYMLINK_STORE=1
|
||||
bash <(curl "${NIX_INSTALL_URL}") --no-daemon
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GRN}The Nix package manager was successfully installed.${RST}"
|
||||
else
|
||||
echo -e "${RED}Failed to install Nix package manager!${RST}" > /dev/stderr
|
||||
echo "Please see: https://nixos.org/nix/manual/#chap-installation" > /dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ ! -x "$(command -v git)" ]]; then
|
||||
echo -e "${RED}The 'curl' utility is required for Nix installation.${RST}" > /dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$(uname -v)" == *NixOS* ]]; then
|
||||
echo -e "${GRN}Already running NixOS.${RST}"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ -x "$(command -v nix)" ]]; then
|
||||
echo -e "${GRN}Nix package manager already installed.${RST}"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ "${IN_NIX_SHELL}" == 'pure' ]]; then
|
||||
echo -e "${GRN}Already in a pure Nix shell.${RST}"
|
||||
exit
|
||||
fi
|
||||
|
||||
# If none of the checks before succeeded we need to install Nix
|
||||
echo -e "${GRN}Setting up Nix package manager...${RST}"
|
||||
install_nix
|
||||
echo -e "${YLW}See STARTING_GUIDE.md if you're new here.${RST}"
|
|
@ -11,29 +11,13 @@
|
|||
# Take note that this makes Nix tools like `nix-build` unavailable in the shell.
|
||||
# - _NIX_KEEP: This variable allows specifying which env vars to keep for Nix pure shell.
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
source "${GIT_ROOT}/scripts/colors.sh"
|
||||
source "${GIT_ROOT}/nix/scripts/source.sh"
|
||||
|
||||
export TERM=xterm # fix for colors
|
||||
shift # we remove the first -c from arguments
|
||||
|
||||
if ! command -v "nix" >/dev/null 2>&1; then
|
||||
if [ -f ~/.nix-profile/etc/profile.d/nix.sh ]; then
|
||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||
elif [ "$IN_NIX_SHELL" != 'pure' ]; then
|
||||
echo -e "${GREEN}Setting up environment...${NC}" > /dev/stderr
|
||||
./scripts/setup
|
||||
|
||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
if !command -v "nix" >/dev/null 2>&1; then
|
||||
echo "Nix not available, sourcing profile failed!" > /dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shellArgs=(
|
||||
"--show-trace"
|
||||
)
|
||||
|
@ -41,7 +25,7 @@ shellArgs=(
|
|||
if [[ -n "${TARGET}" ]]; then
|
||||
shellArgs+=("--argstr target ${TARGET}")
|
||||
else
|
||||
echo -e "${YELLOW}Env is missing TARGET, assuming default target.${NC} See nix/README.md for more details." 1>&2
|
||||
echo -e "${YLW}Env is missing TARGET, assuming default target.${RST} See nix/README.md for more details." 1>&2
|
||||
fi
|
||||
|
||||
if [[ "$TARGET" =~ (linux|windows|darwin|macos) ]]; then
|
||||
|
@ -74,7 +58,7 @@ fi
|
|||
# ENTER_NIX_SHELL is the fake command used when `make shell` is run.
|
||||
# It is just a special string, not a variable, and a marker to not use `--run`.
|
||||
if [[ $@ == "ENTER_NIX_SHELL" ]]; then
|
||||
echo -e "${GREEN}Configuring ${_NIX_ATTR:-default} Nix shell for target '${TARGET:-default}'...${NC}" 1>&2
|
||||
echo -e "${GRN}Configuring ${_NIX_ATTR:-default} Nix shell for target '${TARGET:-default}'...${RST}" 1>&2
|
||||
exec nix-shell ${shellArgs[@]} ${entryPoint}
|
||||
else
|
||||
# Not all builds are ready to be run in a pure environment
|
||||
|
@ -87,6 +71,6 @@ else
|
|||
if [[ -n "${_NIX_KEEP}" ]]; then
|
||||
shellArgs+=("--keep ${_NIX_KEEP//;/ --keep }")
|
||||
fi
|
||||
echo -e "${GREEN}Configuring ${pureDesc}${_NIX_ATTR:-default} Nix shell for target '${TARGET}'...${NC}" 1>&2
|
||||
echo -e "${GRN}Configuring ${pureDesc}${_NIX_ATTR:-default} Nix shell for target '${TARGET}'...${RST}" 1>&2
|
||||
exec nix-shell ${shellArgs[@]} --run "$@" ${entryPoint}
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script makes sure we have Nix tools available
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
|
||||
function source_nix() {
|
||||
# Just stop if Nix is already available
|
||||
if [[ -x $(command -v nix) ]]; then
|
||||
return
|
||||
elif [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]]; then
|
||||
# Load Nix profile if it exists
|
||||
source "${HOME}/.nix-profile/etc/profile.d/nix.sh"
|
||||
else
|
||||
# Setup Nix if not available
|
||||
${GIT_ROOT}/nix/scripts/setup.sh
|
||||
fi
|
||||
|
||||
# Verify Nix is available
|
||||
if [[ ! -x $(command -v nix) ]]; then
|
||||
echo "Nix not available, sourcing profile failed!" > /dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
source_nix
|
|
@ -67,7 +67,7 @@ function init() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if is_linux; then
|
||||
if [[ "$OS" =~ Linux ]]; then
|
||||
rm -rf ./desktop/toolchain/
|
||||
# TODO: Use Conan for Linux and MacOS builds too
|
||||
if is_windows_target; then
|
||||
|
@ -267,7 +267,7 @@ function bundleLinux() {
|
|||
echo ""
|
||||
}
|
||||
|
||||
if is_macos; then
|
||||
if [[ "$OS" =~ Darwin ]]; then
|
||||
function copyDylibNixDependenciesToPackage() {
|
||||
local dylib="$1"
|
||||
local contentsDir="$2"
|
||||
|
@ -441,9 +441,9 @@ function bundleMacOS() {
|
|||
}
|
||||
|
||||
function bundle() {
|
||||
if is_macos; then
|
||||
if [[ "$OS" =~ Darwin ]]; then
|
||||
bundleMacOS
|
||||
elif is_linux; then
|
||||
elif [[ "$OS" =~ Linux ]]; then
|
||||
if is_windows_target; then
|
||||
bundleWindows
|
||||
else
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Colors
|
||||
YLW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
GRN='\033[0;32m'
|
||||
RST='\033[0m'
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
filename=$1
|
||||
#fileid="1yPTGcPe5DZd3ubzAgUBp3aAQRAOK9eKQ"
|
||||
fileid=$2
|
||||
rm -rf ./cookie
|
||||
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null
|
||||
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" -o ${filename}
|
|
@ -2,22 +2,45 @@
|
|||
|
||||
set -euf pipefail
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
source "${GIT_ROOT}/scripts/colors.sh"
|
||||
|
||||
function property() {
|
||||
grep "${2}" "${1}" | cut -d'=' -f2
|
||||
}
|
||||
|
||||
function property_gradle() {
|
||||
property ${GIT_ROOT}/android/gradle.properties ${1}
|
||||
}
|
||||
|
||||
TARGET=${1:-debug}
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
. "$CURRENT_DIR/lib/setup/path-support.sh"
|
||||
source_lib "properties.sh"
|
||||
|
||||
STORE_FILE=$(property_gradle 'STATUS_RELEASE_STORE_FILE')
|
||||
STORE_FILE="${STORE_FILE/#\~/$HOME}"
|
||||
CURRENT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
KEYSTORE_FILE=$(property_gradle 'STATUS_RELEASE_STORE_FILE')
|
||||
KEYSTORE_FILE=${KEYSTORE_FILE/#\~/$HOME}
|
||||
STATUS_RELEASE_STORE_PASSWORD=$(property_gradle 'STATUS_RELEASE_STORE_PASSWORD')
|
||||
STATUS_RELEASE_KEY_ALIAS=$(property_gradle 'STATUS_RELEASE_KEY_ALIAS')
|
||||
STATUS_RELEASE_KEY_PASSWORD=$(property_gradle 'STATUS_RELEASE_KEY_PASSWORD')
|
||||
|
||||
[[ -e "$STORE_FILE" ]] && exit 0
|
||||
if [[ -e "${KEYSTORE_FILE}" ]]; then
|
||||
echo -e "${YLW}Keystore file already exists:${RST} ${KEYSTORE_FILE}" > /dev/stderr
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Generating keystore $STORE_FILE"
|
||||
keydirname="$( dirname "$STORE_FILE" )"
|
||||
[ -d $keydirname ] || mkdir -p $keydirname
|
||||
keytool -genkey -v -keystore ${STORE_FILE} -keyalg RSA -keysize 2048 -validity 10000 -alias ${STATUS_RELEASE_KEY_ALIAS} \
|
||||
-storepass ${STATUS_RELEASE_STORE_PASSWORD} -keypass ${STATUS_RELEASE_KEY_PASSWORD} -dname "CN=, OU=, O=, L=, S=, C="
|
||||
KEYSTORE_DIR=$(dirname "${KEYSTORE_FILE}")
|
||||
[[ -d $KEYSTORE_DIR ]] || mkdir -p $KEYSTORE_DIR
|
||||
|
||||
echo "Generating keystore ${KEYSTORE_FILE}" > /dev/stderr
|
||||
|
||||
keytool -genkey -v \
|
||||
-keyalg RSA \
|
||||
-keysize 2048 \
|
||||
-validity 10000 \
|
||||
-dname "CN=, OU=, O=, L=, S=, C="
|
||||
-keystore "${KEYSTORE_FILE}" \
|
||||
-alias "${STATUS_RELEASE_KEY_ALIAS}" \
|
||||
-storepass "${STATUS_RELEASE_STORE_PASSWORD}" \
|
||||
-keypass "${STATUS_RELEASE_KEY_PASSWORD}" \
|
||||
> /dev/stderr
|
||||
|
||||
echo "${KEYSTORE_FILE}"
|
||||
|
|
|
@ -3,21 +3,20 @@
|
|||
# If this is not run on some machines react-native builds fail.
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
source "$GIT_ROOT/scripts/lib/setup/path-support.sh"
|
||||
source "${GIT_ROOT}/scripts/colors.sh"
|
||||
|
||||
source_lib "output.sh"
|
||||
source_lib "platform.sh"
|
||||
|
||||
if ! is_linux; then
|
||||
if [[ "$(uname -s)" != Linux ]]; then
|
||||
echo "inotify fix not applicable on non-linux OS"
|
||||
return
|
||||
exit
|
||||
fi
|
||||
|
||||
watches=$(cat /proc/sys/fs/inotify/max_user_watches)
|
||||
required_watches=524288
|
||||
|
||||
if [ $watches -lt $required_watches ]; then
|
||||
cecho "@b@cyan[[fs.inotify.max_user_watches limit is too low ($watches), increasing it]]"
|
||||
echo fs.inotify.max_user_watches=$required_watches | sudo tee -a /etc/sysctl.conf
|
||||
echo -e "${YLW}fs.inotify.max_user_watches limit is too low ($watches). Increasing it.${RST}"
|
||||
echo "fs.inotify.max_user_watches = $required_watches" | sudo tee -a /etc/sysctl.conf
|
||||
sudo sysctl -p
|
||||
else
|
||||
echo -e "${GRN}fs.inotify.max_user_watches limit is high enough.${RST}"
|
||||
fi
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function load_color_support() {
|
||||
# Check if we're in a terminal
|
||||
if test -t 1; then
|
||||
local color_count=$(tput colors)
|
||||
|
||||
# Only load colors if our terminal supports them
|
||||
if test -n "$color_count" && test $color_count -ge 8; then
|
||||
_color_bold="$(tput bold)"
|
||||
_color_underline="$(tput sgr 0 1)"
|
||||
_color_red="$(tput setaf 1)"
|
||||
_color_green="$(tput setaf 2)"
|
||||
_color_yellow="$(tput setaf 3)"
|
||||
_color_blue="$(tput setaf 4)"
|
||||
_color_magenta="$(tput setaf 5)"
|
||||
_color_cyan="$(tput setaf 6)"
|
||||
_color_white="$(tput setaf 7)"
|
||||
_color_reset="$(tput sgr0)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
load_color_support
|
||||
|
||||
function cecho() {
|
||||
local colorized=$(
|
||||
echo "$@" | sed -E \
|
||||
-e 's/((@(red|green|yellow|blue|magenta|cyan|white|reset|b|u))+)[[]{2}(.*)[]]{2}/\1\4@reset/g' \
|
||||
-e "s/@red/${_color_red}/g" \
|
||||
-e "s/@green/${_color_green}/g" \
|
||||
-e "s/@yellow/${_color_yellow}/g" \
|
||||
-e "s/@blue/${_color_blue}/g" \
|
||||
-e "s/@magenta/${_color_magenta}/g" \
|
||||
-e "s/@cyan/${_color_cyan}/g" \
|
||||
-e "s/@white/${_color_white}/g" \
|
||||
-e "s/@reset/${_color_reset}/g" \
|
||||
-e "s/@b/${_color_bold}/g" \
|
||||
-e "s/@u/${_color_underline}/g"
|
||||
)
|
||||
|
||||
echo "$colorized"
|
||||
}
|
||||
|
||||
function setup_header() {
|
||||
local header=$1
|
||||
|
||||
cecho "@b@green[[$header]]"
|
||||
echo
|
||||
}
|
||||
|
||||
function already_installed() {
|
||||
local package=$1
|
||||
|
||||
cecho "+ $package already installed... skipping"
|
||||
}
|
||||
|
||||
function setup_complete() {
|
||||
cecho "@b@blue[[Setup complete!]]
|
||||
===============
|
||||
|
||||
There are a few @b[[manual steps]] you might want to do:
|
||||
|
||||
1. Optionally set up Genymotion if you don't want to use Android Virtual Device:
|
||||
|
||||
@blue[[https://www.genymotion.com]]
|
||||
|
||||
2. Setup Android Development Environment + Simulator:
|
||||
|
||||
@blue[[https://facebook.github.io/react-native/docs/getting-started.html]]
|
||||
|
||||
3. Add your SSH public key to Github if it isn't already in there.
|
||||
|
||||
To build the app, please run one of the @b[[make release-*]] commands.
|
||||
"
|
||||
|
||||
echo
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
########
|
||||
# Install checks
|
||||
########
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
|
||||
function program_exists() {
|
||||
local program=$1
|
||||
command -v "$program" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
function program_version_exists() {
|
||||
local program=$1
|
||||
if ! program_exists "$program"; then
|
||||
$(exit 1)
|
||||
return
|
||||
fi
|
||||
|
||||
local required_version=$2
|
||||
if echo "$($program --version)" | grep -q -wo "$required_version\|$required_version[^\.]"; then
|
||||
$(exit 0)
|
||||
return
|
||||
fi
|
||||
$(exit 1)
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
_current_dir=$(cd "${BASH_SOURCE%/*}" && pwd)
|
||||
_scripts_dir=$(cd "$_current_dir/../.." && pwd)
|
||||
_repo_dir=$(cd "$_scripts_dir/.." && pwd)
|
||||
|
||||
function scripts_path() {
|
||||
echo $_scripts_dir
|
||||
}
|
||||
|
||||
function repo_path() {
|
||||
echo $_repo_dir
|
||||
}
|
||||
|
||||
function source_lib() {
|
||||
local library_path=$1
|
||||
|
||||
source "$_current_dir/$library_path"
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
OS=$(uname -s)
|
||||
|
||||
function is_macos() {
|
||||
[[ "$OS" =~ Darwin ]]
|
||||
}
|
||||
|
||||
function is_linux() {
|
||||
[[ "$OS" =~ Linux ]]
|
||||
}
|
||||
|
||||
function is_nixos() {
|
||||
is_linux && [[ "$(uname -v)" == *NixOS* ]]
|
||||
}
|
||||
|
||||
function exit_unless_os_supported() {
|
||||
if [ "$IN_NIX_SHELL" == 'pure' ]; then
|
||||
cecho "@red[[This install script is not supported in a pure Nix shell]]"
|
||||
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! is_macos && ! is_linux; then
|
||||
cecho "@red[[This install script currently supports Mac OS X and Linux \
|
||||
via apt. To manually install, please visit the docs for more information:]]
|
||||
|
||||
@blue[[https://status.im/build_status]]"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function property() {
|
||||
grep "${2}" ${1}|cut -d'=' -f2
|
||||
}
|
||||
|
||||
function property_gradle() {
|
||||
property $(repo_path)/android/gradle.properties ${1}
|
||||
}
|
|
@ -1,10 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
_current_dir=$(cd "${BASH_SOURCE%/*}" && pwd)
|
||||
source "$_current_dir/lib/setup/path-support.sh"
|
||||
|
||||
source_lib "platform.sh"
|
||||
|
||||
config=''
|
||||
config+="status-im.build-type=\"${BUILD_TYPE}\";"
|
||||
|
@ -15,23 +11,24 @@ if [ -n "${NIMBUS_SRC_OVERRIDE}" ]; then
|
|||
config+="status-im.nimbus.src-override=\"${NIMBUS_SRC_OVERRIDE}\";"
|
||||
fi
|
||||
config+="status-im.status-react.build-number=\"${BUILD_NUMBER}\";"
|
||||
config+="status-im.status-react.keystore-file=\"${STORE_FILE}\";"
|
||||
config+="status-im.status-react.keystore-file=\"${KEYSTORE_FILE}\";"
|
||||
nixOpts=(
|
||||
"--arg config {${config}}"
|
||||
"--arg env {BUILD_ENV=\"${BUILD_ENV}\";ANDROID_ABI_SPLIT=\"${ANDROID_ABI_SPLIT}\";ANDROID_ABI_INCLUDE=\"${ANDROID_ABI_INCLUDE}\";}"
|
||||
)
|
||||
|
||||
if is_macos; then
|
||||
if [[ "$OS" =~ Darwin ]]; then
|
||||
# Start a watchman instance if not started already and store its socket path.
|
||||
# In order to get access to the right versions of watchman and jq, we start an ad-hoc nix-shell that imports the packages from nix/nixpkgs-bootstrap.
|
||||
# In order to get access to the right versions of watchman and jq,
|
||||
# we start an ad-hoc nix-shell that imports the packages from nix/nixpkgs-bootstrap.
|
||||
WATCHMAN_SOCKFILE=$(watchman get-sockname --no-pretty | jq -r .sockname)
|
||||
nixOpts+=(
|
||||
"--argstr watchmanSockPath ${WATCHMAN_SOCKFILE}"
|
||||
"--option extra-sandbox-paths ${STORE_FILE};${WATCHMAN_SOCKFILE}"
|
||||
"--option extra-sandbox-paths ${KEYSTORE_FILE};${WATCHMAN_SOCKFILE}"
|
||||
)
|
||||
else
|
||||
nixOpts+=(
|
||||
"--option extra-sandbox-paths ${STORE_FILE}"
|
||||
"--option extra-sandbox-paths ${KEYSTORE_FILE}"
|
||||
)
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
########################################################################
|
||||
# This install script will setup your development dependencies on OS X
|
||||
# or Ubuntu. Ubuntu 18.04 is the only tested version.
|
||||
# It is not required or supported in NixOS.
|
||||
#
|
||||
# Usage: scripts/setup
|
||||
########################################################################
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
source "$GIT_ROOT/scripts/lib/setup/path-support.sh"
|
||||
|
||||
source_lib "output.sh"
|
||||
source_lib "packages.sh"
|
||||
source_lib "platform.sh"
|
||||
|
||||
exit_unless_os_supported
|
||||
|
||||
####
|
||||
setup_header "Checking prerequisites..."
|
||||
|
||||
_need_curl=0
|
||||
! is_nixos && ! program_exists nix && _need_curl=1
|
||||
|
||||
if [ $_need_curl -eq 1 ] && ! program_exists "curl"; then
|
||||
cecho "@b@yellow[[Please install curl before running setup.]]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# bump max watches limit to avoid issues with RN builds
|
||||
$GIT_ROOT/scripts/inotify_fix.sh
|
||||
|
||||
####
|
||||
setup_header "Installing requirements..."
|
||||
|
||||
if [ "$IN_NIX_SHELL" != 'pure' ] && ! is_nixos && ! program_exists nix; then
|
||||
required_version="2.3.2"
|
||||
NIX_INSTALLER_NO_MODIFY_PROFILE=1 NIX_IGNORE_SYMLINK_STORE=1 bash <(curl https://nixos.org/releases/nix/nix-${required_version}/install) --no-daemon
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${YELLOW}**********************************************************************************************************"
|
||||
echo "The Nix package manager was successfully installed."
|
||||
echo -e "**********************************************************************************************************${NC}"
|
||||
else
|
||||
echo "Please see https://nixos.org/nix/manual/#chap-installation"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
####
|
||||
setup_complete
|
Loading…
Reference in New Issue