mirror of
https://github.com/corda/corda.git
synced 2024-12-18 12:46:29 +00:00
CORDA-1509 Configure and enable Gradle Build Cache (#3908)
* Fix to enable gradle build caching of test runs. * Configure gradle build caching to be enabled. * Generate dependency report and graph: 1) ./gradlew htmlDependencyReport 2) ./gradlew generateDependencyGraphCorda * Strip out all Jacoco references to prevent Gradle Build Cache error: "Caching disabled for task ':<module>:test': 'JaCoCo agent configured with `append = true`' satisfied" * Revert jacoco back into jarFilter gradle build file. Disable building deterministic modules (including jarFilter). * Added Gradle build scan plugin. * Set file encoding to prevent incorrect Gradle build cache keys across different machines. https://guides.gradle.org/using-build-cache/#system_file_encoding * Apply gradle build cache settings to buildSrc. * Added targetted gradle build tasks to leverage cache. * Updated URL's of several different test Gradle Cache instances. * Updated CI batch build scripts. * Updated script perms to be executable. * Added CI smoke tests batch script. * Use TestDev Labs gradle cache. * Echo URL of Gradle Build Repository. Echo exit status of each Gradle build command. * Use environment variables to define Gradle Build Cache usage and URL. * Customisation through parameters. * Remove dependency graph generation plugin. Align build cache settings across project and buildSrc gradle files. * Remove buildSrc gradle build cache config. * Revert definition of gradle build cache variables back to settings.gradle. * Fix incorrect path. * Aligned gradle build cache configuration across buildSrc and project. * Minor updates to test scope. * Minor updates to test scope. * Update scripts to use GRADLE_HOME * Exit on unset GRADLE_HOME * Remove duplication following rebase from master. * Remove fine-grained build task scripts. * Added back Jacoco reporting. * Revert jdk8u-deterministic module. * Incorporating changes from PR review feedback. * Workaround Jacoco issue associated with Gradle Build Cache test task. * Update init script. * Remove redundant build-scan declarations. * Updates from PR review feedback. * Remove GRADLE_HOME as no longer needed - everything is driven via gradle wrapper. * Use CORDA prefix in system environment variable.
This commit is contained in:
parent
878bd4da8c
commit
6f27898664
9
.ci/ci-gradle-build-cache-init.sh
Executable file
9
.ci/ci-gradle-build-cache-init.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
export GRADLE_BUILD_CACHE_URL="${GRADLE_BUILD_CACHE_URL:-http://localhost:5071/cache/}"
|
||||
export USE_GRADLE_DAEMON="${USE_GRADLE_DAEMON:-false}"
|
||||
export GRADLE_CACHE_DEBUG="${GRADLE_CACHE_DEBUG:-false}"
|
||||
export PERFORM_GRADLE_SCAN="${PERFORM_GRADLE_SCAN:---scan}"
|
||||
|
||||
# cd %teamcity.build.checkoutDir%
|
||||
echo "Using Gradle Build Cache: $GRADLE_BUILD_CACHE_URL"
|
12
build.gradle
12
build.gradle
@ -120,6 +120,7 @@ plugins {
|
||||
|
||||
// Add the shadow plugin to the plugins classpath for the entire project.
|
||||
id 'com.github.johnrengelman.shadow' version '2.0.4' apply false
|
||||
id "com.gradle.build-scan" version "1.16"
|
||||
}
|
||||
|
||||
ext {
|
||||
@ -204,6 +205,12 @@ allprojects {
|
||||
if (project.path.startsWith(':experimental') && System.getProperty("experimental.test.enable") == null) {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
// Required to use Gradle build cache (until Gradle 5.0 is released with default value of "append" set to false)
|
||||
// See https://github.com/gradle/gradle/issues/5269 and https://github.com/gradle/gradle/pull/6419
|
||||
extensions.configure(TypeOf.typeOf(JacocoTaskExtension)) { ex ->
|
||||
ex.append = false
|
||||
}
|
||||
}
|
||||
|
||||
group 'net.corda'
|
||||
@ -438,3 +445,8 @@ wrapper {
|
||||
gradleVersion = "4.10.1"
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
|
||||
buildScan {
|
||||
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
|
||||
termsOfServiceAgree = 'yes'
|
||||
}
|
15
buildCacheSettings.gradle
Normal file
15
buildCacheSettings.gradle
Normal file
@ -0,0 +1,15 @@
|
||||
// Gradle Build Cache configuration recommendation: https://docs.gradle.org/current/userguide/build_cache.html
|
||||
ext {
|
||||
isCiServer = System.getenv().containsKey("CORDA_CI")
|
||||
gradleBuildCacheURL = System.getenv().containsKey("GRADLE_BUILD_CACHE_URL") ? System.getenv().get("GRADLE_BUILD_CACHE_URL") : 'http://localhost:5071/cache/'
|
||||
}
|
||||
|
||||
buildCache {
|
||||
local {
|
||||
enabled = !isCiServer
|
||||
}
|
||||
remote(HttpBuildCache) {
|
||||
url = gradleBuildCacheURL
|
||||
push = isCiServer
|
||||
}
|
||||
}
|
@ -1,2 +1,4 @@
|
||||
rootProject.name = 'buildSrc'
|
||||
include 'canonicalizer'
|
||||
|
||||
apply from: '../buildCacheSettings.gradle'
|
@ -1,2 +1,3 @@
|
||||
kotlin.incremental=true
|
||||
org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g
|
||||
org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g -Dfile.encoding=UTF-8
|
||||
org.gradle.caching=true
|
||||
|
@ -60,6 +60,8 @@ include 'samples:cordapp-configuration'
|
||||
include 'samples:network-verifier'
|
||||
include 'serialization'
|
||||
|
||||
apply from: 'buildCacheSettings.gradle'
|
||||
|
||||
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
|
||||
include 'core-deterministic'
|
||||
include 'core-deterministic:testing'
|
||||
|
Loading…
Reference in New Issue
Block a user