summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Duong <joshuaduong@google.com>2024-03-19 08:45:54 -0700
committerJoshua Duong <joshuaduong@google.com>2024-03-19 08:45:54 -0700
commit990cdfaedb8fd35c7ab421f7c97f298227238ffb (patch)
tree9987073a9059eb059ba8415ee4cb3da002d27dbc
parenta306e1dff48b4c6ad6b6ea906feacad646fc211e (diff)
downloadsystem-images-990cdfaedb8fd35c7ab421f7c97f298227238ffb.tar.gz
Add script to grab emulator prebuilts.
Bug: 325468469 Test: ./update-emu-prebuilts.sh <build_number> Change-Id: I805fbc504fa308a76f948858c3caec53452fc054
-rwxr-xr-xupdate-emu-prebuilts.sh90
1 files changed, 90 insertions, 0 deletions
diff --git a/update-emu-prebuilts.sh b/update-emu-prebuilts.sh
new file mode 100755
index 00000000..8141118c
--- /dev/null
+++ b/update-emu-prebuilts.sh
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+DRY_RUN=
+function run() {
+ if [ -z "$DRY_RUN" ]; then
+ echo "RUN: $@"
+ $@
+ else
+ echo "DRY_RUN: $@"
+ fi
+}
+
+function print_help() {
+ echo -e "\nUsage: update-emu-prebuilts.sh [--dry-run] BUILD_NUMBER"
+ echo -e "\nArguments:"
+ echo " BUILD_NUMBER: The build number from an emulator branch."
+ echo " --dry-run: Dump all commands, but don't execute them."
+}
+
+PROGDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+OS_TYPES="linux windows darwin darwin_aarch64"
+BUILD_NUMBER=
+
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ -h|--help)
+ print_help
+ exit 0
+ ;;
+ --dry-run)
+ DRY_RUN=$1
+ shift
+ ;;
+ *)
+ BUILD_NUMBER=$1
+ shift
+ ;;
+ esac
+done
+
+if [ -z "$BUILD_NUMBER" ]; then
+ echo "ERROR: No build number provided."
+ print_help
+ exit 1
+fi
+
+run rm -rf "$PROGDIR/linux/emulators/*"
+run rm -rf "$PROGDIR/windows/emulators/*"
+run rm -rf "$PROGDIR/darwin/emulators/*"
+
+#/google/data/ro/projects/android/fetch_artifact --bid 11525734 --target emulator-linux_x64_gfxstream 'sdk-repo-linux-emulator-11525734.zip'
+for os_type in $OS_TYPES; do
+ echo "**** Updating $os_type emulator prebuilts to $BUILD_NUMBER..."
+ zip_name="sdk-repo-$os_type-emulator-$BUILD_NUMBER.zip"
+
+ emu_dir=
+ dst_zip_name=
+ case $os_type in
+ darwin_aarch64)
+ emu_dir=$PROGDIR/darwin/emulators/$BUILD_NUMBER
+ dst_zip_name="emulator-$os_type-$BUILD_NUMBER.zip"
+ ;;
+ *)
+ emu_dir=$PROGDIR/$os_type/emulators/$BUILD_NUMBER
+ dst_zip_name="emulator-${os_type}_x64-$BUILD_NUMBER.zip"
+ ;;
+ esac
+
+ target=
+ case $os_type in
+ linux)
+ ;&
+ windows)
+ target="emulator-${os_type}_x64_gfxstream"
+ ;;
+ darwin)
+ target="emulator-mac_x64_gfxstream"
+ ;;
+ darwin_aarch64)
+ target="emulator-mac_aarch64_gfxstream"
+ ;;
+ esac
+
+ run mkdir $emu_dir
+ run cd $emu_dir
+ run /google/data/ro/projects/android/fetch_artifact --bid $BUILD_NUMBER --target $target "$zip_name"
+ run mv "$zip_name" "$dst_zip_name"
+ echo "**** Update done $os_type emulator prebuilts to $BUILD_NUMBER"
+done
+echo "Finished emulator prebuilts update to build $BUILD_NUMBER"