1#!/bin/bash 2set -e 3 4# This script pulls the given ksp version and deletes the old one. 5# It is not a solid script so use with care. It does not check what your 6# current local status is and instead just creates a new branch and 7# fetches prebuilts while also updating the version in androidX. 8 9# move to support dir 10cd "$(dirname $0)/../.." 11 12function usage { 13 echo "error: $1" 14 echo "usage: ./update_ksp.sh <version> <local branch name>" 15 echo "e.g. ./update_ksp.sh 1.4.32-1.0.0-alpha07 ksp-alpha07" 16 exit 1 17} 18 19REPO=$(which repo) 20if [ -z "$REPO" ]; then 21 usage "cannot find repo" 22fi 23 24KSP_VERSION=$1 25if [ -z "$KSP_VERSION" ]; then 26 usage "must pass ksp version" 27fi 28if [ -z "$2" ]; then 29 echo "a" 30 BRANCH_NAME=$KSP_VERSION 31else 32 BRANCH_NAME=$2 33fi 34 35echo "$KSP_VERSION / $BRANCH_NAME" 36 37# create branch 38repo abandon $BRANCH_NAME . platform/prebuilts/androidx/external 2> /dev/null || true 39repo start $BRANCH_NAME . platform/prebuilts/androidx/external 40 41# other projects depend on ksp prebuilts so we don't delete them anymore. 42 43# download 44development/importMaven/importMaven.sh com.google.devtools.ksp:symbol-processing-gradle-plugin:$KSP_VERSION 45development/importMaven/importMaven.sh com.google.devtools.ksp:symbol-processing:$KSP_VERSION 46 47# update build version 48sed -i '' "s/ksp = \".*\"/ksp = \"$KSP_VERSION\"/" gradle/libs.versions.toml 49 50echo "done"