blob: 8e22104ebc66b610c6ea72f782c55a477cf7b0c1 [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>"
Elliott Hughes53e18ff2022-08-03 19:00:15 +000019 echo
20 echo "The build number should be from a *snap* [not a buildkick] of aosp-build-tools-release."
21 echo "https://android-build.googleplex.com/coastguard/branch/aosp-build-tools-release/#/request/"
Colin Cross4c808382019-11-13 11:16:07 -080022 exit 1
23fi
24
25readonly BUILD_NUMBER=$1
26
27cd "$(dirname $0)"
28
29if ! git diff HEAD --quiet; then
30 echo "must be run with a clean prebuilts/build-tools project"
31 exit 1
32fi
33
34readonly tmpdir=$(mktemp -d)
35
36function finish {
37 if [ ! -z "${tmpdir}" ]; then
38 rm -rf "${tmpdir}"
39 fi
40}
41trap finish EXIT
42
43function fetch_artifact() {
Dan Willemsen60a0c412020-04-30 21:46:50 -070044 /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 -080045}
46
47fetch_artifact linux build-prebuilts.zip "${tmpdir}/linux.zip"
48fetch_artifact linux build-common-prebuilts.zip "${tmpdir}/common.zip"
49fetch_artifact linux manifest_${BUILD_NUMBER}.xml "${tmpdir}/manifest.xml"
50fetch_artifact darwin_mac build-prebuilts.zip "${tmpdir}/darwin.zip"
Colin Cross316eb262022-03-08 10:50:38 -080051fetch_artifact linux_musl build-prebuilts.zip "${tmpdir}/linux_musl.zip"
Colin Cross6bfb8e42022-12-28 15:29:24 -080052fetch_artifact linux_musl build-arm64-prebuilts.zip "${tmpdir}/linux_musl_arm64.zip"
Colin Cross826735b2022-09-19 14:57:25 -070053fetch_artifact linux_musl musl-sysroot-i686-unknown-linux-musl.zip "${tmpdir}/musl-sysroot-i686-unknown-linux-musl.zip"
54fetch_artifact linux_musl musl-sysroot-x86_64-unknown-linux-musl.zip "${tmpdir}/musl-sysroot-x86_64-unknown-linux-musl.zip"
55fetch_artifact linux_musl musl-sysroot-aarch64-unknown-linux-musl.zip "${tmpdir}/musl-sysroot-aarch64-unknown-linux-musl.zip"
56fetch_artifact linux_musl musl-sysroot-arm-unknown-linux-musleabihf.zip "${tmpdir}/musl-sysroot-arm-unknown-linux-musleabihf.zip"
Colin Cross4c808382019-11-13 11:16:07 -080057
58function unzip_to() {
59 rm -rf "$1"
60 mkdir "$1"
Colin Crossbda417c2022-09-20 18:19:12 -070061 unzip -q -DD -d "$1" "$2"
Colin Cross4c808382019-11-13 11:16:07 -080062}
63
64unzip_to linux-x86 "${tmpdir}/linux.zip"
65unzip_to common "${tmpdir}/common.zip"
66unzip_to darwin-x86 "${tmpdir}/darwin.zip"
Colin Cross316eb262022-03-08 10:50:38 -080067unzip_to linux_musl-x86 "${tmpdir}/linux_musl.zip"
Colin Cross6bfb8e42022-12-28 15:29:24 -080068unzip_to linux_musl-arm64 "${tmpdir}/linux_musl_arm64.zip"
Colin Cross826735b2022-09-19 14:57:25 -070069unzip_to sysroots/x86_64-unknown-linux-musl "${tmpdir}/musl-sysroot-x86_64-unknown-linux-musl.zip"
70unzip_to sysroots/i686-unknown-linux-musl "${tmpdir}/musl-sysroot-i686-unknown-linux-musl.zip"
71unzip_to sysroots/aarch64-unknown-linux-musl "${tmpdir}/musl-sysroot-aarch64-unknown-linux-musl.zip"
Colin Cross13155a62022-09-20 13:44:07 -070072unzip_to sysroots/arm-unknown-linux-musleabihf "${tmpdir}/musl-sysroot-arm-unknown-linux-musleabihf.zip"
Colin Cross4c808382019-11-13 11:16:07 -080073
74cp -f "${tmpdir}/manifest.xml" manifest.xml
75
Colin Crossd537e992023-04-19 16:34:01 -070076git add manifest.xml linux-x86 linux_musl-arm64 linux_musl-x86 darwin-x86 common sysroots/x86_64-unknown-linux-musl sysroots/i686-unknown-linux-musl sysroots/aarch64-unknown-linux-musl sysroots/arm-unknown-linux-musleabihf
Colin Cross4c808382019-11-13 11:16:07 -080077git commit -m "Update build-tools to ab/${BUILD_NUMBER}
78
Dan Willemsen60a0c412020-04-30 21:46:50 -070079https://ci.android.com/builds/branches/aosp-build-tools-release/grid?head=${BUILD_NUMBER}&tail=${BUILD_NUMBER}
Colin Cross4c808382019-11-13 11:16:07 -080080
81Test: treehugger"