aboutsummaryrefslogtreecommitdiff
path: root/scripts/fetch-vendor
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/fetch-vendor')
-rwxr-xr-xscripts/fetch-vendor44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/fetch-vendor b/scripts/fetch-vendor
new file mode 100755
index 0000000..4c73381
--- /dev/null
+++ b/scripts/fetch-vendor
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Pull pinned vendor sources via git subtree. Idempotent.
+#
+# Usage:
+# scripts/fetch-vendor # add or update to pinned tag, verify SHA
+#
+# Bump:
+# 1. Pick a new tag from https://github.com/MuntashirAkon/libadb-android
+# 2. git ls-remote https://github.com/MuntashirAkon/libadb-android.git \
+# refs/tags/<tag>
+# → copy the commit hex.
+# 3. Update LIBADB_TAG and LIBADB_SHA below.
+# 4. Run this script.
+# 5. Re-prune. This repo keeps only the libadb module plus license files
+# (vendor/libadb-android/{libadb,LICENSES,COPYING,README.md,
+# SERVICES.md}); the rest of upstream - sample app, gradle wrapper,
+# jitpack.yml - is unused. A subtree pull re-adds it; delete it again.
+
+set -eu
+
+LIBADB_REPO='https://github.com/MuntashirAkon/libadb-android.git'
+LIBADB_TAG='3.1.1'
+LIBADB_SHA='c849886ebc6d48e7b46d967e78a6bb65c90c3b74'
+LIBADB_PREFIX='vendor/libadb-android'
+
+cd "$(git rev-parse --show-toplevel)"
+
+# Tags can be re-pointed upstream; cross-check against the pinned commit.
+remote_sha=$(git ls-remote "$LIBADB_REPO" "refs/tags/$LIBADB_TAG" | awk '{print $1}')
+if [ "$remote_sha" != "$LIBADB_SHA" ]; then
+ echo "fetch-vendor: refs/tags/$LIBADB_TAG points at $remote_sha," >&2
+ echo " expected $LIBADB_SHA. Refusing to pull." >&2
+ exit 1
+fi
+
+if [ ! -d "$LIBADB_PREFIX" ]; then
+ echo "fetch-vendor: adding $LIBADB_PREFIX @ $LIBADB_TAG ($LIBADB_SHA)"
+ git subtree add --prefix="$LIBADB_PREFIX" "$LIBADB_REPO" "$LIBADB_TAG" --squash
+else
+ echo "fetch-vendor: pulling $LIBADB_PREFIX @ $LIBADB_TAG ($LIBADB_SHA)"
+ git subtree pull --prefix="$LIBADB_PREFIX" "$LIBADB_REPO" "$LIBADB_TAG" --squash
+fi
+
+echo "fetch-vendor: ok"