summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2022-03-04 09:58:24 -0800
committerColin Cross <ccross@android.com>2022-03-04 10:08:31 -0800
commitc0c2f9aafb58af96eb137998c60643036b906ae8 (patch)
treeea7a206e60c1204fde3c4773bdf6efe33224f330
parenta57aff98a2d6b355b69286f049d4495e3e131cd4 (diff)
downloadjdk17-c0c2f9aafb58af96eb137998c60643036b906ae8.tar.gz
Add script to fetch OpenJDK 17 prebuilts
Bug: 219098645 Test: ./update.sh 8256334 Change-Id: I270e60576f606f543561ca2b8d48829a2ec2e361
-rwxr-xr-xupdate.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/update.sh b/update.sh
new file mode 100755
index 0000000..2e513a6
--- /dev/null
+++ b/update.sh
@@ -0,0 +1,52 @@
+#!/bin/bash -ev
+
+# Updates prebuilts/jdk/jdk17 from build server. (ab/openjdk)
+# Usage:
+# $ cd <REPO>
+# $ repo start jdk17_update prebuilts/jdk/jdk17
+# $ prebuilts/jdk/jdk17/update.sh <BUILD_NUMBER>
+# $ repo upload --cbr prebuilts/jdk/jdk17
+
+
+BUILD_NUMBER="${1:?Specify build number}"
+LINUX_ZIP=/tmp/$$.linux.zip
+#DARWIN_ZIP=/tmp/$$.darwin.zip
+
+FETCH_ARTIFACT=/google/data/ro/projects/android/fetch_artifact
+cd "$(dirname $0)"
+
+rm -rf staging
+mkdir -p staging
+
+$FETCH_ARTIFACT --bid ${BUILD_NUMBER} --disable_progressbar --target linux_openjdk17 jdk.zip ${LINUX_ZIP}
+#$FETCH_ARTIFACT --bid ${BUILD_NUMBER} --disable_progressbar --target darwin_mac_openjdk17 jdk.zip ${DARWIN_ZIP}
+$FETCH_ARTIFACT --bid ${BUILD_NUMBER} --disable_progressbar --target linux_openjdk17 manifest_${BUILD_NUMBER}.xml staging/manifest.xml
+
+rm -rf staging/linux-x86
+mkdir -p staging/linux-x86
+(cd staging/linux-x86; unzip -q ${LINUX_ZIP})
+touch staging/linux-x86/MODULE_LICENSE_GPL
+
+#rm -rf staging/darwin-x86
+#mkdir staging/darwin-x86
+#(cd staging/darwin-x86; unzip -q ${DARWIN_ZIP})
+#touch staging/darwin-x86/MODULE_LICENSE_GPL
+
+rm -f ${LINUX_ZIP} # ${DARWIN_ZIP}
+
+# Copy the RBE toolchain inputs files from the previous version to the staging
+# directory.
+cp linux-x86/bin/*_remote_toolchain_inputs staging/linux-x86/bin
+
+version=$(staging/linux-x86/bin/java -version 2>&1 | grep "OpenJDK Runtime Environment" | sed -e 's/.*(\(.*\))/\1/')
+
+# Commit to staging
+git add staging
+git commit -m "Add JDK ${version} to staging
+
+Test: none"
+
+git rm -rf linux-x86 manifest.xml # darwin-x86
+git mv staging/* .
+rmdir staging
+git commit -m "Switch to JDK $version" --edit