Skip to content

Commit

Permalink
Merge pull request apache#7762: upgrade to gogradle plugin 0.11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
swegner authored Feb 8, 2019
2 parents 1fb4740 + 02be861 commit 622c9c8
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 19 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ buildscript {
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.10" // Enable Go code compilation
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
Expand Down Expand Up @@ -212,7 +212,7 @@ task javaPostCommitPortabilityApi () {
}

task goPreCommit() {
dependsOn ":beam-sdks-go:test"
dependsOn ":beam-sdks-go:goTest"

dependsOn ":beam-sdks-go-examples:build"
dependsOn ":beam-sdks-go-test:build"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,9 @@ class BeamModulePlugin implements Plugin<Project> {
/** ***********************************************************************************************/

project.ext.applyGoNature = {
// Define common lifecycle tasks and artifact types
project.apply plugin: 'base'

project.apply plugin: "com.github.blindpirate.gogradle"
project.golang { goVersion = '1.10' }

Expand All @@ -1285,6 +1288,9 @@ class BeamModulePlugin implements Plugin<Project> {
root 'github.com/apache/thrift'
emptyDir()
}
project.clean.dependsOn project.goClean
project.check.dependsOn project.goCheck
project.assemble.dependsOn project.goBuild
}

project.idea {
Expand Down
4 changes: 2 additions & 2 deletions sdks/go/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ description = "Apache Beam :: SDKs :: Go"
golang {
packagePath = 'github.com/apache/beam/sdks/go'

build {
goBuild {
// The symlinks makes it hard (impossible?) to do a wildcard build
// of pkg. Go build refuses to follow symlinks. Drop for now. The files
// are built when tested anyway.
Expand All @@ -37,7 +37,7 @@ golang {
}

// Ignore spurious vet errors during check for [BEAM-4831].
vet {
goVet {
continueOnFailure = true
}
}
6 changes: 3 additions & 3 deletions sdks/go/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ description = "Apache Beam :: SDKs :: Go :: Container"
// Figure out why the golang plugin does not add a build dependency between projects.
// Without the line below, we get spurious errors about not being able to resolve
// "./github.com/apache/beam/sdks/go"
resolveBuildDependencies.dependsOn ":beam-sdks-go:build"
resolveBuildDependencies.dependsOn ":beam-sdks-go:goBuild"

dependencies {
golang {
Expand All @@ -38,7 +38,7 @@ dependencies {

golang {
packagePath = 'github.com/apache/beam/sdks/go/boot'
build {
goBuild {
// TODO(herohde): build local platform + linux-amd64, if possible.
targetPlatform = ['linux-amd64']
outputLocation = './build/target/${GOOS}_${GOARCH}/boot'
Expand All @@ -50,4 +50,4 @@ docker {
files "./build/"
}
// Ensure that making the docker image builds any required artifacts
dockerPrepare.dependsOn build
dockerPrepare.dependsOn goBuild
4 changes: 2 additions & 2 deletions sdks/go/examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def getLocalPlatform = {
// Figure out why the golang plugin does not add a build dependency between projects.
// Without the line below, we get spurious errors about not being able to resolve
// "./github.com/apache/beam/sdks/go"
resolveBuildDependencies.dependsOn ":beam-sdks-go:build"
resolveBuildDependencies.dependsOn ":beam-sdks-go:goBuild"

dependencies {
golang {
Expand All @@ -43,7 +43,7 @@ dependencies {

golang {
packagePath = 'github.com/apache/beam/sdks/go/examples'
build {
goBuild {
// We always want to build linux-amd64 in addition to the user host platform
// so we can submit this as the remote binary used within the Go container.
//
Expand Down
4 changes: 2 additions & 2 deletions sdks/go/test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ description = "Apache Beam :: SDKs :: Go :: Test"
// Figure out why the golang plugin does not add a build dependency between projects.
// Without the line below, we get spurious errors about not being able to resolve
// "./github.com/apache/beam/sdks/go"
resolveBuildDependencies.dependsOn ":beam-sdks-go:build"
resolveBuildDependencies.dependsOn ":beam-sdks-go:goBuild"

dependencies {
golang {
Expand All @@ -37,7 +37,7 @@ dependencies {

golang {
packagePath = 'github.com/apache/beam/sdks/go/test'
build {
goBuild {
// Build the linux-amd64 worker. The native version is built in the parent to
// have a fixed name, which is not possible with multiple target platforms. The
// script would otherwise have to figure out which arch/platform binary to invoke.
Expand Down
6 changes: 3 additions & 3 deletions sdks/java/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ description = "Apache Beam :: SDKs :: Java :: Container"
// Figure out why the golang plugin does not add a build dependency between projects.
// Without the line below, we get spurious errors about not being able to resolve
// "./github.com/apache/beam/sdks/go"
resolveBuildDependencies.dependsOn ":beam-sdks-go:build"
resolveBuildDependencies.dependsOn ":beam-sdks-go:goBuild"

configurations {
dockerDependency
Expand Down Expand Up @@ -53,7 +53,7 @@ task copyDockerfileDependencies(type: Copy) {

golang {
packagePath = 'github.com/apache/beam/sdks/java/boot'
build {
goBuild {
// TODO(herohde): build local platform + linux-amd64, if possible.
targetPlatform = ['linux-amd64']
outputLocation = './build/target/${GOOS}_${GOARCH}/boot'
Expand All @@ -65,5 +65,5 @@ docker {
files "./build/"
}
// Ensure that we build the required resources and copy and file dependencies from related projects
dockerPrepare.dependsOn build
dockerPrepare.dependsOn goBuild
dockerPrepare.dependsOn copyDockerfileDependencies
10 changes: 5 additions & 5 deletions sdks/python/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ description = "Apache Beam :: SDKs :: Python :: Container"
// Figure out why the golang plugin does not add a build dependency between projects.
// Without the line below, we get spurious errors about not being able to resolve
// "./github.com/apache/beam/sdks/go"
resolveBuildDependencies.dependsOn ":beam-sdks-go:build"
resolveBuildDependencies.dependsOn ":beam-sdks-go:goBuild"

configurations {
sdkSourceTarball
Expand All @@ -42,7 +42,7 @@ dependencies {
sdkSourceTarball project(path: ":beam-sdks-python", configuration: "distConfig")
}

task copyDockerfileDependencies(type: Copy, dependsOn: build) {
task copyDockerfileDependencies(type: Copy, dependsOn: goBuild) {
from configurations.sdkSourceTarball
from file("./base_image_requirements.txt")
into "build/target"
Expand All @@ -53,7 +53,7 @@ task copyDockerfileDependencies(type: Copy, dependsOn: build) {

golang {
packagePath = 'github.com/apache/beam/sdks/python/boot'
build {
goBuild {
// Build for linux and mac.
targetPlatform = ['linux-amd64', 'darwin-amd64']
outputLocation = './build/target/launcher/${GOOS}_${GOARCH}/boot'
Expand All @@ -66,9 +66,9 @@ docker {
}

artifacts {
sdkHarnessLauncher file: file('./build/target/launcher'), builtBy: build
sdkHarnessLauncher file: file('./build/target/launcher'), builtBy: goBuild
}

// Ensure that making the docker image builds any required artifacts
dockerPrepare.dependsOn build
dockerPrepare.dependsOn goBuild
dockerPrepare.dependsOn copyDockerfileDependencies

0 comments on commit 622c9c8

Please sign in to comment.