You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/07/03 16:57:00 UTC

[jira] [Work logged] (BEAM-3608) Pre-shade Guava for things we want to keep using

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

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

                Author: ASF GitHub Bot
            Created on: 03/Jul/18 16:56
            Start Date: 03/Jul/18 16:56
    Worklog Time Spent: 10m 
      Work Description: kennknowles closed pull request #5570: [BEAM-3608] WIP: Vendored Guava 20
URL: https://github.com/apache/beam/pull/5570
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.gitignore b/.gitignore
index e05d3c33114..b0a7e90a890 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,7 @@
 **/.gogradle/**/*
 **/gogradle.lock
 **/build/**/*
-**/vendor/**/*
+sdks/go/**/vendor/**/*
 **/.gradletasknamecache
 
 # Ignore files generated by the Maven build process.
diff --git a/build_rules.gradle b/build_rules.gradle
index e6ee81ec833..5f4ce971e4a 100644
--- a/build_rules.gradle
+++ b/build_rules.gradle
@@ -938,6 +938,26 @@ artifactId=${project.name}
   }
 }
 
+// Configures a module to be a vendored library
+ext.vendoredJavaLibrary = {
+  project, dependency, destPackage, srcPackages ->
+    println "vendoredJavaLibrary(${dependency} -> org.apache.beam.vendor.${destPackage})"
+
+    apply plugin: 'com.github.johnrengelman.shadow'
+    apply plugin: 'java'
+
+    project.dependencies {
+      compile dependency
+    }
+
+    project.shadowJar {
+      classifier = null
+      for (srcPackage in srcPackages) {
+        relocate srcPackage, "org.apache.beam.vendor.${destPackage}.${srcPackage}"
+      }
+    }
+}
+
 // Reads and contains all necessary performance test parameters
 class JavaPerformanceTestConfiguration {
 
diff --git a/settings.gradle b/settings.gradle
index 0b89a609a33..ccae0bc0a45 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -154,3 +154,5 @@ include "beam-sdks-python"
 project(":beam-sdks-python").dir = file("sdks/python")
 include "beam-sdks-python-container"
 project(":beam-sdks-python-container").dir = file("sdks/python/container")
+include "beam-vendor-guava-20"
+project(":beam-vendor-guava-20").dir = file("vendor/guava/20")
diff --git a/vendor/guava/20/build.gradle b/vendor/guava/20/build.gradle
new file mode 100644
index 00000000000..2da31dfa571
--- /dev/null
+++ b/vendor/guava/20/build.gradle
@@ -0,0 +1,31 @@
+/*
+ * 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 from: project(':').file('build_rules.gradle')
+
+
+
+description = "Apache Beam :: Vendored Dependencies :: Guava :: 20"
+
+vendoredJavaLibrary(
+    project,
+    "com.google.guava:guava:20.0",
+    "guava.v20", [
+        "com.google.common",
+        "com.google.thirdparty"
+    ])


 

----------------------------------------------------------------
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:
users@infra.apache.org


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

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

> Pre-shade Guava for things we want to keep using
> ------------------------------------------------
>
>                 Key: BEAM-3608
>                 URL: https://issues.apache.org/jira/browse/BEAM-3608
>             Project: Beam
>          Issue Type: Sub-task
>          Components: runner-core, sdk-java-core
>            Reporter: Kenneth Knowles
>            Priority: Major
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Instead of shading as part of our build, we can shade before build so that it is apparent when reading code, and in IDEs, that a particular class resides in a hidden namespace.
> {{import com.google.common.reflect.TypeToken}}
> becomes something like
> {{import org.apache.beam.private.guava21.com.google.common.reflect.TypeToken}}
> So we can very trivially ban `org.apache.beam.private` from public APIs unless they are annotated {{@Internal}}, and it makes sharing between our own modules never get broken by shading again.



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