blob: c040dd5d8d0f05c43fcb79ab340cd914874cd0bd [file] [log] [blame]
/*
* 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.
*/
plugins { id 'org.apache.beam.module' }
applyGoNature()
description = "Apache Beam :: SDKs :: Go :: Examples"
def getLocalPlatform = {
String hostOs = com.github.blindpirate.gogradle.crossplatform.Os.getHostOs()
String hostArch = com.github.blindpirate.gogradle.crossplatform.Arch.getHostArch()
return hostOs + '-' + hostArch
}
// 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 ":sdks:go:goBuild"
dependencies {
golang {
// TODO(herohde): use "./" prefix to prevent gogradle use base github path, for now.
// TODO(herohde): get the pkg subdirectory only, if possible. We spend mins pulling cmd/beamctl deps.
build name: './github.com/apache/beam/sdks/go', dir: project(':sdks:go').projectDir
test name: './github.com/apache/beam/sdks/go', dir: project(':sdks:go').projectDir
}
}
golang {
packagePath = 'github.com/apache/beam/sdks/go/examples'
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.
//
// TODO: Move this into build_rules.gradle applyGoNature. This currently
// can't be done because com.github.blindpirate.gogradle.crossplatform.*
// is not found within when invoked from within build_rules.gradle applyGoNature
targetPlatform = [getLocalPlatform(), 'linux-amd64']
// Build all the examples
go 'build -o ./build/bin/${GOOS}_${GOARCH}/autocomplete github.com/apache/beam/sdks/go/examples/complete/autocomplete'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/combine github.com/apache/beam/sdks/go/examples/cookbook/combine'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/contains github.com/apache/beam/sdks/go/examples/contains'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/debugging_wordcount github.com/apache/beam/sdks/go/examples/debugging_wordcount'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/filter github.com/apache/beam/sdks/go/examples/cookbook/filter'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/forest github.com/apache/beam/sdks/go/examples/forest'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/grades github.com/apache/beam/sdks/go/examples/grades'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/join github.com/apache/beam/sdks/go/examples/cookbook/join'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/max github.com/apache/beam/sdks/go/examples/cookbook/max'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/minimal_wordcount github.com/apache/beam/sdks/go/examples/minimal_wordcount'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/pingpong github.com/apache/beam/sdks/go/examples/pingpong'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/tornadoes github.com/apache/beam/sdks/go/examples/cookbook/tornadoes'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/windowed_wordcount github.com/apache/beam/sdks/go/examples/windowed_wordcount'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/wordcount github.com/apache/beam/sdks/go/examples/wordcount'
go 'build -o ./build/bin/${GOOS}_${GOARCH}/yatzy github.com/apache/beam/sdks/go/examples/yatzy'
}
// Ignore spurious vet errors during check for [BEAM-8992].
goVet {
continueOnFailure = true
}
}