|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2019 The Nomulus Authors. All Rights Reserved. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +# This script should be invoked from the Gradle root. It downloads the |
| 17 | +# gradle distribution saved on GCS, and sets Gradle's distribution URL |
| 18 | +# to the local copy. This is necessary since when accessing a GCS bucket |
| 19 | +# using http, the bucket must have public access, which is forbidden by |
| 20 | +# our policy. |
| 21 | + |
| 22 | +set -e |
| 23 | + |
| 24 | +gradle_url=$(grep distributionUrl gradle/wrapper/gradle-wrapper.properties \ |
| 25 | + | awk -F = '{print $2}' | sed 's/\\//g') |
| 26 | +gradle_bin=$(basename $gradle_url) |
| 27 | +gcs_loc="domain-registry-maven-repository/gradle" |
| 28 | + |
| 29 | +gcloud storage cp "gs://${gcs_loc}/${gradle_bin}" . |
| 30 | +local_url="file\\\://${PWD}/${gradle_bin}" |
| 31 | +sed -i "s#distributionUrl=.*#distributionUrl=${local_url}#" \ |
| 32 | + gradle/wrapper/gradle-wrapper.properties |
0 commit comments