Skip to content

Commit

Permalink
[BEAM-4948, BEAM-6267, BEAM-5559, BEAM-7289] Update the version of gu…
Browse files Browse the repository at this point in the history
…ava to 26.0-jre for all our vendored artifacts containing guava (#8899)

* fixup! Address missing auto value annotations for spotbugs and also j2objc annotations during compilation

* fixup! Fix used but undeclared deps for annotation deps, include minor clean-up of build module.

* fixup! Address spotbugs issues with incompatible nullability annotations in Guava 26.0-jre

Further details in google/guava#920

* [BEAM-4948, BEAM-6267, BEAM-5559, BEAM-7289] Update the version of guava to 26.0-jre for all our vendored artifacts containing guava
  • Loading branch information
lukecwik committed Jul 17, 2019
1 parent eeee1de commit c2f0d28
Show file tree
Hide file tree
Showing 1,710 changed files with 4,403 additions and 4,429 deletions.
Expand Up @@ -533,8 +533,8 @@ class BeamModulePlugin implements Plugin<Project> {
spark_network_common : "org.apache.spark:spark-network-common_2.11:$spark_version",
spark_streaming : "org.apache.spark:spark-streaming_2.11:$spark_version",
stax2_api : "org.codehaus.woodstox:stax2-api:3.1.4",
vendored_grpc_1_13_1 : "org.apache.beam:beam-vendor-grpc-1_13_1:0.2",
vendored_guava_20_0 : "org.apache.beam:beam-vendor-guava-20_0:0.1",
vendored_grpc_1_21_0 : "org.apache.beam:beam-vendor-grpc-1_21_0:0.1",
vendored_guava_26_0_jre : "org.apache.beam:beam-vendor-guava-26_0-jre:0.1",
woodstox_core_asl : "org.codehaus.woodstox:woodstox-core-asl:4.4.1",
zstd_jni : "com.github.luben:zstd-jni:1.3.8-3",
quickcheck_core : "com.pholser:junit-quickcheck-core:$quickcheck_version",
Expand Down Expand Up @@ -731,40 +731,42 @@ class BeamModulePlugin implements Plugin<Project> {
project.apply plugin: "net.ltgt.apt"
// let idea apt plugin handle the ide integration
project.apply plugin: "net.ltgt.apt-idea"
project.dependencies {
// Note that these plugins specifically use the compileOnly and testCompileOnly
// configurations because they are never required to be shaded or become a
// dependency of the output.
def auto_value = "com.google.auto.value:auto-value:1.6.3"
def auto_value_annotations = "com.google.auto.value:auto-value-annotations:1.6.3"
def auto_service = "com.google.auto.service:auto-service:1.0-rc2"

compileOnly auto_value_annotations
testCompileOnly auto_value_annotations
annotationProcessor auto_value
testAnnotationProcessor auto_value

compileOnly auto_service
testCompileOnly auto_service
annotationProcessor auto_service
testAnnotationProcessor auto_service

// Note that these plugins specifically use the compileOnly and testCompileOnly
// configurations because they are never required to be shaded or become a
// dependency of the output.
def compileOnlyAnnotationDeps = [
"com.google.auto.value:auto-value-annotations:1.6.3",
"com.google.auto.service:auto-service-annotations:1.0-rc6",
"com.google.j2objc:j2objc-annotations:1.3",
// These dependencies are needed to avoid error-prone warnings on package-info.java files,
// also to include the annotations to suppress warnings.
//
// spotbugs-annotations artifact is licensed under LGPL and cannot be included in the
// Apache Beam distribution, but may be relied on during build.
// See: https://www.apache.org/legal/resolved.html#prohibited
def spotbugs_annotations = "com.github.spotbugs:spotbugs-annotations:3.1.11"
def jcip_annotations = "net.jcip:jcip-annotations:1.0"
compileOnly spotbugs_annotations
compileOnly jcip_annotations
testCompileOnly spotbugs_annotations
testCompileOnly jcip_annotations
annotationProcessor spotbugs_annotations
annotationProcessor jcip_annotations
testAnnotationProcessor spotbugs_annotations
testAnnotationProcessor jcip_annotations
"com.github.spotbugs:spotbugs-annotations:3.1.11",
"net.jcip:jcip-annotations:1.0",
]

project.dependencies {
compileOnlyAnnotationDeps.each { dep ->
compileOnly dep
testCompileOnly dep
annotationProcessor dep
testAnnotationProcessor dep
}

// Add common annotation processors to all Java projects
def annotationProcessorDeps = [
"com.google.auto.value:auto-value:1.6.3",
"com.google.auto.service:auto-service:1.0-rc6",
]

annotationProcessorDeps.each { dep ->
annotationProcessor dep
testAnnotationProcessor dep
}
}

// Add the optional and provided configurations for dependencies
Expand Down Expand Up @@ -831,6 +833,11 @@ class BeamModulePlugin implements Plugin<Project> {
// This plugin is configured to only analyze the "main" source set.
if (configuration.enableSpotbugs) {
project.apply plugin: 'com.github.spotbugs'
project.dependencies {
spotbugs "com.github.spotbugs:spotbugs:3.1.10"
spotbugs "com.google.auto.value:auto-value:1.6.3"
compileOnlyAnnotationDeps.each { dep -> spotbugs dep }
}
project.spotbugs {
excludeFilter = project.rootProject.file('sdks/java/build-tools/src/main/resources/beam/spotbugs-filter.xml')
sourceSets = [sourceSets.main]
Expand All @@ -843,6 +850,15 @@ class BeamModulePlugin implements Plugin<Project> {
}
}

// Disregard unused but declared (test) compile only dependencies used
// for common annotation classes used during compilation such as annotation
// processing or post validation such as spotbugs.
project.dependencies {
compileOnlyAnnotationDeps.each { dep ->
permitUnusedDeclared dep
permitTestUnusedDeclared dep
}
}
if (configuration.enableStrictDependencies) {
project.tasks.analyzeClassesDependencies.enabled = true
project.tasks.analyzeDependencies.enabled = true
Expand Down Expand Up @@ -1530,10 +1546,10 @@ class BeamModulePlugin implements Plugin<Project> {
enableSpotbugs: false,
archivesBaseName: configuration.archivesBaseName,
shadowJarValidationExcludes: it.shadowJarValidationExcludes,
shadowClosure: GrpcVendoringOld.shadowClosure() << {
shadowClosure: GrpcVendoring.shadowClosure() << {
// We perform all the code relocations but don't include
// any of the actual dependencies since they will be supplied
// by org.apache.beam:beam-vendor-grpc-v1p13p1:0.1
// by org.apache.beam:beam-vendor-grpc-v1p21p0:0.1
dependencies {
include(dependency { return false })
}
Expand All @@ -1549,14 +1565,14 @@ class BeamModulePlugin implements Plugin<Project> {
project.apply plugin: "com.google.protobuf"
project.protobuf {
protoc { // The artifact spec for the Protobuf Compiler
artifact = "com.google.protobuf:protoc:3.6.0" }
artifact = "com.google.protobuf:protoc:3.7.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.13.1" }
grpc { artifact = "io.grpc:protoc-gen-grpc-java:1.21.0" }
}

generateProtoTasks {
Expand All @@ -1570,7 +1586,7 @@ class BeamModulePlugin implements Plugin<Project> {
}
}

project.dependencies GrpcVendoringOld.dependenciesClosure() << { shadow project.ext.library.java.vendored_grpc_1_13_1 }
project.dependencies GrpcVendoring.dependenciesClosure() << { shadow project.ext.library.java.vendored_grpc_1_21_0 }
}

/** ***********************************************************************************************/
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion examples/java/build.gradle
Expand Up @@ -45,7 +45,7 @@ configurations.sparkRunnerPreCommit {
}

dependencies {
compile library.java.vendored_guava_20_0
compile library.java.vendored_guava_26_0_jre
compile project(path: ":sdks:java:core", configuration: "shadow")
compile project(":sdks:java:extensions:google-cloud-platform-core")
compile project(":sdks:java:io:google-cloud-platform")
Expand Down
Expand Up @@ -50,10 +50,10 @@
import org.apache.beam.sdk.util.BackOffUtils;
import org.apache.beam.sdk.util.FluentBackoff;
import org.apache.beam.sdk.util.Sleeper;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.ImmutableList;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.Lists;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.Sets;
import org.apache.beam.vendor.guava.v20_0.com.google.common.util.concurrent.Uninterruptibles;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Sets;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.util.concurrent.Uninterruptibles;
import org.joda.time.Duration;

/**
Expand Down
Expand Up @@ -17,7 +17,7 @@
*/
package org.apache.beam.examples.common;

import static org.apache.beam.vendor.guava.v20_0.com.google.common.base.MoreObjects.firstNonNull;
import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.MoreObjects.firstNonNull;

import javax.annotation.Nullable;
import org.apache.beam.sdk.io.FileBasedSink;
Expand Down
Expand Up @@ -19,7 +19,7 @@

import static com.google.datastore.v1.client.DatastoreHelper.makeKey;
import static com.google.datastore.v1.client.DatastoreHelper.makeValue;
import static org.apache.beam.vendor.guava.v20_0.com.google.common.base.Preconditions.checkArgument;
import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument;

import com.google.api.services.bigquery.model.TableFieldSchema;
import com.google.api.services.bigquery.model.TableReference;
Expand Down Expand Up @@ -69,7 +69,7 @@
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.PCollectionList;
import org.apache.beam.vendor.guava.v20_0.com.google.common.base.MoreObjects;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.MoreObjects;
import org.joda.time.Duration;

/**
Expand Down
Expand Up @@ -56,7 +56,7 @@
import org.apache.beam.sdk.values.PCollectionView;
import org.apache.beam.sdk.values.PDone;
import org.apache.beam.sdk.values.TupleTag;
import org.apache.beam.vendor.guava.v20_0.com.google.common.base.Optional;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Expand Up @@ -44,7 +44,7 @@
import org.apache.beam.sdk.transforms.windowing.Window;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.ComparisonChain;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ComparisonChain;
import org.joda.time.Duration;
import org.joda.time.Instant;

Expand Down
Expand Up @@ -51,7 +51,7 @@
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PBegin;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.Lists;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists;
import org.joda.time.Duration;
import org.joda.time.Instant;
import org.joda.time.format.DateTimeFormat;
Expand Down
Expand Up @@ -44,7 +44,7 @@
import org.apache.beam.sdk.transforms.windowing.Window;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.vendor.guava.v20_0.com.google.common.annotations.VisibleForTesting;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.annotations.VisibleForTesting;
import org.joda.time.Duration;
import org.joda.time.Instant;

Expand Down
Expand Up @@ -17,7 +17,7 @@
*/
package org.apache.beam.examples.complete.game;

import static org.apache.beam.vendor.guava.v20_0.com.google.common.base.MoreObjects.firstNonNull;
import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.MoreObjects.firstNonNull;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -42,7 +42,7 @@
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.TypeDescriptor;
import org.apache.beam.sdk.values.TypeDescriptors;
import org.apache.beam.vendor.guava.v20_0.com.google.common.annotations.VisibleForTesting;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.annotations.VisibleForTesting;
import org.joda.time.Instant;

/**
Expand Down

0 comments on commit c2f0d28

Please sign in to comment.