[ https://issues.apache.org/jira/browse/BEAM-4481?focusedWorklogId=111597&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-111597 ]
ASF GitHub Bot logged work on BEAM-4481: ---------------------------------------- Author: ASF GitHub Bot Created on: 13/Jun/18 18:31 Start Date: 13/Jun/18 18:31 Worklog Time Spent: 10m Work Description: swegner commented on a change in pull request #5594: [BEAM-4481, BEAM-4484] Start vendoring portability dependencies to not have dependency conflicts URL: https://github.com/apache/beam/pull/5594#discussion_r195190138 ########## File path: build_rules.gradle ########## @@ -1253,6 +1254,125 @@ ext.applyGrpcNature = { /*************************************************************************************************/ +ext.applyPortabilityNature = { + println "applyPortabilityNature with " + (it ? "$it" : "default configuration") + " for project $project.name" + applyJavaNature(enableFindbugs: false, enableErrorProne: false, shadowClosure: { + // guava uses the com.google.common and com.google.thirdparty package namespaces + relocate "com.google.common", "org.apache.beam.vendor.guava.v20.com.google.common" + relocate "com.google.thirdparty", "org.apache.beam.vendor.guava.v20.com.google.thirdparty" + + relocate "com.google.protobuf", "org.apache.beam.vendor.protobuf.v3.com.google.protobuf" + relocate "com.google.gson", "org.apache.beam.vendor.gson.v2.com.google.gson" + relocate "io.grpc", "org.apache.beam.vendor.grpc.v1.io.grpc" + relocate "com.google.auth", "org.apache.beam.vendor.google_auth_library_credentials.v0_9_1.com.google.auth" + relocate "com.google.api", "org.apache.beam.vendor.proto_google_common_protos.v1.com.google.api" + relocate "com.google.cloud", "org.apache.beam.vendor.proto_google_common_protos.v1.com.google.cloud" + relocate "com.google.logging", "org.apache.beam.vendor.proto_google_common_protos.v1.com.google.logging" + relocate "com.google.longrunning", "org.apache.beam.vendor.proto_google_common_protos.v1.com.google.longrunning" + relocate "com.google.rpc", "org.apache.beam.vendor.proto_google_common_protos.v1.com.google.rpc" + relocate "com.google.type", "org.apache.beam.vendor.proto_google_common_protos.v1.com.google.type" + relocate "io.opencensus", "org.apache.beam.vendor.opencensus.v0_11.io.opencensus" + + // Adapted from https://github.com/grpc/grpc-java/blob/e283f70ad91f99c7fee8b31b605ef12a4f9b1690/netty/shaded/build.gradle#L41 + relocate "io.netty", "org.apache.beam.vendor.netty.v4.io.netty" + // We have to be careful with these replacements as they must not match any + // string in NativeLibraryLoader, else they cause corruption. Note that + // this includes concatenation of string literals and constants. + relocate 'META-INF/native/libnetty', 'META-INF/native/liborg_apache_beam_vendor_netty_v4_netty' + relocate 'META-INF/native/netty', 'META-INF/native/org_apache_beam_vendor_netty_v4_netty' + + // Don't include errorprone, JDK8 annotations, objenesis, junit, and mockito in the bundled jar + exclude "com/google/errorprone/**" + exclude "com/google/instrumentation/**" + exclude "javax/annotation/**" + exclude "junit/**" + exclude "org/hamcrest/**" + exclude "org/junit/**" + exclude "org/mockito/**" + exclude "org/objenesis/**" + }) + + // Don't force modules here because we don't want to take the shared declarations in build_rules.gradle + // because we would like to have the freedom to choose which versions of dependencies we + // are using for the portability APIs separate from what is being used inside other modules such as GCP. + configurations.all { config -> + config.resolutionStrategy { + forcedModules = [] + } + } + + apply plugin: "com.google.protobuf" + protobuf { + protoc { + // The artifact spec for the Protobuf Compiler + artifact = "com.google.protobuf:protoc:3.5.1" + } + + // Configure the codegen plugins + plugins { + // An artifact spec for a protoc plugin, with "grpc" as + // the identifier, which can be referred to in the "plugins" + // container of the "generateProtoTasks" closure. + grpc { + artifact = "io.grpc:protoc-gen-grpc-java:1.12.0" + } + } + + generateProtoTasks { + ofSourceSet("main")*.plugins { + // Apply the "grpc" plugin whose spec is defined above, without + // options. Note the braces cannot be omitted, otherwise the + // plugin will not be added. This is because of the implicit way + // NamedDomainObjectContainer binds the methods. + grpc { } + } + } + } + + dependencies { + compile 'com.google.guava:guava:20.0' Review comment: Hmm, I still worry about the two version lists drifting. It seems like in the common scenario we want the versions to match, right? Would it be better to use the `ext.library` versions in most cases and only mention explicit overrides where necessary (with a comment about why each is necessary?) At the very least, I think there should a comment in both source locations giving guidance to maintainers, i.e. ``` applyProtobufNature() { // As much as possible, versions here should match those in ext.library. Please add a comment // explaining any necessary inconsistencies. .. } // When updating dependency versions here, please also update vendored versions in applyProtobufNature() ext.library = { // .. } ``` ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 111597) Time Spent: 6h 20m (was: 6h 10m) > Remove duplicate dependency declarations from runners/direct-java > ----------------------------------------------------------------- > > Key: BEAM-4481 > URL: https://issues.apache.org/jira/browse/BEAM-4481 > Project: Beam > Issue Type: Bug > Components: runner-direct > Reporter: Luke Cwik > Assignee: Luke Cwik > Priority: Major > Time Spent: 6h 20m > Remaining Estimate: 0h > > beam-model-pipeline and others are duplicated in the dependency list -- This message was sent by Atlassian JIRA (v7.6.3#76005)