Skip to content

Commit

Permalink
[BEAM-11383] Add runtime normalization for sdk.properties. (apache#13464
Browse files Browse the repository at this point in the history
)

This normalizes the sdk.properties file which has a build timestamp in it as well as the version and sdk version. For the purposes of the runtime classpath, these can be ignored so that tasks are not rerun if only the build timestamp is changed.
This should result in significantly higher cache hits as well as more up-to-date checks.

This also preserves timestamps for certain tasks for the same reason.

BEAM-11383
  • Loading branch information
runningcode authored Dec 5, 2020
1 parent 60fe232 commit 30f9a60
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,17 @@ if (project.hasProperty('compileAndRunTestsWithJava11')) {
project.sqlPreCommit.dependsOn ':sdks:java:testing:test-utils:verifyJavaVersion'
} else {
allprojects {
tasks.withType(Test) {
tasks.withType(Test).configureEach {
exclude '**/JvmVerification.class'
}
}
}

// Ignore sdk.properties so it doesn't spoil the build cache unnecessarily (see https://docs.gradle.org/6.6/userguide/more_about_tasks.html#sec:configure_input_normalization)
allprojects {
normalization {
runtimeClasspath {
ignore('**/sdk.properties')
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ class BeamModulePlugin implements Plugin<Project> {
'varargs',
]

project.tasks.withType(JavaCompile) {
project.tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
// As we want to add '-Xlint:-deprecation' we intentionally remove '-Xlint:deprecation' from compilerArgs here,
// as intellij is adding this, see https://youtrack.jetbrains.com/issue/IDEA-196615
Expand All @@ -770,6 +770,10 @@ class BeamModulePlugin implements Plugin<Project> {
+ (defaultLintSuppressions + configuration.disableLintWarnings).collect { "-Xlint:-${it}" })
}

project.tasks.withType(Jar).configureEach {
preserveFileTimestamps(false)
}

if (project.hasProperty("compileAndRunTestsWithJava11")) {
def java11Home = project.findProperty("java11Home")
project.tasks.compileTestJava {
Expand Down Expand Up @@ -797,7 +801,7 @@ class BeamModulePlugin implements Plugin<Project> {
filter { setFailOnNoMatchingTests(false) }
}

project.tasks.withType(Test) {
project.tasks.withType(Test).configureEach {
// Configure all test tasks to use JUnit
useJUnit {}
// default maxHeapSize on gradle 5 is 512m, lets increase to handle more demanding tests
Expand Down

0 comments on commit 30f9a60

Please sign in to comment.