Skip to content

Commit

Permalink
Merge pull request #12338: [BEAM-10556] Make rawtypes an error. Add f…
Browse files Browse the repository at this point in the history
…lag to ignore rawtype errors and add to modules with errors.
  • Loading branch information
kennknowles committed Jul 25, 2020
2 parents 489cf2c + c0f91ba commit b2c2bff
Show file tree
Hide file tree
Showing 50 changed files with 177 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ class BeamModulePlugin implements Plugin<Project> {
/** Controls whether the spotbugs plugin is enabled and configured. */
boolean enableSpotbugs = true

/** Conatrols whether the checker framework plugin is enabled and configured. */
/** Controls whether the checker framework plugin is enabled and configured. */
boolean enableChecker = true

/** Controls whether legacy rawtype usage is allowed. */
boolean ignoreRawtypeErrors = false

/** Controls whether the dependency analysis plugin is enabled. */
boolean enableStrictDependencies = false

Expand Down Expand Up @@ -695,13 +698,16 @@ class BeamModulePlugin implements Plugin<Project> {
'deprecation',
'fallthrough',
'processing',
'rawtypes',
'serial',
'try',
'unchecked',
'varargs',
]

if (configuration.ignoreRawtypeErrors) {
defaultLintSuppressions.add("rawtypes")
}

project.tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
// As we want to add '-Xlint:-deprecation' we intentionally remove '-Xlint:deprecation' from compilerArgs here,
Expand Down
6 changes: 5 additions & 1 deletion examples/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
import groovy.json.JsonOutput

plugins { id 'org.apache.beam.module' }
applyJavaNature(exportJavadoc: false, enableChecker:false, automaticModuleName: 'org.apache.beam.examples')
applyJavaNature(
exportJavadoc: false,
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.examples')
provideIntegrationTestingDependencies()
enableJavaPerformanceTesting()

Expand Down
5 changes: 4 additions & 1 deletion runners/core-construction-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker:false, automaticModuleName: 'org.apache.beam.runners.core.construction')
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.runners.core.construction')

description = "Apache Beam :: Runners :: Core Construction Java"
ext.summary = """Beam Runners Core provides utilities to aid runner authors interact with a Pipeline
Expand Down
5 changes: 4 additions & 1 deletion runners/core-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker: false, automaticModuleName: 'org.apache.beam.runners.core')
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.runners.core')

description = "Apache Beam :: Runners :: Core Java"
ext.summary = "Beam Runners Core provides utilities to aid runner authors."
Expand Down
1 change: 1 addition & 0 deletions runners/direct-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def dependOnProjects = [":runners:core-construction-java",
applyJavaNature(
automaticModuleName: 'org.apache.beam.runners.direct',
enableChecker: false,
ignoreRawtypeErrors: true,
shadowClosure: {
dependencies {
dependOnProjects.each {
Expand Down
1 change: 1 addition & 0 deletions runners/extensions-java/metrics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
plugins { id 'org.apache.beam.module' }
applyJavaNature(
exportJavadoc: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.runners.extensions.metrics',
enableChecker:false)

Expand Down
1 change: 1 addition & 0 deletions runners/flink/flink_runner.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ apply plugin: 'org.apache.beam.module'
applyJavaNature(
automaticModuleName: 'org.apache.beam.runners.flink',
enableChecker: false,
ignoreRawtypeErrors: true,
archivesBaseName: (project.hasProperty('archives_base_name') ? archives_base_name : archivesBaseName))

description = "Apache Beam :: Runners :: Flink $flink_version"
Expand Down
5 changes: 4 additions & 1 deletion runners/google-cloud-dataflow-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
import groovy.json.JsonOutput

plugins { id 'org.apache.beam.module' }
applyJavaNature(automaticModuleName: 'org.apache.beam.runners.dataflow', enableChecker:false)
applyJavaNature(
automaticModuleName: 'org.apache.beam.runners.dataflow',
enableChecker: false,
ignoreRawtypeErrors: true)

description = "Apache Beam :: Runners :: Google Cloud Dataflow"

Expand Down
1 change: 1 addition & 0 deletions runners/google-cloud-dataflow-java/worker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ applyJavaNature(
publish: false,
exportJavadoc: false,
enableChecker:false,
ignoreRawtypeErrors: true,
enableSpotbugs: true,
validateShadowJar: false,
shadowClosure: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ applyJavaNature(
archivesBaseName: 'beam-runners-google-cloud-dataflow-java-legacy-worker',
publish: false,
enableChecker:false,
ignoreRawtypeErrors: true,
exportJavadoc: false,
enableSpotbugs: false /* TODO(BEAM-5658): enable spotbugs */,
shadowJarValidationExcludes: [
Expand Down
5 changes: 4 additions & 1 deletion runners/java-fn-execution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(automaticModuleName: 'org.apache.beam.runners.fnexecution', enableChecker: false)
applyJavaNature(
automaticModuleName: 'org.apache.beam.runners.fnexecution',
enableChecker: false,
ignoreRawtypeErrors: true)

description = "Apache Beam :: Runners :: Java Fn Execution"

Expand Down
5 changes: 4 additions & 1 deletion runners/java-job-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(automaticModuleName: 'org.apache.beam.runners.jobservice', enableChecker: false)
applyJavaNature(
automaticModuleName: 'org.apache.beam.runners.jobservice',
enableChecker: false,
ignoreRawtypeErrors: true)

description = "Apache Beam :: Runners :: Java Job Service"

Expand Down
2 changes: 1 addition & 1 deletion runners/jet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import groovy.json.JsonOutput

plugins { id 'org.apache.beam.module' }
applyJavaNature(automaticModuleName: 'org.apache.beam.runners.jet', enableChecker:false)
applyJavaNature(automaticModuleName: 'org.apache.beam.runners.jet', enableChecker:false, ignoreRawtypeErrors: true)

description = "Apache Beam :: Runners :: Hazelcast Jet"

Expand Down
6 changes: 5 additions & 1 deletion runners/samza/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
import groovy.json.JsonOutput

plugins { id 'org.apache.beam.module' }
applyJavaNature(exportJavadoc: false, enableChecker:false, automaticModuleName: 'org.apache.beam.runners.samza')
applyJavaNature(
exportJavadoc: false,
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.runners.samza')

description = "Apache Beam :: Runners :: Samza"

Expand Down
5 changes: 4 additions & 1 deletion runners/spark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
import groovy.json.JsonOutput

plugins { id 'org.apache.beam.module' }
applyJavaNature(automaticModuleName: 'org.apache.beam.runners.spark', enableChecker:false)
applyJavaNature(
automaticModuleName: 'org.apache.beam.runners.spark',
enableChecker: false,
ignoreRawtypeErrors: true)

description = "Apache Beam :: Runners :: Spark"

Expand Down
5 changes: 4 additions & 1 deletion runners/twister2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import groovy.json.JsonOutput

plugins { id 'org.apache.beam.module' }

applyJavaNature(automaticModuleName: 'org.apache.beam.runners.twister2', enableChecker:false)
applyJavaNature(
automaticModuleName: 'org.apache.beam.runners.twister2',
enableChecker: false,
ignoreRawtypeErrors: true)
evaluationDependsOn(":sdks:java:core")
configurations {
validatesRunner
Expand Down
1 change: 1 addition & 0 deletions sdks/java/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ plugins { id 'org.apache.beam.module' }
applyJavaNature(
automaticModuleName: 'org.apache.beam.sdk',
enableChecker: false,
ignoreRawtypeErrors: true,
shadowClosure: {
dependencies {
include(dependency("org.apache.commons:.*"))
Expand Down
4 changes: 3 additions & 1 deletion sdks/java/expansion-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(automaticModuleName: 'org.apache.beam.sdk.expansion.service')
applyJavaNature(
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.expansion.service')

description = "Apache Beam :: SDKs :: Java :: Expansion Service"
ext.summary = """Contains code that can be used to run an expansion service."""
Expand Down
6 changes: 5 additions & 1 deletion sdks/java/extensions/euphoria/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker:false,exportJavadoc: false, automaticModuleName: 'org.apache.beam.sdk.extensions.euphoria')
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
exportJavadoc: false,
automaticModuleName: 'org.apache.beam.sdk.extensions.euphoria')

description = "Apache Beam :: SDKs :: Java :: Extensions :: Euphoria Java 8 DSL"

Expand Down
5 changes: 4 additions & 1 deletion sdks/java/extensions/google-cloud-platform-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
import groovy.json.JsonOutput

plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker:false,automaticModuleName: 'org.apache.beam.sdk.extensions.gcp')
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.extensions.gcp')

description = "Apache Beam :: SDKs :: Java :: Extensions :: Google Cloud Platform Core"
ext.summary = """Common components used to support multiple
Expand Down
5 changes: 4 additions & 1 deletion sdks/java/extensions/protobuf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker:false,automaticModuleName: 'org.apache.beam.sdk.extensions.protobuf')
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.extensions.protobuf')
applyGrpcNature()

description = "Apache Beam :: SDKs :: Java :: Extensions :: Protobuf"
Expand Down
4 changes: 3 additions & 1 deletion sdks/java/extensions/sketching/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(automaticModuleName: 'org.apache.beam.sdk.extensions.sketching')
applyJavaNature(
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.extensions.sketching')

description = "Apache Beam :: SDKs :: Java :: Extensions :: Sketching"

Expand Down
5 changes: 4 additions & 1 deletion sdks/java/extensions/sorter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker:false,automaticModuleName: 'org.apache.beam.sdk.extensions.sorter')
applyJavaNature(
enableChecker:false,
ignoreRawtypeErrors:true,
automaticModuleName: 'org.apache.beam.sdk.extensions.sorter')

description = "Apache Beam :: SDKs :: Java :: Extensions :: Sorter"

Expand Down
4 changes: 3 additions & 1 deletion sdks/java/extensions/sql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ plugins {
id 'org.apache.beam.module'
id 'ca.coglinc.javacc'
}
applyJavaNature(enableChecker:false,
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.extensions.sql',
// javacc generated code produces lint warnings
disableLintWarnings: ['dep-ann'])
Expand Down
18 changes: 11 additions & 7 deletions sdks/java/extensions/sql/expansion-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
* limitations under the License.
*/
plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker:false,automaticModuleName: 'org.apache.beam.sdks.extensions.sql.expansion',
validateShadowJar: false,
shadowClosure: {
manifest {
attributes "Main-Class": "org.apache.beam.sdk.expansion.service.ExpansionService"
}
})
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdks.extensions.sql.expansion',
validateShadowJar: false,
shadowClosure: {
manifest {
attributes "Main-Class": "org.apache.beam.sdk.expansion.service.ExpansionService"
}
}
)

description = "Apache Beam :: SDKs :: Java :: SQL :: Expansion Service"
ext.summary = """Contains code to run a SQL Expansion Service."""
Expand Down
1 change: 1 addition & 0 deletions sdks/java/extensions/sql/jdbc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import groovy.json.JsonOutput
plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker:false,
automaticModuleName: 'org.apache.beam.sdk.extensions.sql.jdbc',
ignoreRawtypeErrors: true,
exportJavadoc: false,
testShadowJar: true,
validateShadowJar: false,
Expand Down
5 changes: 4 additions & 1 deletion sdks/java/extensions/sql/zetasql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ plugins {
id 'org.apache.beam.module'
}

applyJavaNature(enableChecker:false,automaticModuleName: 'org.apache.beam.sdk.extensions.sql.zetasql')
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.extensions.sql.zetasql')

description = "Apache Beam :: SDKs :: Java :: Extensions :: SQL :: ZetaSQL"
ext.summary = "ZetaSQL to Calcite translator"
Expand Down
4 changes: 3 additions & 1 deletion sdks/java/extensions/zetasketch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import groovy.json.JsonOutput

plugins { id 'org.apache.beam.module' }
applyJavaNature(automaticModuleName: 'org.apache.beam.sdk.extensions.zetasketch')
applyJavaNature(
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.extensions.zetasketch')

description = "Apache Beam :: SDKs :: Java :: Extensions :: ZetaSketch"

Expand Down
5 changes: 4 additions & 1 deletion sdks/java/fn-execution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker:false,automaticModuleName: 'org.apache.beam.sdk.fn')
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.fn')

description = "Apache Beam :: SDKs :: Java :: Fn Execution"
ext.summary = """Contains code shared across the Beam Java SDK Harness and Java Runners to execute using
Expand Down
4 changes: 3 additions & 1 deletion sdks/java/harness/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def dependOnProjects = [":sdks:java:fn-execution",
":sdks:java:extensions:google-cloud-platform-core",
":runners:core-java", ":runners:core-construction-java"]

applyJavaNature(enableChecker:false,
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.fn.harness',
validateShadowJar: false,
testShadowJar: true,
Expand Down
5 changes: 4 additions & 1 deletion sdks/java/io/amazon-web-services/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ plugins {
id 'org.apache.beam.module'
}

applyJavaNature(enableChecker: false, automaticModuleName: 'org.apache.beam.sdk.io.aws')
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.io.aws')

description = "Apache Beam :: SDKs :: Java :: IO :: Amazon Web Services"
ext.summary = "IO library to read and write Amazon Web Services services from Beam."
Expand Down
5 changes: 4 additions & 1 deletion sdks/java/io/amazon-web-services2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import groovy.json.JsonOutput
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(enableChecker:false,automaticModuleName: 'org.apache.beam.sdk.io.aws2')
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.sdk.io.aws2')

description = "Apache Beam :: SDKs :: Java :: IO :: Amazon Web Services 2"
ext.summary = "IO library to read and write Amazon Web Services services from Beam."
Expand Down
5 changes: 4 additions & 1 deletion sdks/java/io/azure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(automaticModuleName: 'org.apache.beam.sdk.io.azure', enableChecker: false)
applyJavaNature(
automaticModuleName: 'org.apache.beam.sdk.io.azure',
enableChecker: false,
ignoreRawtypeErrors: true)

dependencies {
compile project(path: ":sdks:java:core", configuration: "shadow")
Expand Down

0 comments on commit b2c2bff

Please sign in to comment.