1
0
mirror of git://f0xx.org/ac/ac-scripts synced 2026-08-09 20:59:09 +03:00

Fix isolated builder: standalone mobile clone for Docker git checkout.

Submodule gitfile paths break when only ac-mobile-android is mounted as
/workspace; clone the mobile repo directly instead of submodule init.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-08-09 18:58:24 +02:00
parent 242f73d37a
commit 5a7b0c91d8
2 changed files with 36 additions and 8 deletions

View File

@@ -33,11 +33,22 @@ echo "==> Phase: init build_id=${BUILD_ID} channel=${OTA_CHANNEL}"
if [[ -n "${GIT_REF:-}" ]]; then if [[ -n "${GIT_REF:-}" ]]; then
echo "==> Phase: git checkout ${GIT_REF}" echo "==> Phase: git checkout ${GIT_REF}"
current_head="$(git rev-parse HEAD 2>/dev/null || echo "")"
target_head=""
if [[ -n "${GIT_SHA:-}" ]]; then
target_head="$(git rev-parse "${GIT_SHA}" 2>/dev/null || echo "")"
else
target_head="$(git rev-parse "${GIT_REF}" 2>/dev/null || echo "")"
fi
if [[ -n "$current_head" && -n "$target_head" && "$current_head" == "$target_head" ]]; then
echo "==> already at ${current_head:0:12}"
else
git fetch --all --tags 2>/dev/null || true git fetch --all --tags 2>/dev/null || true
git checkout --force "$GIT_REF" git checkout --force "$GIT_REF"
if [[ -n "${GIT_SHA:-}" ]]; then if [[ -n "${GIT_SHA:-}" ]]; then
git reset --hard "$GIT_SHA" git reset --hard "$GIT_SHA"
fi fi
fi
fi fi
export ANDROIDCAST_ROOT="$ROOT" export ANDROIDCAST_ROOT="$ROOT"

View File

@@ -179,14 +179,31 @@ stage_ci_scripts() {
done done
} }
init_mobile_submodule_only() { init_mobile_standalone() {
local base="$1" local base="$1"
local ref="${GIT_REF:-next}"
if [[ ! -d "${base}/.git" ]]; then if [[ ! -d "${base}/.git" ]]; then
return 0 return 0
fi fi
if git -C "$base" config -f .gitmodules --get "submodule.${MOBILE_SUBDIR}.path" >/dev/null 2>&1; then local url path
log "[runner] isolate: init workspace submodule ${MOBILE_SUBDIR} (no third-party recurse)" url="$(git -C "$base" config -f .gitmodules --get "submodule.${MOBILE_SUBDIR}.url" 2>/dev/null || true)"
run_step git-submodule-mobile git -c safe.directory="${base}" -C "${base}" submodule update --init "${MOBILE_SUBDIR}" path="$(git -C "$base" config -f .gitmodules --get "submodule.${MOBILE_SUBDIR}.path" 2>/dev/null || true)"
if [[ -z "$url" || -z "$path" ]]; then
return 0
fi
log "[runner] isolate: standalone clone ${path} for docker mount (avoid gitfile ../.git/modules)"
rm -rf "${base}/${path}"
if [[ -n "${GIT_SHA:-}" ]]; then
run_step git-clone-mobile git clone --depth "${CLONE_DEPTH}" "$url" "${base}/${path}"
run_step git-fetch-mobile git -c safe.directory="${base}/${path}" -C "${base}/${path}" fetch --depth "${CLONE_DEPTH}" origin "${GIT_SHA}"
run_step git-checkout-mobile git -c safe.directory="${base}/${path}" -C "${base}/${path}" checkout "${GIT_SHA}"
elif git clone --depth "${CLONE_DEPTH}" --single-branch --branch "${ref}" "$url" "${base}/${path}" 2>/dev/null; then
:
else
run_step git-clone-mobile git clone --depth "${CLONE_DEPTH}" "$url" "${base}/${path}"
run_step git-fetch-mobile git -c safe.directory="${base}/${path}" -C "${base}/${path}" fetch --depth "${CLONE_DEPTH}" origin "${ref}"
run_step git-checkout-mobile git -c safe.directory="${base}/${path}" -C "${base}/${path}" checkout "${ref}"
fi fi
} }
@@ -218,7 +235,7 @@ prepare_isolated_source() {
run_step git-pin git -c safe.directory="${SOURCE_DIR}" -C "${SOURCE_DIR}" checkout "${GIT_SHA}" run_step git-pin git -c safe.directory="${SOURCE_DIR}" -C "${SOURCE_DIR}" checkout "${GIT_SHA}"
fi fi
init_mobile_submodule_only "${SOURCE_DIR}" init_mobile_standalone "${SOURCE_DIR}"
local host_tree iso_tree local host_tree iso_tree
host_tree="$(host_mobile_tree)" host_tree="$(host_mobile_tree)"