Skip to content

Commit 6f35bdf

Browse files
committed
[BEAM-4744] Enable parallel publishing/release
This solves the problem where jars would overwrite each other when specifying -Ppublishing by fixing classifiers for shadowJar and jar to not conflict when publishing since jar by default uses null. Note that I also fixed: * some permissions issues of files * javadoc issues that came up when I was attempting to publish * the usage of :runners:google-cloud-dataflow-java:examples and examples-streaming. This was creating an empty project that was being published which was causing issues when attempting to perform a release. I was able to run a publishToMavenJavaPublicationToMavenLocal in parallel but didn't explicitly enable all the publishing plugins and remove the need for -Ppublishing because I didn't get enough time to test it. This cut publishing time down to about 8 mins from over 20 mins in a clean workspace on my machine.
1 parent 90bbeb2 commit 6f35bdf

File tree

13 files changed

+41
-29
lines changed

13 files changed

+41
-29
lines changed

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

+12-9
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,6 @@ class BeamModulePlugin implements Plugin<Project> {
642642

643643
// Enable errorprone static analysis
644644
project.apply plugin: 'net.ltgt.errorprone'
645-
project.tasks.withType(JavaCompile) { options.compilerArgs += "-XepDisableWarningsInGeneratedCode" }
646645

647646
// Enables a plugin which can perform shading of classes. See the general comments
648647
// above about dependency management for Java projects and how the shadow plugin
@@ -663,9 +662,14 @@ class BeamModulePlugin implements Plugin<Project> {
663662
testCompile.extendsFrom shadowTest
664663
}
665664

665+
project.jar {
666+
classifier = "unshaded"
667+
zip64 true
668+
}
669+
666670
// Always configure the shadowJar classifier and merge service files.
667671
project.shadowJar({
668-
classifier = "shaded"
672+
classifier = null
669673
mergeServiceFiles()
670674
zip64 true
671675
into("META-INF/") {
@@ -678,7 +682,7 @@ class BeamModulePlugin implements Plugin<Project> {
678682
project.task('shadowTestJar', type: ShadowJar, {
679683
group = "Shadow"
680684
description = "Create a combined JAR of project and test dependencies"
681-
classifier = "shaded-tests"
685+
classifier = "tests"
682686
from project.sourceSets.test.output
683687
configurations = [
684688
project.configurations.testRuntime
@@ -797,12 +801,11 @@ artifactId=${project.name}
797801

798802
publications {
799803
mavenJava(MavenPublication) {
800-
artifact project.shadowJar { // Strip the "shaded" classifier.
801-
classifier null }
802-
artifact project.shadowTestJar, { classifier "tests" }
803-
artifact project.sourcesJar, { classifier "sources" }
804-
artifact project.testSourcesJar, { classifier "testSources" }
805-
artifact project.javadocJar, { classifier "javadoc" }
804+
artifact project.shadowJar
805+
artifact project.shadowTestJar
806+
artifact project.sourcesJar
807+
artifact project.testSourcesJar
808+
artifact project.javadocJar
806809

807810
pom {
808811
name = project.description

examples/java/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ task preCommit() {
123123
for (String runner : preCommitRunners) {
124124
dependsOn runner + "PreCommit"
125125
}
126-
dependsOn ":runners:google-cloud-dataflow-java:examples:preCommit"
127-
dependsOn ":runners:google-cloud-dataflow-java:examples-streaming:preCommit"
126+
dependsOn ":beam-runners-google-cloud-dataflow-java-examples:preCommit"
127+
dependsOn ":beam-runners-google-cloud-dataflow-java-examples-streaming:preCommit"
128128
}
129129

model/fn-execution/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ description = "Apache Beam :: Model :: Fn Execution"
2323
ext.summary = "Portable definitions for execution user-defined functions."
2424

2525
dependencies {
26-
// We purposely depend on the unshaded classes for compilation and
26+
// We purposely depend on the unshaded classes for protobuf compilation and
2727
// export the shaded variant as the actual runtime dependency.
28-
compile project(path: ":beam-model-pipeline")
28+
protobuf project(path: ":beam-model-pipeline", configuration: "unshaded")
2929
runtime project(path: ":beam-model-pipeline", configuration: "shadow")
3030
}

model/job-management/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ description = "Apache Beam :: Model :: Job Management"
2323
ext.summary = "Portable definitions for submitting pipelines."
2424

2525
dependencies {
26-
// We purposely depend on the unshaded classes for compilation and
26+
// We purposely depend on the unshaded classes for protobuf compilation and
2727
// export the shaded variant as the actual runtime dependency.
28-
compile project(path: ":beam-model-pipeline")
28+
protobuf project(path: ":beam-model-pipeline", configuration: "unshaded")
2929
runtime project(path: ":beam-model-pipeline", configuration: "shadow")
3030
}

model/pipeline/build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@ applyPortabilityNature()
2121

2222
description = "Apache Beam :: Model :: Pipeline"
2323
ext.summary = "Portable definitions for building pipelines"
24+
25+
configurations {
26+
unshaded
27+
}
28+
29+
artifacts {
30+
unshaded jar
31+
}

runners/google-cloud-dataflow-java/examples-streaming/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ task preCommit(type: Test) {
4444
testClassesDirs = files(project(":beam-examples-java").sourceSets.test.output.classesDirs)
4545
include "**/WordCountIT.class"
4646
// Don't include WindowedWordCountIT, since it is already included in
47-
// :runners:google-cloud-dataflow-java:examples:preCommit and runs
47+
// :beam-runners-google-cloud-dataflow-java-examples:preCommit and runs
4848
// identically (ignores the --streaming flag).
4949
forkEvery 1
5050
maxParallelForks 4

runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/ReadTranslator.java

100755100644
File mode changed.

runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/internal/CustomSources.java

100755100644
File mode changed.

runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/internal/package-info.java

100755100644
File mode changed.

runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/FnService.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ public interface FnService extends AutoCloseable, BindableService {
2626
* {@inheritDoc}.
2727
*
2828
* <p>There should be no more calls to any service method by the time a call to {@link #close()}
29-
* begins. Specifically, this means that a {@link io.grpc.Server} that this service is bound to
30-
* should have completed a call to the {@link io.grpc.Server#shutdown()} method, and all future
31-
* incoming calls will be rejected.
29+
* begins. Specifically, this means that a {@link org.apache.beam.vendor.grpc.v1.io.grpc.Server}
30+
* that this service is bound to should have completed a call to the {@link
31+
* org.apache.beam.vendor.grpc.v1.io.grpc.Server#shutdown()} method, and all future incoming calls
32+
* will be rejected.
3233
*/
3334
@Override
3435
void close() throws Exception;

runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/state/StateRequestHandlers.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,13 @@ private <K, V, W extends BoundedWindow> SideInputHandler<V, W> createHandler(
325325
* Returns an adapter which converts a {@link BagUserStateHandlerFactory} to a {@link
326326
* StateRequestHandler}.
327327
*
328-
* <p>The {@link MultimapSideInputHandlerFactory} is required to handle all multimap side inputs
329-
* contained within the {@link ExecutableProcessBundleDescriptor}. See {@link
330-
* ExecutableProcessBundleDescriptor#getMultimapSideInputSpecs} for the set of multimap side
331-
* inputs that are contained.
328+
* <p>The {@link SideInputHandlerFactory} is required to handle all multimap side inputs contained
329+
* within the {@link ExecutableProcessBundleDescriptor}. See {@link
330+
* ExecutableProcessBundleDescriptor#getSideInputSpecs} for the set of multimap side inputs that
331+
* are contained.
332332
*
333-
* <p>Instances of {@link MultimapSideInputHandler}s returned by the {@link
334-
* MultimapSideInputHandlerFactory} are cached.
333+
* <p>Instances of {@link SideInputHandler}s returned by the {@link SideInputHandlerFactory} are
334+
* cached.
335335
*/
336336
public static StateRequestHandler forBagUserStateHandlerFactory(
337337
ExecutableProcessBundleDescriptor processBundleDescriptor,

sdks/java/extensions/sketching/src/main/java/org/apache/beam/sdk/extensions/sketching/package-info.java

100755100644
File mode changed.

settings.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ include "beam-runners-gearpump"
5050
project(":beam-runners-gearpump").dir = file("runners/gearpump")
5151
include "beam-runners-google-cloud-dataflow-java"
5252
project(":beam-runners-google-cloud-dataflow-java").dir = file("runners/google-cloud-dataflow-java")
53-
// These 2 projects will not be published to Maven so they don't get a special
54-
// dashed name.
55-
include ":runners:google-cloud-dataflow-java:examples"
56-
include ":runners:google-cloud-dataflow-java:examples-streaming"
53+
include ":beam-runners-google-cloud-dataflow-java-examples"
54+
project(":beam-runners-google-cloud-dataflow-java-examples").dir = file("runners/google-cloud-dataflow-java/examples")
55+
include ":beam-runners-google-cloud-dataflow-java-examples-streaming"
56+
project(":beam-runners-google-cloud-dataflow-java-examples-streaming").dir = file("runners/google-cloud-dataflow-java/examples")
5757
include "beam-runners-java-fn-execution"
5858
project(":beam-runners-java-fn-execution").dir = file("runners/java-fn-execution")
5959
include "beam-runners-local-java-core"

0 commit comments

Comments
 (0)