blob: 39911701a6653e3ab9bb20d7ad5d7b928537173b [file] [log] [blame]
Colin Cross4c808382019-11-13 11:16:07 -08001#!/bin/bash -e
2
3if [ -z $1 ]; then
4 echo "usage: $0 <build number>"
5 exit 1
6fi
7
8readonly BUILD_NUMBER=$1
9
10cd "$(dirname $0)"
11
12if ! git diff HEAD --quiet; then
13 echo "must be run with a clean prebuilts/build-tools project"
14 exit 1
15fi
16
17readonly tmpdir=$(mktemp -d)
18
19function finish {
20 if [ ! -z "${tmpdir}" ]; then
21 rm -rf "${tmpdir}"
22 fi
23}
24trap finish EXIT
25
26function fetch_artifact() {
27 /google/data/ro/projects/android/fetch_artifact --bid ${BUILD_NUMBER} --target $1 "$2" "$3"
28}
29
30fetch_artifact linux build-prebuilts.zip "${tmpdir}/linux.zip"
31fetch_artifact linux build-common-prebuilts.zip "${tmpdir}/common.zip"
32fetch_artifact linux manifest_${BUILD_NUMBER}.xml "${tmpdir}/manifest.xml"
33fetch_artifact darwin_mac build-prebuilts.zip "${tmpdir}/darwin.zip"
34
35function unzip_to() {
36 rm -rf "$1"
37 mkdir "$1"
38 unzip -q -d "$1" "$2"
39}
40
41unzip_to linux-x86 "${tmpdir}/linux.zip"
42unzip_to common "${tmpdir}/common.zip"
43unzip_to darwin-x86 "${tmpdir}/darwin.zip"
44
45cp -f "${tmpdir}/manifest.xml" manifest.xml
46
47git add manifest.xml linux-x86 darwin-x86 common
48git commit -m "Update build-tools to ab/${BUILD_NUMBER}
49
50https://ci.android.com/builds/branches/aosp-build-tools/grid?head=${BUILD_NUMBER}&tail=${BUILD_NUMBER}
51
52Test: treehugger"