use nix for debug android builds
This commit is contained in:
parent
3fbf361cc3
commit
1803fda3ab
2
Makefile
2
Makefile
|
@ -268,7 +268,7 @@ run-re-frisk: ##@run Start re-frisk server
|
|||
# TODO: Migrate this to a Nix recipe, much the same way as nix/mobile/android/targets/release-android.nix
|
||||
run-android: export TARGET := android
|
||||
run-android: ##@run Build Android APK and start it on the device
|
||||
npx react-native run-android --appIdSuffix debug
|
||||
@scripts/run-android.sh
|
||||
|
||||
SIMULATOR=
|
||||
run-ios: export TARGET := ios
|
||||
|
|
|
@ -75,7 +75,7 @@ pipeline {
|
|||
steps { script {
|
||||
/* build/fetch things required to build jsbundle and android */
|
||||
nix.build(
|
||||
attr: 'targets.mobile.android.release.buildInputs',
|
||||
attr: 'targets.mobile.android.build.buildInputs',
|
||||
sandbox: false,
|
||||
pure: false,
|
||||
link: false
|
||||
|
|
|
@ -6,7 +6,7 @@ This directory contains the tools and the data that allows Nix to manage Gradle
|
|||
|
||||
Simply calling `generate.sh` should result in a `deps.json` file which is used in the derivation that provides Gradle dependencies when building the Android app.
|
||||
|
||||
You can see in [`nix/mobile/android/release.nix`](../../mobile/android/release.nix) that it's used via the `-Dmaven.repo.local='${deps.gradle}'` Gradle flag.
|
||||
You can see in [`nix/mobile/android/release.nix`](../../mobile/android/build.nix) that it's used via the `-Dmaven.repo.local='${deps.gradle}'` Gradle flag.
|
||||
|
||||
# Files
|
||||
|
||||
|
|
|
@ -28,7 +28,10 @@ let
|
|||
else ".env";
|
||||
|
||||
# There are only two types of Gradle build targets: pr and release
|
||||
gradleBuildType = if buildType == "pr" then "Pr" else "Release";
|
||||
gradleBuildType =
|
||||
if buildType == "pr" then "Pr"
|
||||
else if buildType == "debug" then "Debug"
|
||||
else "Release";
|
||||
|
||||
apksPath = "./android/app/build/outputs/apk/${toLower gradleBuildType}";
|
||||
|
||||
|
@ -138,7 +141,7 @@ in stdenv.mkDerivation rec {
|
|||
|| exit 1
|
||||
popd > /dev/null
|
||||
'';
|
||||
doCheck = true;
|
||||
doCheck = buildType != debug;
|
||||
checkPhase = ''
|
||||
ls ${apksPath}/*.apk \
|
||||
| xargs -n1 ${pkgs.unzip}/bin/unzip -qql \
|
|
@ -5,10 +5,10 @@ let
|
|||
# Import a jsbundle compiled out of clojure codebase
|
||||
jsbundle = callPackage ./jsbundle { };
|
||||
|
||||
release = callPackage ./release.nix { inherit jsbundle status-go; };
|
||||
build = callPackage ./build.nix { inherit jsbundle status-go; };
|
||||
in {
|
||||
# TARGETS
|
||||
inherit release jsbundle;
|
||||
inherit build jsbundle;
|
||||
|
||||
shell = mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
|
@ -19,7 +19,7 @@ in {
|
|||
];
|
||||
|
||||
inputsFrom = [
|
||||
release
|
||||
build
|
||||
androidShell
|
||||
];
|
||||
|
||||
|
|
|
@ -62,4 +62,4 @@ fi
|
|||
|
||||
nixOpts+=("--arg" "config" "{${config}}")
|
||||
|
||||
"${GIT_ROOT}/nix/scripts/build.sh" targets.mobile.android.release "${nixOpts[@]}"
|
||||
"${GIT_ROOT}/nix/scripts/build.sh" targets.mobile.android.build "${nixOpts[@]}"
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
ADB_INSTALL_LOG_FILE="${GIT_ROOT}/logs/adb_install.log"
|
||||
ADB_SHELL_MONKEY_LOG_FILE="${GIT_ROOT}/logs/adb_shell_monkey.log"
|
||||
|
||||
Generate android debug build.
|
||||
export BUILD_ENV=debug
|
||||
export BUILD_TYPE=debug
|
||||
export BUILD_NUMBER=99999
|
||||
export ANDROID_ABI_SPLIT=false
|
||||
export ANDROID_ABI_INCLUDE="armeabi-v7a;arm64-v8a;x86;x86_64"
|
||||
"${GIT_ROOT}/scripts/build-android.sh"
|
||||
|
||||
Install the APK on running emulator or android device.
|
||||
installAndLaunchApp() {
|
||||
adb install -r ./result/app-debug.apk > "${ADB_INSTALL_LOG_FILE}" 2>&1
|
||||
"${GIT_ROOT}/scripts/wait-for-metro-port.sh" 2>&1
|
||||
# connected android devices need this port to be exposed for metro
|
||||
adb reverse "tcp:8081" "tcp:8081"
|
||||
adb shell monkey -p im.status.ethereum.debug 1 > "${ADB_SHELL_MONKEY_LOG_FILE}" 2>&1
|
||||
}
|
||||
|
||||
showAdbLogs() {
|
||||
cat "${ADB_INSTALL_LOG_FILE}" >&2;
|
||||
cat "${ADB_SHELL_MONKEY_LOG_FILE}" >&2;
|
||||
}
|
||||
|
||||
trap showAdbLogs EXIT ERR INT QUIT
|
||||
installAndLaunchApp &
|
||||
exec "${GIT_ROOT}/scripts/run-metro.sh" 2>&1
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
pkill -f 'react-native start'
|
||||
|
||||
react-native start --reset-cache
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
TIMEOUT=10 # Metro should not take this long to start.
|
||||
|
||||
while [ "${TIMEOUT}" -gt 0 ]; do
|
||||
if ! lsof -i:8081 &> /dev/null; then
|
||||
echo "."
|
||||
sleep 1
|
||||
((TIMEOUT--))
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue