Skip to content

Commit

Permalink
Merge pull request apache#7781: [BEAM-4102] use plugins DSL instead o…
Browse files Browse the repository at this point in the history
…f manual classpath
  • Loading branch information
kennknowles committed Feb 9, 2019
2 parents c50e3fc + 531cdf5 commit 7940259
Show file tree
Hide file tree
Showing 98 changed files with 183 additions and 190 deletions.
9 changes: 5 additions & 4 deletions .test-infra/metrics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
* limitations under the License.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins {
id 'org.apache.beam.module'
// https://github.com/avast/gradle-docker-compose-plugin
id 'com.avast.gradle.docker-compose'
}
applyGroovyNature()

repositories { mavenCentral() }

// https://github.com/avast/gradle-docker-compose-plugin
apply plugin: "com.avast.gradle.docker-compose"

dependencies {
testCompile library.groovy.groovy_all
testCompile library.java.junit
Expand Down
81 changes: 15 additions & 66 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,81 +15,35 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// See build_rules.gradle for documentation on default build tasks
// and properties that are enabled in addition to natures
// that can be applied to configure a project for certain common
// tasks.

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins {
id 'base'
// Enable publishing build scans
id 'com.gradle.build-scan' version '1.13.1' apply false
// This plugin provides a task to determine which dependencies have updates.
// Additionally, the plugin checks for updates to Gradle itself.
//
// See https://github.com/ben-manes/gradle-versions-plugin for further details.
id 'com.github.ben-manes.versions' version '0.17.0'
// Apply one top level rat plugin to perform any required license enforcement analysis
id 'org.nosphere.apache.rat' version '0.3.1'
// Enable gradle-based release management
id 'net.researchgate.release' version '2.6.0'
id 'org.apache.beam.module'
}

// Add performanceTest task to this build.gradle file
// so that running Performance tests using PerfKitBenchmarker is possible.
createPerformanceTestHarness()

// Define the set of repositories and dependencies required to
// fetch and enable plugins.
buildscript {
repositories {
maven { url offlineRepositoryRoot }

// To run gradle in offline mode, one must first invoke
// 'updateOfflineRepository' to create an offline repo
// inside the root project directory. See the application
// of the offline repo plugin within build_rules.gradle
// for further details.
if (gradle.startParameter.isOffline()) {
return
}

mavenLocal()
mavenCentral()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.spring.io/plugins-release" }
}
dependencies {
classpath 'net.researchgate:gradle-release:2.6.0' // Enable gradle-based release management
classpath "net.ltgt.gradle:gradle-apt-plugin:0.20" // Enable a Java annotation processor
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.5" // Enable proto code generation
classpath "io.spring.gradle:propdeps-plugin:0.0.9.RELEASE" // Enable provided and optional configurations
classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.3.1" // Enable Apache license enforcement
classpath "com.commercehub.gradle.plugin:gradle-avro-plugin:0.11.0" // Enable Avro code generation
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.17.0" // Enable a code formatting plugin
classpath "gradle.plugin.com.github.blindpirate:gogradle:0.11.2" // Enable Go code compilation
classpath "gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.20.1" // Enable building Docker containers
classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.3.1" // Adds a 'taskTree' task to print task dependency tree
classpath "com.github.jengelman.gradle.plugins:shadow:4.0.3" // Enable shading Java dependencies
classpath "ca.coglinc:javacc-gradle-plugin:2.4.0" // Enable the JavaCC parser generator
classpath "gradle.plugin.io.pry.gradle.offline_dependencies:gradle-offline-dependencies-plugin:0.3" // Enable creating an offline repository
classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13" // Enable errorprone Java static analysis
classpath "com.github.ben-manes:gradle-versions-plugin:0.17.0" // Enable dependency checks
classpath "org.ajoberstar.grgit:grgit-gradle:3.0.0" // Enable website git publish to asf-site branch
classpath "com.avast.gradle:gradle-docker-compose-plugin:0.8.8" // Enable docker compose tasks
classpath "ca.cutterslade.gradle:gradle-dependency-analyze:1.3.0" // Enable dep analysis

// Plugins which require online access should not be enabled when running in offline mode.
if (!gradle.startParameter.isOffline()) {
classpath "com.gradle:build-scan-plugin:1.13.1" // Enable publishing build scans
}
}
}

/*************************************************************************************************/
// Configure the root project

apply plugin: "base"

// Plugins which require online access should not be enabled when running in offline mode.
if (!gradle.startParameter.isOffline()) {
apply plugin: "com.gradle.build-scan"
}

// This plugin provides a task to determine which dependencies have updates.
// Additionally, the plugin checks for updates to Gradle itself.
//
// See https://github.com/ben-manes/gradle-versions-plugin for further details.
apply plugin: 'com.github.ben-manes.versions'

// JENKINS_HOME and BUILD_ID set automatically during Jenkins execution
def isCIBuild = ['JENKINS_HOME', 'BUILD_ID'].every System.&getenv
if (isCIBuild) {
Expand All @@ -102,9 +56,6 @@ if (isCIBuild) {
}
}

// Apply one top level rat plugin to perform any required license enforcement analysis
apply plugin: "org.nosphere.apache.rat"

rat {
// Set input directory to that of the root project instead of the CWD. This
// makes .gitignore rules (added below) work properly.
Expand Down Expand Up @@ -272,8 +223,6 @@ task runBeamDependencyCheck() {
dependsOn ":beam-sdks-python:dependencyUpdates"
}

apply plugin: 'net.researchgate.release'

// Configure the release plugin to do only local work; the release manager determines what, if
// anything, to push. On failure, the release manager can reset the branch without pushing.
release {
Expand Down
55 changes: 45 additions & 10 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,41 @@
* limitations under the License.
*/

// Define the set of repositories and dependencies required to
// fetch and enable plugins.
buildscript { dependencies { classpath "com.diffplug.spotless:spotless-plugin-gradle:3.17.0" } }

// Plugins for configuring _this build_ of the module
plugins { id 'groovy' }

apply plugin: "com.diffplug.gradle.spotless"
plugins {
id 'java-gradle-plugin'
id 'groovy'
id "com.diffplug.gradle.spotless" version "3.17.0"
}

// Dependencies on other plugins used when this plugin
// is invoked
repositories { jcenter() }
// Define the set of repositories required to fetch and enable plugins.
repositories {
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.spring.io/plugins-release" }
}

// Dependencies on other plugins used when this plugin is invoked
dependencies {
compile gradleApi()
compile localGroovy()
compile 'com.github.jengelman.gradle.plugins:shadow:4.0.3'

runtime "net.ltgt.gradle:gradle-apt-plugin:0.20" // Enable a Java annotation processor
runtime "com.google.protobuf:protobuf-gradle-plugin:0.8.5" // Enable proto code generation
runtime "io.spring.gradle:propdeps-plugin:0.0.9.RELEASE" // Enable provided and optional configurations
runtime "com.commercehub.gradle.plugin:gradle-avro-plugin:0.11.0" // Enable Avro code generation
runtime "com.diffplug.spotless:spotless-plugin-gradle:3.17.0" // Enable a code formatting plugin
runtime "gradle.plugin.com.github.blindpirate:gogradle:0.11.2" // Enable Go code compilation
runtime "gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.20.1" // Enable building Docker containers
runtime "gradle.plugin.com.dorongold.plugins:task-tree:1.3.1" // Adds a 'taskTree' task to print task dependency tree
runtime "com.github.jengelman.gradle.plugins:shadow:4.0.3" // Enable shading Java dependencies
runtime "ca.coglinc:javacc-gradle-plugin:2.4.0" // Enable the JavaCC parser generator
runtime "gradle.plugin.io.pry.gradle.offline_dependencies:gradle-offline-dependencies-plugin:0.3" // Enable creating an offline repository
runtime "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13" // Enable errorprone Java static analysis
runtime "org.ajoberstar.grgit:grgit-gradle:3.0.0" // Enable website git publish to asf-site branch
runtime "com.avast.gradle:gradle-docker-compose-plugin:0.8.8" // Enable docker compose tasks
runtime "ca.cutterslade.gradle:gradle-dependency-analyze:1.3.0" // Enable dep analysis
}

// Because buildSrc is built and tested automatically _before_ gradle
Expand All @@ -54,3 +72,20 @@ spotless {
greclipse().configFile('greclipse.properties')
}
}

gradlePlugin {
plugins {
beamModule {
id = 'org.apache.beam.module'
implementationClass = 'org.apache.beam.gradle.BeamModulePlugin'
}
vendorJava {
id = 'org.apache.beam.vendor-java'
implementationClass = 'org.apache.beam.gradle.VendorJavaPlugin'
}
beamJenkins {
id = 'org.apache.beam.jenkins'
implementationClass = 'org.apache.beam.gradle.BeamJenkinsPlugin'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class BeamModulePlugin implements Plugin<Project> {
project.version += '-SNAPSHOT'
}

project.apply plugin: BeamJenkinsPlugin
project.apply plugin: 'org.apache.beam.jenkins'

// Register all Beam repositories and configuration tweaks
Repositories.register(project)
Expand Down
2 changes: 1 addition & 1 deletion examples/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import groovy.json.JsonOutput

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyJavaNature(exportJavadoc: false)
provideIntegrationTestingDependencies()
enableJavaPerformanceTesting()
Expand Down
2 changes: 1 addition & 1 deletion model/fn-execution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyPortabilityNature(shadowJarValidationExcludes: ["org/apache/beam/model/fnexecution/v1/**"])

description = "Apache Beam :: Model :: Fn Execution"
Expand Down
2 changes: 1 addition & 1 deletion model/job-management/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyPortabilityNature(shadowJarValidationExcludes:[
"org/apache/beam/model/expansion/v1/**",
"org/apache/beam/model/jobmanagement/v1/**",
Expand Down
2 changes: 1 addition & 1 deletion model/pipeline/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyPortabilityNature(shadowJarValidationExcludes: ["org/apache/beam/model/pipeline/v1/**"])

description = "Apache Beam :: Model :: Pipeline"
Expand Down
2 changes: 1 addition & 1 deletion release/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

apply plugin: 'groovy'
plugins { id 'groovy' }

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion runners/apex/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import groovy.json.JsonOutput

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyJavaNature()

description = "Apache Beam :: Runners :: Apex"
Expand Down
2 changes: 1 addition & 1 deletion runners/core-construction-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyJavaNature()

description = "Apache Beam :: Runners :: Core Construction Java"
Expand Down
2 changes: 1 addition & 1 deletion runners/core-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyJavaNature()

description = "Apache Beam :: Runners :: Core Java"
Expand Down
2 changes: 1 addition & 1 deletion runners/direct-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

import groovy.json.JsonOutput
plugins { id 'org.apache.beam.module' }

// Shade away runner execution utilities till because this causes ServiceLoader conflicts with
// TransformPayloadTranslatorRegistrar amongst other runners. This only happens in the DirectRunner
Expand All @@ -27,7 +28,6 @@ def dependOnProjects = [":beam-runners-core-construction-java",
":beam-runners-java-fn-execution",
":beam-sdks-java-fn-execution"]

apply plugin: org.apache.beam.gradle.BeamModulePlugin
applyJavaNature(shadowClosure: DEFAULT_SHADOW_CLOSURE << {
dependencies {
dependOnProjects.each {
Expand Down
2 changes: 1 addition & 1 deletion runners/extensions-java/metrics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyJavaNature(exportJavadoc: false)

description = "Apache Beam :: Runners :: Extensions Java :: Metrics"
Expand Down
2 changes: 1 addition & 1 deletion runners/flink/flink_runner.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import groovy.json.JsonOutput

apply plugin: org.apache.beam.gradle.BeamModulePlugin
apply plugin: 'org.apache.beam.module'
applyJavaNature()

description = "Apache Beam :: Runners :: Flink $flink_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or by directly running the generated JAR file.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
apply plugin: 'org.apache.beam.module'
applyDockerNature()

// Resolve the Flink project name (and version) the job-server-container is based on
Expand Down
4 changes: 2 additions & 2 deletions runners/flink/job-server/flink_job_server.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import org.apache.beam.gradle.BeamModulePlugin
* See build.gradle files for an example of how to use this script.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
apply plugin: "application"
apply plugin: 'org.apache.beam.module'
apply plugin: 'application'
// we need to set mainClassName before applying shadow plugin
mainClassName = "org.apache.beam.runners.flink.FlinkJobServerDriver"

Expand Down
2 changes: 1 addition & 1 deletion runners/gearpump/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import groovy.json.JsonOutput

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyJavaNature()

description = "Apache Beam :: Runners :: Gearpump"
Expand Down
2 changes: 1 addition & 1 deletion runners/google-cloud-dataflow-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import groovy.json.JsonOutput

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyJavaNature()

description = "Apache Beam :: Runners :: Google Cloud Dataflow"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import groovy.json.JsonOutput

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyJavaNature(publish: false, exportJavadoc: false)
// Evaluate the given project before this one, to allow referencing
// its sourceSets.test.output directly.
Expand Down
2 changes: 1 addition & 1 deletion runners/google-cloud-dataflow-java/examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import groovy.json.JsonOutput

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }
applyJavaNature(publish: false, exportJavadoc: false)
// Evaluate the given project before this one, to allow referencing
// its sourceSets.test.output directly.
Expand Down
2 changes: 1 addition & 1 deletion runners/google-cloud-dataflow-java/worker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }

// Set a specific version of 'com.google.apis:google-api-services-dataflow'
// by adding -Pdataflow.version=<version> in Gradle command. Otherwise,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// 2. Not have artifacts such as test results and jars write over each other.
// 3. Better compatibility with Intellij since Intellij requires separate content roots.

apply plugin: org.apache.beam.gradle.BeamModulePlugin
plugins { id 'org.apache.beam.module' }

// Set a specific version of 'com.google.apis:google-api-services-dataflow'
// by adding -Pdataflow.version=<version> in Gradle command. Otherwise,
Expand Down
Loading

0 comments on commit 7940259

Please sign in to comment.