1#!/bin/sh 2set -e 3# Shell script to update ada in the source tree to a specific version 4 5BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) 6DEPS_DIR="$BASE_DIR/deps" 7ADA_VERSION=$1 8 9# shellcheck disable=SC1091 10. "$BASE_DIR/tools/dep_updaters/utils.sh" 11 12if [ "$#" -le 0 ]; then 13 echo "Error: please provide an ada version to update to" 14 echo " e.g. $0 1.0.0" 15 exit 1 16fi 17 18echo "Making temporary workspace..." 19 20WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') 21 22cleanup () { 23 EXIT_CODE=$? 24 [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" 25 exit $EXIT_CODE 26} 27 28trap cleanup INT TERM EXIT 29 30ADA_REF="v$ADA_VERSION" 31ADA_ZIP="ada-$ADA_REF.zip" 32ADA_LICENSE="LICENSE-MIT" 33 34cd "$WORKSPACE" 35 36echo "Fetching ada source archive..." 37curl -sL -o "$ADA_ZIP" "https://github.com/ada-url/ada/releases/download/$ADA_REF/singleheader.zip" 38log_and_verify_sha256sum "ada" "$ADA_ZIP" 39unzip "$ADA_ZIP" 40rm "$ADA_ZIP" 41 42curl -sL -o "$ADA_LICENSE" "https://raw.githubusercontent.com/ada-url/ada/HEAD/LICENSE-MIT" 43 44echo "Replacing existing ada (except GYP build files)" 45mv "$DEPS_DIR/ada/"*.gyp "$DEPS_DIR/ada/README.md" "$WORKSPACE/" 46rm -rf "$DEPS_DIR/ada" 47mv "$WORKSPACE" "$DEPS_DIR/ada" 48 49echo "All done!" 50echo "" 51echo "Please git add ada, commit the new version:" 52echo "" 53echo "$ git add -A deps/ada" 54echo "$ git commit -m \"deps: update ada to $ADA_VERSION\"" 55echo "" 56