[ 
https://issues.apache.org/jira/browse/BEAM-5634?focusedWorklogId=152580&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152580
 ]

ASF GitHub Bot logged work on BEAM-5634:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Oct/18 07:37
            Start Date: 09/Oct/18 07:37
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on a change in pull request #6561: 
[BEAM-5634] Bring dataflow java worker code into beam
URL: https://github.com/apache/beam/pull/6561#discussion_r223588256
 
 

 ##########
 File path: runners/google-cloud-dataflow-java/worker/build.gradle
 ##########
 @@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************/
+// Apply BeamModulePlugin
+
+// Reuse project_root/buildSrc in this build.gradle file to reduce the
+// maintenance burden and simpily this file. See BeamModulePlugin for
+// documentation on default build tasks and properties that are enabled in
+// addition to natures that will be applied to worker.
+apply plugin: org.apache.beam.gradle.BeamModulePlugin
+
+group = "org.apache.beam.runners.dataflow"
+
+/******************************************************************************/
+// Apply Java nature with customized configurations
+
+// Set a specific version of 'com.google.apis:google-api-services-dataflow'
+// by adding -Pdataflow.version=<version> in Gradle command. Otherwise,
+// 'google_clients_version' defined in BeamModulePlugin will be used as 
default.
+def DATAFLOW_VERSION = "dataflow.version"
+
+// To build FnAPI or legacy worker.
+// Use -PisLegacyWorker in Gradle command if build legacy worker, otherwise,
+// FnAPI worker is considered as default.
+def is_legacy_worker = {
+  return project.hasProperty("isLegacyWorker")
+}
+
+// Get full dependency of 'com.google.apis:google-api-services-dataflow'
+def google_api_services_dataflow = project.hasProperty(DATAFLOW_VERSION) ? 
"com.google.apis:google-api-services-dataflow:" + getProperty(DATAFLOW_VERSION) 
: library.java.google_api_services_dataflow
+
+// Returns a string representing the relocated path to be used with the shadow
+// plugin when given a suffix such as "com.".
+def getWorkerRelocatedPath = { String suffix ->
+  return ("org.apache.beam.runners.dataflow.worker.repackaged."
+          + suffix)
+}
+
+// Following listed dependencies will be shaded only in fnapi worker, not 
legacy
+// worker
+def sdk_provided_dependencies = [
+  "org.apache.beam:beam-runners-google-cloud-dataflow-java:$version",
+  "org.apache.beam:beam-sdks-java-core:$version",
+  
"org.apache.beam:beam-sdks-java-extensions-google-cloud-platform-core:$version",
+  "org.apache.beam:beam-sdks-java-io-google-cloud-platform:$version",
+  google_api_services_dataflow,
+  library.java.avro,
+  library.java.google_api_client,
+  library.java.google_http_client,
+  library.java.google_http_client_jackson,
+  library.java.jackson_annotations,
+  library.java.jackson_core,
+  library.java.jackson_databind,
+  library.java.joda_time,
+]
+
+// Exclude unneeded dependencies when building jar
+def excluded_dependencies = [
+  "com.google.auto.service:auto-service",      // Provided scope added from 
applyJavaNature
+  "com.google.auto.value:auto-value",          // Provided scope added from 
applyJavaNature
+  "org.codehaus.jackson:jackson-core-asl",     // Exclude an old version of 
jackson-core-asl introduced by google-http-client-jackson
+  "org.objenesis:objenesis",                   // Transitive dependency 
introduced from Beam
+  "org.tukaani:xz",                            // Transitive dependency 
introduced from Beam
+  library.java.commons_compress,               // Transitive dependency 
introduced from Beam
+  library.java.error_prone_annotations,        // Provided scope added in 
worker
+  library.java.hamcrest_core,                  // Test only
+  library.java.hamcrest_library,               // Test only
+  library.java.junit,                          // Test only
+]
+
+applyJavaNature(validateShadowJar: false, shadowClosure: 
DEFAULT_SHADOW_CLOSURE << {
+  dependencies {
+    include(project(path: ":beam-runners-google-cloud-dataflow-java-windmill", 
configuration: "shadow"))
+    include(dependency(".*:.*"))
+
+    if (is_legacy_worker()) {
+      sdk_provided_dependencies.each {
+        exclude(dependency(it))
+      }
+      excluded_dependencies.each {
+        exclude(dependency(it))
+      }
+    }
+  }
+
+  // Archive name pattern: ${name}-${appendix}-${version}-${classifier}.jar
+  appendix = is_legacy_worker() ? "legacy-bundled" : "fnapi-bundled"
+
+  // Include original source files extracted under
+  // '$buildDir/original_sources_to_package' to jar
+  from "$buildDir/original_sources_to_package"
+
+  exclude "META-INF/LICENSE.txt"
+  exclude "about.html"
+  exclude "google/protobuf/*.proto"
+  exclude "windmill*.proto"
+
+  if (is_legacy_worker()) {
+    relocate("com.", getWorkerRelocatedPath("com.")) {
+      exclude "com.fasterxml.jackson.**"
+      exclude "com.google.api.client.**"
+      exclude "com.google.api.services.bigquery.**"
+      exclude "com.google.api.services.clouddebugger.**"
+      exclude "com.google.api.services.dataflow.**"
+      exclude "com.google.api.services.datastore.**"
+      exclude "com.google.api.services.pubsub.**"
+      exclude "com.google.api.services.storage.**"
+      exclude "com.google.auth.**"
+      exclude "com.google.cloud.dataflow.**"
+      exclude "com.sun.management*"
+      exclude "com.sun.management.**"
+    }
+    relocate("javax.servlet", getWorkerRelocatedPath("javax.servlet"))
+    relocate("io.", getWorkerRelocatedPath("io."))
+    relocate("okio.", getWorkerRelocatedPath("okio."))
+    relocate("org.", getWorkerRelocatedPath("org.")) {
+      // Exclude netty-tcnative from shading since gRPC relies on Netty to be 
able
+      // to load org.apache.tomcat.jni.SSL to provide an SSL context.
+      exclude "org.apache.avro.**"
+      exclude "org.apache.beam.**"
+      exclude "org.apache.tomcat.jni.**"
+      exclude "org.conscrypt.**"
+      exclude "org.eclipse.jetty.alpn.**"
+      exclude "org.eclipse.jetty.npn.**"
+      exclude "org.hamcrest.**"
+      exclude "org.joda.time.**"
+      exclude "org.junit.**"
+      exclude "org.slf4j.**"
+      exclude "org.w3c.dom.**"
+    }
+    relocate("org.apache.beam.runners.core.construction.",
+             getWorkerRelocatedPath("org."))
+  }
+})
+
+/******************************************************************************/
+// Configure the worker root project
+
+configurations {
+  sourceFile
+
+  // Ban these dependencies from all configurations
+  all {
+    // Ban the usage of AppleJavaExtensions in findbugs.
+    exclude group: "com.apple", module: "AppleJavaExtensions"
+  }
+}
+
+dependencies {
+  // Set dependencies to shadow scope by default, but in a property so they can
+  // be downgraded when building a legacy (non-FnAPI) worker.
+  if (is_legacy_worker()) {
+    sdk_provided_dependencies.each {
+      provided(it)
+    }
+  } else {
+    sdk_provided_dependencies.each {
+      shadow(it)
+    }
+  }
+
+  compile "org.apache.beam:beam-model-fn-execution:$version"
 
 Review comment:
   Won't this pull the dependency from maven rather than try and build what's 
in this repository? (I could be missunderstanding things, but it seems we want 
compile project(...) here instead.)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 152580)
    Time Spent: 2h 10m  (was: 2h)

> Bring Dataflow Java Worker Code into Beam
> -----------------------------------------
>
>                 Key: BEAM-5634
>                 URL: https://issues.apache.org/jira/browse/BEAM-5634
>             Project: Beam
>          Issue Type: Task
>          Components: runner-dataflow
>            Reporter: Boyuan Zhang
>            Assignee: Boyuan Zhang
>            Priority: Major
>             Fix For: 2.8.0
>
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Discussion: 
> https://lists.apache.org/thread.html/89efd3bc1d30f3d43d4b361a5ee05bd52778c9dc3f43ac72354c2bd9@%3Cdev.beam.apache.org%3E
> Vote: 
> https://lists.apache.org/thread.html/2bdc645659e2fbd7e29f3a2758941faefedb01148a2a11558dfe60f8@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to