1#!/bin/bash -e 2 3# Copyright 2023 Google LLC 4# 5# Use of this source code is governed by a BSD-style license that can be 6# found in the LICENSE file. 7 8# Write the SKIA_VERSION to a JavaScript file. 9 10if [ "$1" == "" ] 11then 12 echo "Must supply output version.js file path." >&2 13 exit 1 14fi 15 16GIT="git" 17if test -f "/cipd/bin/git"; then 18 # The `cd` Docker image includes git at this location. If present use it. 19 # This image us used when building this target via Louhi. 20 GIT="/cipd/bin/git" 21fi 22 23SCRIPT_DIR=$(dirname $(realpath $0)) 24VERSION_JS_PATH=$1 25GIT_REVISION=$($GIT -C ${SCRIPT_DIR} rev-parse HEAD) 26OUTPUT_DIR=$(dirname ${VERSION_JS_PATH}) 27 28mkdir -p $(dirname ${VERSION_JS_PATH}) 29echo "const SKIA_VERSION = '${GIT_REVISION}';" > ${VERSION_JS_PATH} 30