osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Build-System] Facilitate up-to-date checks on test/shadowTest jar creation


Hi,

currently we bundle our tests within packageTests task [1] and additionally create a shadowed version with shadowTestJar.

Unfortunately both task build the jar with the same classifier, which results in each task overwriting the others output,  preventing any up-to-date checks from working.

Changing the build slightly to produce different artifacts

--- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

+++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

@@ -588,7 +588,7 @@ class BeamModulePlugin implements Plugin<Project> {

 

       // Ensure that tests are packaged and part of the artifact set.

       project.task('packageTests', type: Jar) {

-        classifier = 'tests'

+        classifier = 'tests-unshaded'

         from project.sourceSets.test.output

       }

       project.artifacts.archives project.packageTests


and so enabling up-to-date checking cuts build time [3] to half (on a build ignoring python/go/website where up-to-date checks currently do not work anyway) [4].

As I currently do not fully understand all consequences, I am wondering, whether we could apply that simple fix or wether there is some hidden magic, which relies on both artifacts be named the same.

Anyone able to provide further insights here?

Thx,

michel


[3]

Profiled build: -x :beam-sdks-python:build -x :beam-sdks-go:build -x :beam-website:build build 

DescriptionDuration
Total Build Time1m28.94s
Startup1.657s
Settings and BuildSrc1.870s
Loading Projects0.035s
Configuring Projects4.565s
Task Execution1m17.11s

[4]

Profiled build: -x :beam-sdks-python:build -x :beam-sdks-go:build -x :beam-website:build build 

DescriptionDuration
Total Build Time46.781s
Startup1.633s
Settings and BuildSrc2.004s
Loading Projects0.061s
Configuring Projects4.883s
Task Execution34.121s