blob: d07ff14c76b0cdce1bd1188436d9ecb7bd7e06d5 [file]
#
# Copyright 2026 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
OS=$(uname -a | awk '{print $1}')
if [ "$OS" != "Linux" ]; then
echo "This script must be run on cloudtop"
fi
# Instructions for how to update the build id can be found here: go/androidx/playbook#update-aswb
NEW_ASWB_BUILD_ID=${1:-"16488178"}
function sedInPlace() {
TEMP_FILE=".sedOutput.tmp"
sed "$1" $2 > $TEMP_FILE
cat $TEMP_FILE > $2
rm $TEMP_FILE
}
echo "Updating ASwB"
CURRENT_ASWB_BUILD_ID=`sed -n "s/^aswbBuildId = \"\([^\"]*\)\"/\1/p" gradle/libs.versions.toml`
source development/check_gcloud_permissions.sh
if [ "$CURRENT_ASWB_BUILD_ID" == "$NEW_ASWB_BUILD_ID" ]; then
echo "No change in ASwB build id - update not occurring"
else
echo "Updating ASwB build id from '$CURRENT_ASWB_BUILD_ID' to '$NEW_ASWB_BUILD_ID'"
echo "checking whether gcert was run"
source gbash.sh || exit 1
# if the user doesn't have permission to upload to GCS, we don't want to proceed with downloading
# artifacts.
checkGcloudPermissions || exit 1
# make a temp directory
mkdir tmp-aswb-install && cd tmp-aswb-install
ASWB_FULL_VERSION_LINUX=$(rapture showpkg :android-studio-with-blaze-canary | grep "Version:" | grep "$NEW_ASWB_BUILD_ID" | awk '{print $2}' | head -n 1)
ASWB_FULL_VERSION_MAC=$(rapture -u=corp-mule showpkg :android-studio-with-blaze-canary | grep "Version:" | grep "$NEW_ASWB_BUILD_ID" | awk '{print $2}' | head -n 1)
# download the package from rapture
rapture download :android-studio-with-blaze-canary=$ASWB_FULL_VERSION_LINUX
rapture -u=corp-mule download :android-studio-with-blaze-canary=${ASWB_FULL_VERSION_MAC}
# rename. This is for use by the ASWB task
mv *.deb android-studio-with-blaze-canary-$NEW_ASWB_BUILD_ID.deb
mv *.burrito android-studio-with-blaze-canary-$NEW_ASWB_BUILD_ID.burrito
# upload to gcs
gcloud storage cp android-studio-with-blaze-canary-$NEW_ASWB_BUILD_ID.deb "gs://androidx-aswb-binaries/glinux"
gcloud storage cp android-studio-with-blaze-canary-$NEW_ASWB_BUILD_ID.burrito "gs://androidx-aswb-binaries/mac"
cd .. && rm -rf tmp-aswb-install
# update the version in libs.versions.toml
sedInPlace "s/aswbBuildId = \".*/aswbBuildId = \"$NEW_ASWB_BUILD_ID\"/g" gradle/libs.versions.toml
echo "Update completed, please raise a CL with the change in libs.versions.toml"
fi