mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Make Gradle dependency cache shareable in GCB (#479)
* Make Gradle dependency cache shareable in GCB Make Gradle put its caches in the source tree so that they can be preserved across steps. When left at their default location, caches are lost after each step.
This commit is contained in:
parent
1e97a5050d
commit
79b46001b6
4 changed files with 10 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -97,6 +97,7 @@ nomulus.iws
|
||||||
!/gradle/wrapper/**/*.jar
|
!/gradle/wrapper/**/*.jar
|
||||||
.gradle/
|
.gradle/
|
||||||
**/build
|
**/build
|
||||||
|
cloudbuild-caches/
|
||||||
node_modules/**
|
node_modules/**
|
||||||
/repos/
|
/repos/
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# We should never analyze any generated files
|
# We should never analyze any generated files
|
||||||
UNIVERSALLY_SKIPPED_PATTERNS = {"/build/", "/out/"}
|
UNIVERSALLY_SKIPPED_PATTERNS = {"/build/", "cloudbuild-caches", "/out/"}
|
||||||
# We can't rely on CI to have the Enum package installed so we do this instead.
|
# We can't rely on CI to have the Enum package installed so we do this instead.
|
||||||
FORBIDDEN = 1
|
FORBIDDEN = 1
|
||||||
REQUIRED = 2
|
REQUIRED = 2
|
||||||
|
|
|
@ -115,6 +115,7 @@ spotless {
|
||||||
format 'misc', {
|
format 'misc', {
|
||||||
clearSteps()
|
clearSteps()
|
||||||
target '**/*.gradle'
|
target '**/*.gradle'
|
||||||
|
targetExclude '**/cloudbuild-caches/**'
|
||||||
trimTrailingWhitespace()
|
trimTrailingWhitespace()
|
||||||
indentWithSpaces(2)
|
indentWithSpaces(2)
|
||||||
endWithNewline()
|
endWithNewline()
|
||||||
|
|
|
@ -29,6 +29,13 @@ environment="$1"
|
||||||
dest="$2"
|
dest="$2"
|
||||||
gcs_prefix="storage.googleapis.com/domain-registry-maven-repository"
|
gcs_prefix="storage.googleapis.com/domain-registry-maven-repository"
|
||||||
|
|
||||||
|
# Let Gradle put its caches (dependency cache and build cache) in the source
|
||||||
|
# tree. This allows sharing of the caches between steps in a Cloud Build
|
||||||
|
# task. (See ./cloudbuild-nomulus.yaml, which calls this script in several
|
||||||
|
# steps). If left at their default location, the caches will be lost after
|
||||||
|
# each step.
|
||||||
|
export GRADLE_USER_HOME="./cloudbuild-caches"
|
||||||
|
|
||||||
if [ "${environment}" == tool ]
|
if [ "${environment}" == tool ]
|
||||||
then
|
then
|
||||||
mkdir -p "${dest}"
|
mkdir -p "${dest}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue