Colin Cross | 0e53b9d | 2021-08-24 17:11:51 -0700 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | |
| 3 | # 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 | |
| 17 | if [ -z $1 ]; then |
| 18 | echo "usage: $0 <build number>" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | readonly BUILD_NUMBER=$1 |
| 23 | |
| 24 | cd "$(dirname $0)" |
| 25 | |
| 26 | if ! git diff HEAD --quiet; then |
| 27 | echo "must be run with a clean prebuilts/build-tools project" |
| 28 | exit 1 |
| 29 | fi |
| 30 | |
| 31 | readonly tmpdir=$(mktemp -d) |
| 32 | |
| 33 | function finish { |
| 34 | if [ ! -z "${tmpdir}" ]; then |
| 35 | rm -rf "${tmpdir}" |
| 36 | fi |
| 37 | } |
| 38 | trap finish EXIT |
| 39 | |
| 40 | function fetch_artifact() { |
| 41 | /google/data/ro/projects/android/fetch_artifact --bid ${BUILD_NUMBER} --target $1 "$2" "$3" |
| 42 | } |
| 43 | |
| 44 | fetch_artifact studio-linux artifacts/commandlinetools_linux.zip "${tmpdir}/commandlinetools_linux.zip" |
| 45 | fetch_artifact studio-linux artifacts/lint-tests.jar "${tmpdir}/lint-tests.jar" |
| 46 | fetch_artifact studio-linux manifest_${BUILD_NUMBER}.xml "${tmpdir}/manifest.xml" |
| 47 | |
| 48 | function unzip_to() { |
| 49 | rm -rf "$1" |
| 50 | mkdir "$1" |
| 51 | unzip -qDD -d "$1" "$2" |
| 52 | } |
| 53 | |
| 54 | rm -rf tools |
| 55 | unzip -q "${tmpdir}/commandlinetools_linux.zip" |
| 56 | mv cmdline-tools tools |
| 57 | |
| 58 | cp -f "${tmpdir}/lint-tests.jar" lint-tests.jar |
| 59 | cp -f "${tmpdir}/manifest.xml" manifest.xml |
| 60 | |
| 61 | patch -p1 < patches/bin-lint.patch |
| 62 | |
| 63 | git add tools lint-tests.jar manifest.xml |
| 64 | git commit -m "Update cmdline-tools to ab/${BUILD_NUMBER} |
| 65 | |
| 66 | https://ci.android.com/builds/submitted/${BUILD_NUMBER}/studio-linux/latest |
| 67 | |
| 68 | Test: treehugger" |