blob: 4f185665ee9fa7bc2fa2b3b630b3c5163044309b [file] [log] [blame]
Colin Cross4c808382019-11-13 11:16:07 -08001#!/bin/bash -e
2
Colin Cross9297fad2020-08-10 12:18:51 -07003# Copyright 2020 Google Inc. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
Colin Cross4c808382019-11-13 11:16:07 -080017if [ -z $1 ]; then
18 echo "usage: $0 <build number>"
19 exit 1
20fi
21
22readonly BUILD_NUMBER=$1
23
24cd "$(dirname $0)"
25
26if ! git diff HEAD --quiet; then
27 echo "must be run with a clean prebuilts/build-tools project"
28 exit 1
29fi
30
31readonly tmpdir=$(mktemp -d)
32
33function finish {
34 if [ ! -z "${tmpdir}" ]; then
35 rm -rf "${tmpdir}"
36 fi
37}
38trap finish EXIT
39
40function fetch_artifact() {
Dan Willemsen60a0c412020-04-30 21:46:50 -070041 /google/data/ro/projects/android/fetch_artifact --branch aosp-build-tools-release --bid ${BUILD_NUMBER} --target $1 "$2" "$3"
Colin Cross4c808382019-11-13 11:16:07 -080042}
43
44fetch_artifact linux build-prebuilts.zip "${tmpdir}/linux.zip"
45fetch_artifact linux build-common-prebuilts.zip "${tmpdir}/common.zip"
46fetch_artifact linux manifest_${BUILD_NUMBER}.xml "${tmpdir}/manifest.xml"
47fetch_artifact darwin_mac build-prebuilts.zip "${tmpdir}/darwin.zip"
Colin Cross316eb262022-03-08 10:50:38 -080048fetch_artifact linux_musl build-prebuilts.zip "${tmpdir}/linux_musl.zip"
Colin Cross32c89172022-02-08 16:39:31 -080049fetch_artifact linux_musl musl-sysroot32.zip "${tmpdir}/musl-sysroot32.zip"
50fetch_artifact linux_musl musl-sysroot64.zip "${tmpdir}/musl-sysroot64.zip"
Colin Cross4c808382019-11-13 11:16:07 -080051
52function unzip_to() {
53 rm -rf "$1"
54 mkdir "$1"
55 unzip -q -d "$1" "$2"
56}
57
58unzip_to linux-x86 "${tmpdir}/linux.zip"
59unzip_to common "${tmpdir}/common.zip"
60unzip_to darwin-x86 "${tmpdir}/darwin.zip"
Colin Cross316eb262022-03-08 10:50:38 -080061unzip_to linux_musl-x86 "${tmpdir}/linux_musl.zip"
Colin Cross4cd39c72022-02-15 17:18:29 -080062unzip_to sysroots/x86_64-linux-musl "${tmpdir}/musl-sysroot64.zip"
63unzip_to sysroots/i686-linux-musl "${tmpdir}/musl-sysroot32.zip"
Colin Cross4c808382019-11-13 11:16:07 -080064
65cp -f "${tmpdir}/manifest.xml" manifest.xml
66
Colin Cross316eb262022-03-08 10:50:38 -080067git add manifest.xml linux-x86 linux_musl-x86 darwin-x86 common sysroots/x86_64-linux-musl sysroots/i686-linux-musl
Colin Cross4c808382019-11-13 11:16:07 -080068git commit -m "Update build-tools to ab/${BUILD_NUMBER}
69
Dan Willemsen60a0c412020-04-30 21:46:50 -070070https://ci.android.com/builds/branches/aosp-build-tools-release/grid?head=${BUILD_NUMBER}&tail=${BUILD_NUMBER}
Colin Cross4c808382019-11-13 11:16:07 -080071
72Test: treehugger"