You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by go...@apache.org on 2019/05/28 20:15:55 UTC

[beam] branch sl4j-jdk14 created (now e25df67)

This is an automated email from the ASF dual-hosted git repository.

goenka pushed a change to branch sl4j-jdk14
in repository https://gitbox.apache.org/repos/asf/beam.git.


      at e25df67  [BEAM-7406] Include slf4j-jdk14 in Dataflow worker uber jar

This branch includes the following new commits:

     new e25df67  [BEAM-7406] Include slf4j-jdk14 in Dataflow worker uber jar

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[beam] 01/01: [BEAM-7406] Include slf4j-jdk14 in Dataflow worker uber jar

Posted by go...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

goenka pushed a commit to branch sl4j-jdk14
in repository https://gitbox.apache.org/repos/asf/beam.git

commit e25df676a3f4398aeea1676c4a826f4fb07fa453
Author: Kenn Knowles <ke...@apache.org>
AuthorDate: Fri May 24 15:03:27 2019 -0700

    [BEAM-7406] Include slf4j-jdk14 in Dataflow worker uber jar
---
 .../worker/legacy-worker/build.gradle              | 27 +++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/runners/google-cloud-dataflow-java/worker/legacy-worker/build.gradle b/runners/google-cloud-dataflow-java/worker/legacy-worker/build.gradle
index ef8a8c5..0099635 100644
--- a/runners/google-cloud-dataflow-java/worker/legacy-worker/build.gradle
+++ b/runners/google-cloud-dataflow-java/worker/legacy-worker/build.gradle
@@ -89,6 +89,8 @@ applyJavaNature(
             "com/google/cloud/dataflow/worker/DataflowRunnerHarness.class",
             // TODO(BEAM-6136): Enable relocation for conscrypt
             "org/conscrypt/**",
+            // Allow slf4j implementation worker for logging during pipeline execution
+            "org/slf4j/impl/**"
         ],
         shadowClosure: DEFAULT_SHADOW_CLOSURE << {
     // Each included dependency must also include all of its necessary transitive dependencies
@@ -102,7 +104,11 @@ applyJavaNature(
     // that the shaded jar is correctly built.
 
     dependencies {
-        include(project(path: ":beam-model-fn-execution", configuration: "shadow"))
+      include(dependency(library.java.slf4j_jdk14))
+    }
+
+    dependencies {
+        include(project(path: ":model:fn-execution", configuration: "shadow"))
     }
     relocate("org.apache.beam.model.fnexecution.v1", getWorkerRelocatedPath("org.apache.beam.model.fnexecution.v1"))
 
@@ -217,6 +223,25 @@ dependencies {
     shadowTest library.java.mockito_core
 }
 
+project.task('validateShadedJarContainsSlf4jJdk14', dependsOn: 'shadowJar') {
+    ext.outFile = project.file("${project.reportsDir}/${name}.out")
+    inputs.files project.configurations.shadow.artifacts.files
+    outputs.files outFile
+    doLast {
+        project.configurations.shadow.artifacts.files.each {
+            FileTree slf4jImpl = project.zipTree(it).matching {
+                include "org/slf4j/impl/JDK14LoggerAdapter.class"
+            }
+            outFile.text = slf4jImpl.files
+            if (slf4jImpl.files.isEmpty()) {
+                throw new GradleException("Did not find slf4j-jdk14 in Dataflow Worker uber jar")
+            }
+        }
+    }
+}
+
+tasks.check.dependsOn project.tasks.validateShadedJarContainsSlf4jJdk14
+
 //TODO(BEAM-5657): checktyle task should be enabled in the future.
 checkstyleMain.enabled = false
 checkstyleTest.enabled = false