Skip to content
Permalink
Browse files

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.
  • Loading branch information
weiminyu committed Feb 10, 2020
1 parent 594ce30 commit ce80278ab7aa96ae0fd528dbf4046b3a4633ddbd
Showing with 10 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +1 −1 config/presubmits.py
  3. +1 −0 java_common.gradle
  4. +7 −0 release/build_nomulus_for_env.sh
@@ -97,6 +97,7 @@ nomulus.iws
!/gradle/wrapper/**/*.jar
.gradle/
**/build
cloudbuild-caches/
node_modules/**
/repos/

@@ -22,7 +22,7 @@
import re

# 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.
FORBIDDEN = 1
REQUIRED = 2
@@ -115,6 +115,7 @@ spotless {
format 'misc', {
clearSteps()
target '**/*.gradle'
targetExclude '**/cloudbuild-caches/**'
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
@@ -29,6 +29,13 @@ environment="$1"
dest="$2"
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 ]
then
mkdir -p "${dest}"

0 comments on commit ce80278

Please sign in to comment.
You can’t perform that action at this time.