Skip to content

Commit f833209

Browse files
committed
rn build script
1 parent 84b6a7a commit f833209

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ If you have `bitkit-e2e-tests`, `bitkit-android`, and `bitkit-ios` checked out i
5656
# Android (builds ../bitkit-android and copies APK to ./aut/bitkit_e2e.apk)
5757
./scripts/build-android-apk.sh
5858

59+
# Legacy RN Android (builds ../bitkit and copies APK to ./aut/bitkit_rn_regtest.apk)
60+
./scripts/build-rn-android-apk.sh
61+
5962
# iOS (builds ../bitkit-ios and copies IPA to ./aut/bitkit_e2e.ipa)
6063
./scripts/build-ios-sim.sh
6164
```
@@ -67,6 +70,9 @@ Optional backend selection (`BACKEND=local` is default and can be omitted):
6770
BACKEND=local ./scripts/build-android-apk.sh
6871
BACKEND=regtest ./scripts/build-android-apk.sh
6972

73+
# Legacy RN Android
74+
BACKEND=regtest ./scripts/build-rn-android-apk.sh
75+
7076
# iOS
7177
BACKEND=local ./scripts/build-ios-sim.sh
7278
BACKEND=regtest ./scripts/build-ios-sim.sh

scripts/build-rn-android-apk.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/env bash
2+
# Build the legacy Bitkit RN Android APK from ../bitkit and copy into aut/
3+
#
4+
# Inputs/roots:
5+
# - E2E root: this repo (bitkit-e2e-tests)
6+
# - RN root: ../bitkit (resolved relative to this script)
7+
#
8+
# Output:
9+
# - Copies APK -> aut/bitkit_rn_<backend>.apk
10+
#
11+
# Usage:
12+
# ./scripts/build-rn-android-apk.sh [debug|release]
13+
# BACKEND=regtest ./scripts/build-rn-android-apk.sh
14+
# ENV_FILE=.env.test.template ./scripts/build-rn-android-apk.sh
15+
set -euo pipefail
16+
17+
E2E_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
18+
RN_ROOT="$(cd "$E2E_ROOT/../bitkit" && pwd)"
19+
20+
BUILD_TYPE="${1:-debug}"
21+
BACKEND="${BACKEND:-regtest}"
22+
23+
if [[ "$BUILD_TYPE" != "debug" && "$BUILD_TYPE" != "release" ]]; then
24+
echo "ERROR: Unsupported build type: $BUILD_TYPE (expected debug|release)" >&2
25+
exit 1
26+
fi
27+
28+
if [[ -z "${ENV_FILE:-}" ]]; then
29+
if [[ "$BACKEND" == "regtest" ]]; then
30+
ENV_FILE=".env.test.template"
31+
else
32+
ENV_FILE=".env.development"
33+
fi
34+
fi
35+
36+
if [[ ! -f "$RN_ROOT/$ENV_FILE" ]]; then
37+
echo "ERROR: Env file not found: $RN_ROOT/$ENV_FILE" >&2
38+
exit 1
39+
fi
40+
41+
echo "Building RN Android APK (BACKEND=$BACKEND, ENV_FILE=$ENV_FILE, BUILD_TYPE=$BUILD_TYPE)..."
42+
43+
pushd "$RN_ROOT" >/dev/null
44+
if [[ -f .env ]]; then
45+
cp .env .env.bak
46+
fi
47+
cp "$ENV_FILE" .env
48+
E2E_TESTS=true yarn "e2e:build:android-$BUILD_TYPE"
49+
if [[ -f .env.bak ]]; then
50+
mv .env.bak .env
51+
else
52+
rm -f .env
53+
fi
54+
popd >/dev/null
55+
56+
APK_PATH="$RN_ROOT/android/app/build/outputs/apk/$BUILD_TYPE/app-universal-$BUILD_TYPE.apk"
57+
if [[ ! -f "$APK_PATH" ]]; then
58+
ALT_APK_PATH="$RN_ROOT/android/app/build/outputs/apk/$BUILD_TYPE/app-$BUILD_TYPE.apk"
59+
if [[ -f "$ALT_APK_PATH" ]]; then
60+
APK_PATH="$ALT_APK_PATH"
61+
else
62+
echo "ERROR: APK not found at: $APK_PATH" >&2
63+
exit 1
64+
fi
65+
fi
66+
67+
OUT="$E2E_ROOT/aut"
68+
mkdir -p "$OUT"
69+
OUT_APK="$OUT/bitkit_rn_${BACKEND}.apk"
70+
cp -f "$APK_PATH" "$OUT_APK"
71+
echo "RN APK copied to: $OUT_APK (from $(basename "$APK_PATH"))"

0 commit comments

Comments
 (0)