Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ runners/**/vendor/**/*
# Ignore generated archetypes
sdks/java/maven-archetypes/examples/src/main/resources/archetype-resources/src/
sdks/java/maven-archetypes/examples-java8/src/main/resources/archetype-resources/src/
sdks/java/maven-archetypes/gcp-bom-examples/src/main/resources/archetype-resources/src/

# Ignore files generated by the Python build process.
**/*.pyc
Expand Down
1 change: 1 addition & 0 deletions release/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ task runJavaExamplesValidationTask {
dependsOn ":runners:direct-java:runMobileGamingJavaDirect"
dependsOn ":runners:google-cloud-dataflow-java:runMobileGamingJavaDataflow"
dependsOn ":runners:twister2:runQuickstartJavaTwister2"
dependsOn ":runners:google-cloud-dataflow-java:runMobileGamingJavaDataflowBom"
}
44 changes: 44 additions & 0 deletions release/src/main/groovy/GoogleCloudPlatformBomArchetype.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!groovy
/*
* 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.
*/
class GoogleCloudPlatformBomArchetype {
def static generate(TestScripts t) {
// Generate a maven project from the snapshot repository
String output_text = t.run """mvn archetype:generate \
--update-snapshots \
-DarchetypeGroupId=org.apache.beam \
-DarchetypeArtifactId=beam-sdks-java-maven-archetypes-gcp-bom-examples \
-DarchetypeVersion=${t.ver()} \
-DgroupId=org.example \
-DartifactId=word-count-beam \
-Dversion="0.1" \
-Dpackage=org.apache.beam.examples \
-DinteractiveMode=false"""

// Check if it was generated
t.see "[INFO] BUILD SUCCESS", output_text
t.run "cd word-count-beam"
output_text = t.run "ls"
t.see "pom.xml", output_text
t.see "src", output_text
String wordcounts = t.run "ls src/main/java/org/apache/beam/examples/"
t.see "WordCount.java", wordcounts
String games = t.run "ls src/main/java/org/apache/beam/examples/complete/game/"
t.see "UserScore.java", games
}
}
61 changes: 61 additions & 0 deletions release/src/main/groovy/mobilegaming-java-dataflowbom.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!groovy
/*
* 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.
*/

t = new TestScripts(args)
mobileGamingCommands = new MobileGamingCommands(testScripts: t)

/*
* Run the mobile game examples on Dataflow.
* https://beam.apache.org/get-started/mobile-gaming-example/
*/

t.describe ('Run Apache Beam Java SDK Mobile Gaming Examples using GCP BOM - Dataflow')

GoogleCloudPlatformBomArchetype.generate(t)

def runner = "DataflowRunner"
String command_output_text

/**
* Run the UserScore example on DataflowRunner
* */

t.intent("Running: UserScore example with Beam GCP BOM on DataflowRunner")
t.run(mobileGamingCommands.createPipelineCommand("UserScore", runner))
command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}* | grep user19_BananaWallaby"
t.see "total_score: 231, user: user19_BananaWallaby", command_output_text
t.success("UserScore successfully run on DataflowRunner.")
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}*"


/**
* Run the HourlyTeamScore example on DataflowRunner
* */

t.intent("Running: HourlyTeamScore example with Beam GCP BOM on DataflowRunner")
t.run(mobileGamingCommands.createPipelineCommand("HourlyTeamScore", runner))
command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}* | grep AzureBilby "
t.see "total_score: 2788, team: AzureBilby", command_output_text
t.success("HourlyTeamScore successfully run on DataflowRunner.")
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}*"

new LeaderBoardRunner().run(runner, t, mobileGamingCommands, false)
new LeaderBoardRunner().run(runner, t, mobileGamingCommands, true)

t.done()
11 changes: 11 additions & 0 deletions release/src/main/scripts/run_rc_validation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,17 @@ if [[ ("$java_mobile_game_direct" = true || "$java_mobile_game_dataflow" = true)
-PbqDataset=${MOBILE_GAME_DATASET} \
-PpubsubTopic=${MOBILE_GAME_PUBSUB_TOPIC} \
-PgcsBucket=${USER_GCS_BUCKET:5} # skip 'gs://' prefix

echo "**************************************************************************"
echo "* Java mobile game on DataflowRunner using Beam GCP BOM: UserScore, HourlyTeamScore, Leaderboard"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be included as part of the release validation spreadsheet?
In other words, is this required to pass to validate the RC?

echo "**************************************************************************"
./gradlew :runners:google-cloud-dataflow-java:runMobileGamingJavaDataflowBom \
-Prepourl=${REPO_URL} \
-Pver=${RELEASE_VER} \
-PgcpProject=${USER_GCP_PROJECT} \
-PbqDataset=${MOBILE_GAME_DATASET} \
-PpubsubTopic=${MOBILE_GAME_PUBSUB_TOPIC} \
-PgcsBucket=${USER_GCS_BUCKET:5} # skip 'gs://' prefix
else
echo "* Skip Java Mobile Game on DataflowRunner."
fi
Expand Down
9 changes: 9 additions & 0 deletions runners/google-cloud-dataflow-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,15 @@ createJavaExamplesArchetypeValidationTask(type: 'MobileGaming',
bqDataset: bqDataset,
pubsubTopic: pubsubTopic)

// Generates :runners:google-cloud-dataflow-java:runMobileGamingJavaDataflowBom
createJavaExamplesArchetypeValidationTask(type: 'MobileGaming',
runner: 'DataflowBom',
gcpProject: gcpProject,
gcpRegion: gcpRegion,
gcsBucket: gcsBucket,
bqDataset: bqDataset,
pubsubTopic: pubsubTopic)

// Standalone task for testing GCS upload, use with -PfilesToStage and -PdataflowTempRoot.
task GCSUpload(type: JavaExec) {
main = 'org.apache.beam.runners.dataflow.util.GCSUploadMain'
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ext {
}

for (p in rootProject.subprojects) {
if (!p.path.equals(project.path)) {
if (!p.path.startsWith(project.path)) {
evaluationDependsOn(p.path)
}
}
Expand Down
128 changes: 128 additions & 0 deletions sdks/java/bom/common.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* 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.
*/

apply plugin: 'org.apache.beam.module'
apply plugin: 'maven-publish'
apply plugin: 'java-platform'

javaPlatform {
allowDependencies()
}

def isRelease(Project project) {
return project.hasProperty('isRelease')
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.mavenGroupId
artifactId = archivesBaseName
version = project.version
pom {
name = project.description
if (project.hasProperty("summary")) {
description = project.summary
}
url = "https://beam.apache.org"
inceptionYear = "2016"
licenses {
license {
name = "Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}
scm {
connection = "scm:git:https://gitbox.apache.org/repos/asf/beam.git"
developerConnection = "scm:git:https://gitbox.apache.org/repos/asf/beam.git"
url = "https://gitbox.apache.org/repos/asf?p=beam.git;a=summary"
}
issueManagement {
system = "jira"
url = "https://issues.apache.org/jira/browse/BEAM"
}
mailingLists {
mailingList {
name = "Beam Dev"
subscribe = "dev-subscribe@beam.apache.org"
unsubscribe = "dev-unsubscribe@beam.apache.org"
post = "dev@beam.apache.org"
archive = "https://www.mail-archive.com/dev@beam.apache.org"
}
mailingList {
name = "Beam User"
subscribe = "user-subscribe@beam.apache.org"
unsubscribe = "user-unsubscribe@beam.apache.org"
post = "user@beam.apache.org"
archive = "https://www.mail-archive.com/user@beam.apache.org"
}
mailingList {
name = "Beam Commits"
subscribe = "commits-subscribe@beam.apache.org"
unsubscribe = "commits-unsubscribe@beam.apache.org"
post = "commits@beam.apache.org"
archive = "https://www.mail-archive.com/commits@beam.apache.org"
}
}
developers {
developer {
name = "The Apache Beam Team"
email = "dev@beam.apache.org"
url = "https://beam.apache.org"
organization = "Apache Software Foundation"
organizationUrl = "https://www.apache.org"
}
}
}

pom.withXml {
def elem = asElement()
def hdr = elem.getOwnerDocument().createComment(
'''
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.
''')
elem.insertBefore(hdr, elem.getFirstChild())
}

from components.javaPlatform
}
}

repositories project.ext.repositories
}

// Only sign artifacts if we are performing a release
if (isRelease(project) && !project.hasProperty('noSigning')) {
apply plugin: "signing"
signing {
useGpgCmd()
sign publishing.publications
}
}
35 changes: 35 additions & 0 deletions sdks/java/bom/gcp/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.
*/

apply from: '../common.gradle'

dependencies {
api platform(project(":sdks:java:bom"))
api platform(project.library.java.google_cloud_platform_libraries_bom)
constraints {
api project.library.java.guava
}
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'beam-sdks-java-google-cloud-platform-bom'
}
}
}
4 changes: 2 additions & 2 deletions sdks/java/javadoc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ applyJavaNature(publish: false)
description = "Apache Beam :: SDKs :: Java :: Aggregated Javadoc"

for (p in rootProject.subprojects) {
if (!p.path.equals(project.path) && !p.path.equals(':sdks:java:bom')) {
if (!p.path.equals(project.path) && !p.path.startsWith(':sdks:java:bom')) {
evaluationDependsOn(p.path)
}
}

ext.getExportedJavadocProjects = {
def exportedJavadocProjects = new ArrayList<>();
for (p in rootProject.subprojects) {
if (!p.path.equals(project.path) && !p.path.equals(':sdks:java:bom')) {
if (!p.path.equals(project.path) && !p.path.startsWith(':sdks:java:bom')) {
def subproject = p // project(':' + p.name)
if (subproject.ext.properties.containsKey('exportJavadoc') &&
subproject.ext.properties.exportJavadoc) {
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/maven-archetypes/examples/generate-sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Usage: Invoke with no arguments from any working directory.

# The directory of this script. Assumes root of the maven-archetypes module.
HERE="$( dirname "$0" )"
HERE=${HERE-"$( dirname "$0" )"}

# The directory of the examples-java module
EXAMPLES_ROOT="${HERE}/../../../../examples/java"
Expand Down
Loading