react-native-bspatch 3.1.2 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/android/build.gradle +18 -40
- package/android/src/main/java/vn/reactnativebspatch/BsPatchModule.kt +148 -13
- package/android/src/main/java/vn/reactnativebspatch/OtaBundleResolver.kt +21 -3
- package/cpp/CMakeLists.txt +0 -3
- package/cpp/bsdiff/bspatch_wrapper.c +3 -2
- package/ios/OtaBundleResolver.swift +22 -5
- package/ios/RNBsPatch.mm +220 -32
- package/lib/commonjs/NativeBsPatch.js.map +1 -1
- package/lib/commonjs/index.js +1 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ota/OtaProvider.js +21 -21
- package/lib/commonjs/ota/OtaProvider.js.map +1 -1
- package/lib/commonjs/ota/otaCore.js +50 -88
- package/lib/commonjs/ota/otaCore.js.map +1 -1
- package/lib/commonjs/ota/otaMetadata.js +46 -23
- package/lib/commonjs/ota/otaMetadata.js.map +1 -1
- package/lib/commonjs/ota/storage/GitHubRawStorage.js +22 -12
- package/lib/commonjs/ota/storage/GitHubRawStorage.js.map +1 -1
- package/lib/module/NativeBsPatch.js.map +1 -1
- package/lib/module/index.js +0 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/ota/OtaProvider.js +22 -22
- package/lib/module/ota/OtaProvider.js.map +1 -1
- package/lib/module/ota/otaCore.js +50 -87
- package/lib/module/ota/otaCore.js.map +1 -1
- package/lib/module/ota/otaMetadata.js +44 -21
- package/lib/module/ota/otaMetadata.js.map +1 -1
- package/lib/module/ota/storage/GitHubRawStorage.js +20 -10
- package/lib/module/ota/storage/GitHubRawStorage.js.map +1 -1
- package/lib/typescript/NativeBsPatch.d.ts +36 -1
- package/lib/typescript/NativeBsPatch.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +0 -7
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/ota/OtaProvider.d.ts.map +1 -1
- package/lib/typescript/ota/otaCore.d.ts +2 -1
- package/lib/typescript/ota/otaCore.d.ts.map +1 -1
- package/lib/typescript/ota/otaMetadata.d.ts +5 -0
- package/lib/typescript/ota/otaMetadata.d.ts.map +1 -1
- package/lib/typescript/ota/storage/GitHubRawStorage.d.ts +2 -0
- package/lib/typescript/ota/storage/GitHubRawStorage.d.ts.map +1 -1
- package/package.json +2 -3
- package/react-native-bspatch.podspec +3 -25
- package/src/NativeBsPatch.ts +44 -1
- package/src/index.ts +0 -7
- package/src/ota/OtaProvider.tsx +37 -23
- package/src/ota/otaCore.ts +55 -94
- package/src/ota/otaMetadata.ts +44 -25
- package/src/ota/storage/GitHubRawStorage.ts +17 -22
- package/tools/build_ota.sh +18 -4
- package/tools/upload_ota.sh +3 -2
- package/ios/RNBsPatch.h +0 -8
package/tools/build_ota.sh
CHANGED
|
@@ -239,6 +239,20 @@ step_done() {
|
|
|
239
239
|
step_line "$1 ${DIM}· $((SECONDS - STEP_START))s${RESET}"; printf "\n"
|
|
240
240
|
}
|
|
241
241
|
step_fail() { if [ -t 1 ]; then printf "\n"; fi; } # leave the step line before error output
|
|
242
|
+
# run_logged LOG cmd… — run cmd with output to LOG; in a terminal, tick elapsed time + the log's last line
|
|
243
|
+
run_logged() {
|
|
244
|
+
local LOG="$1"; shift
|
|
245
|
+
"$@" > "$LOG" 2>&1 &
|
|
246
|
+
local PID=$!
|
|
247
|
+
if [ -t 1 ]; then
|
|
248
|
+
while kill -0 "$PID" 2>/dev/null; do
|
|
249
|
+
local LAST=$(tail -n 1 "$LOG" 2>/dev/null | tr -d '\r\033' | cut -c1-50)
|
|
250
|
+
step_progress "$((SECONDS - STEP_START))s${LAST:+ · $LAST}"
|
|
251
|
+
sleep 1
|
|
252
|
+
done
|
|
253
|
+
fi
|
|
254
|
+
wait "$PID"
|
|
255
|
+
}
|
|
242
256
|
export -f human_size file_size
|
|
243
257
|
|
|
244
258
|
# ── Release version (native app version the OTA targets) ─────────────────────
|
|
@@ -320,7 +334,7 @@ if [ "$ACTION" = "reset" ]; then
|
|
|
320
334
|
fi
|
|
321
335
|
|
|
322
336
|
# ── Ensure bsdiff compiled ───────────────────────────────────────────────────
|
|
323
|
-
if [ ! -f "$BSDIFF" ]; then
|
|
337
|
+
if [ ! -f "$BSDIFF" ] || [ "$SCRIPT_DIR/bsdiff.c" -nt "$BSDIFF" ]; then
|
|
324
338
|
clang -O2 -D BSDIFF_EXECUTABLE -o "$BSDIFF" "$SCRIPT_DIR/bsdiff.c" -lbz2
|
|
325
339
|
info bsdiff "compiled"
|
|
326
340
|
fi
|
|
@@ -369,14 +383,14 @@ build_platform() {
|
|
|
369
383
|
if [ "$PLATFORM" == "android" ]; then
|
|
370
384
|
step "Bundle JS"
|
|
371
385
|
# Gradle's config noise goes to a log; shown only on failure
|
|
372
|
-
if !
|
|
386
|
+
if ! run_logged "$BUILD_LOG" bash -c 'cd "$1/android" && ./gradlew ":app:createBundle${2}ReleaseJsAndAssets" -Pkotlin.incremental=false --quiet' _ "$ROOT" "$FLAVOR_CAP"; then
|
|
373
387
|
step_fail; tail -n 40 "$BUILD_LOG"; echo " ❌ Gradle bundle failed (full log: $BUILD_LOG)"; exit 1
|
|
374
388
|
fi
|
|
375
389
|
BUNDLE_SOURCE="$ROOT/android/app/build/generated/assets/react/${FLAVOR_LOWER}Release/index.android.bundle"
|
|
376
390
|
else
|
|
377
391
|
step "Bundle JS"
|
|
378
|
-
if ! npx react-native bundle --platform ios --dev false --entry-file index.js \
|
|
379
|
-
--bundle-output "$WORKSPACE/source.bundle" --assets-dest "$OUTPUT/assets"
|
|
392
|
+
if ! run_logged "$BUILD_LOG" npx react-native bundle --platform ios --dev false --entry-file index.js \
|
|
393
|
+
--bundle-output "$WORKSPACE/source.bundle" --assets-dest "$OUTPUT/assets"; then
|
|
380
394
|
step_fail; tail -n 40 "$BUILD_LOG"; echo " ❌ Bundle failed (full log: $BUILD_LOG)"; exit 1
|
|
381
395
|
fi
|
|
382
396
|
BUNDLE_SOURCE="$WORKSPACE/source.bundle"
|
package/tools/upload_ota.sh
CHANGED
|
@@ -207,8 +207,9 @@ fi
|
|
|
207
207
|
|
|
208
208
|
# 3. Commit and Push to GitHub
|
|
209
209
|
cd "$GH_REPO_DIR"
|
|
210
|
-
|
|
211
|
-
git config user.
|
|
210
|
+
# Fallback identity only where none is configured (e.g. CI); never override the user's
|
|
211
|
+
git config user.name >/dev/null || git config user.name "react-native-bspatch"
|
|
212
|
+
git config user.email >/dev/null || git config user.email "react-native-bspatch@users.noreply.github.com"
|
|
212
213
|
git add .
|
|
213
214
|
if git diff --staged --quiet; then
|
|
214
215
|
echo " ✓ Storage repository is up to date (no changes)."
|