Skip to content

Commit

Permalink
[BEAM-13430] Swap to use "mainClass" instead of "main" since it was d…
Browse files Browse the repository at this point in the history
  • Loading branch information
lukecwik authored Jan 4, 2022
1 parent 1636a3a commit 43a17a3
Show file tree
Hide file tree
Showing 25 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .test-infra/validate-runner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ if (project.hasProperty("args")) {

task runner(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = "org.apache.beam.validate.runner.Main"
mainClass = "org.apache.beam.validate.runner.Main"
args cmdargs.split()
}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ if (project.hasProperty("javaLinkageArtifactIds")) {
project.task<JavaExec>("checkJavaLinkage") {
dependsOn(project.getTasksByName("publishMavenJavaPublicationToMavenLocal", true /* recursively */))
classpath = linkageCheckerJava
main = "com.google.cloud.tools.opensource.classpath.LinkageCheckerMain"
mainClass.value("com.google.cloud.tools.opensource.classpath.LinkageCheckerMain")
val javaLinkageArtifactIds: String = project.property("javaLinkageArtifactIds") as String? ?: ""
var arguments = arrayOf("-a", javaLinkageArtifactIds.split(",").joinToString(",") {
if (it.contains(":")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ class BeamModulePlugin implements Plugin<Project> {
}

project.task("jmh", type: JavaExec, dependsOn: project.jmhClasses, {
main = "org.openjdk.jmh.Main"
mainClass = "org.openjdk.jmh.Main"
classpath = project.sourceSets.jmh.compileClasspath + project.sourceSets.jmh.runtimeClasspath
// For a list of arguments, see
// https://github.com/guozheng/jmh-tutorial/blob/master/README.md
Expand Down Expand Up @@ -2095,7 +2095,7 @@ class BeamModulePlugin implements Plugin<Project> {
project.task(taskName, dependsOn: ':release:classes', type: JavaExec) {
group = "Verification"
description = "Run the Beam ${config.type} with the ${config.runner} runner"
main = "${config.type}-java-${config.runner}".toLowerCase()
mainClass = "${config.type}-java-${config.runner}".toLowerCase()
classpath = project.project(':release').sourceSets.main.runtimeClasspath
args argsNeeded
}
Expand Down
4 changes: 2 additions & 2 deletions examples/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ task preCommit() {
}

task execute (type:JavaExec) {
main = System.getProperty("mainClass")
mainClass = System.getProperty("mainClass")
classpath = sourceSets.main.runtimeClasspath
systemProperties System.getProperties()
args System.getProperty("exec.args", "").split()
Expand All @@ -165,7 +165,7 @@ task execute (type:JavaExec) {
// Run this task to validate the Java environment setup for contributors
task wordCount(type:JavaExec) {
description "Run the Java word count example"
main = "org.apache.beam.examples.WordCount"
mainClass = "org.apache.beam.examples.WordCount"
classpath = sourceSets.main.runtimeClasspath
systemProperties = System.getProperties()
args = ["--output=/tmp/ouput.txt"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
* to execute the pipeline:
* {@code
* task execute (type:JavaExec) {
* main = System.getProperty("mainClass")
* mainClass = System.getProperty("mainClass")
* classpath = sourceSets.main.runtimeClasspath
* systemProperties System.getProperties()
* args System.getProperty("exec.args", "").split()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ To run this example your `build.gradle` file should contain the following task t

```
task execute (type:JavaExec) {
main = System.getProperty("mainClass")
mainClass = System.getProperty("mainClass")
classpath = sourceSets.main.runtimeClasspath
systemProperties System.getProperties()
args System.getProperty("exec.args", "").split()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
* to execute the pipeline:
* {@code
* task execute (type:JavaExec) {
* main = System.getProperty("mainClass")
* mainClass = System.getProperty("mainClass")
* classpath = sourceSets.main.runtimeClasspath
* systemProperties System.getProperties()
* args System.getProperty("exec.args", "").split()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ To run this example your `build.gradle` file should contain the following task t

```
task execute (type:JavaExec) {
main = System.getProperty("mainClass")
mainClass = System.getProperty("mainClass")
classpath = sourceSets.main.runtimeClasspath
systemProperties System.getProperties()
args System.getProperty("exec.args", "").split()
Expand Down
2 changes: 1 addition & 1 deletion examples/java/twitter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ task preCommit() {
}

task execute (type:JavaExec) {
main = "org.apache.beam.examples.twitterstreamgenerator.TwitterStream"
mainClass = "org.apache.beam.examples.twitterstreamgenerator.TwitterStream"
}
2 changes: 1 addition & 1 deletion runners/flink/flink_runner.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def createPipelineOptionsTableTask(String target) {
group = 'Website'
description = "Generates a table with pipeline options for the Flink Runner documentation page"
classpath = sourceSets.test.runtimeClasspath
main = 'org.apache.beam.runners.flink.website.PipelineOptionsTableGenerator'
mainClass = 'org.apache.beam.runners.flink.website.PipelineOptionsTableGenerator'
args = [target]
standardOutput = new ByteArrayOutputStream()
doLast {
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 @@ -711,7 +711,7 @@ createJavaExamplesArchetypeValidationTask(type: 'MobileGaming',

// Standalone task for testing GCS upload, use with -PfilesToStage and -PdataflowTempRoot.
task GCSUpload(type: JavaExec) {
main = 'org.apache.beam.runners.dataflow.util.GCSUploadMain'
mainClass = 'org.apache.beam.runners.dataflow.util.GCSUploadMain'
classpath = sourceSets.test.runtimeClasspath
args "--stagingLocation=${dataflowUploadTemp}/staging",
"--filesToStage=${testFilesToStage}"
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/expansion-service/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
}

task runExpansionService (type: JavaExec) {
main = "org.apache.beam.sdk.expansion.service.ExpansionService"
mainClass = "org.apache.beam.sdk.expansion.service.ExpansionService"
classpath = sourceSets.main.runtimeClasspath
args = [project.findProperty("constructionService.port") ?: "8097"]
}
2 changes: 1 addition & 1 deletion sdks/java/expansion-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies {
}

task runExpansionService (type: JavaExec) {
main = "org.apache.beam.sdk.expansion.service.ExpansionService"
mainClass = "org.apache.beam.sdk.expansion.service.ExpansionService"
classpath = sourceSets.main.runtimeClasspath
args = [project.findProperty("constructionService.port") ?: "8097"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
}

task runExpansionService (type: JavaExec) {
main = "org.apache.beam.sdk.expansion.service.ExpansionService"
mainClass = "org.apache.beam.sdk.expansion.service.ExpansionService"
classpath = sourceSets.test.runtimeClasspath
args = [project.findProperty("constructionService.port") ?: "8097"]
}
4 changes: 2 additions & 2 deletions sdks/java/extensions/sql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ idea {
// Run basic SQL example
task runBasicExample(type: JavaExec) {
description = "Run basic SQL example"
main = "org.apache.beam.sdk.extensions.sql.example.BeamSqlExample"
mainClass = "org.apache.beam.sdk.extensions.sql.example.BeamSqlExample"
classpath = sourceSets.main.runtimeClasspath
args = ["--runner=DirectRunner"]
}

// Run SQL example on POJO inputs
task runPojoExample(type: JavaExec) {
description = "Run SQL example for PCollections of POJOs"
main = "org.apache.beam.sdk.extensions.sql.example.BeamSqlPojoExample"
mainClass = "org.apache.beam.sdk.extensions.sql.example.BeamSqlPojoExample"
classpath = sourceSets.main.runtimeClasspath
args = ["--runner=DirectRunner"]
}
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/extensions/sql/datacatalog/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {

task runDataCatalogExample(type: JavaExec) {
description = "Run SQL example of how to use Data Catalog table provider"
main = "org.apache.beam.sdk.extensions.sql.example.BeamSqlDataCatalogExample"
mainClass = "org.apache.beam.sdk.extensions.sql.example.BeamSqlDataCatalogExample"
classpath = sourceSets.main.runtimeClasspath

def runner = project.findProperty('runner') ?: 'DirectRunner'
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/extensions/sql/expansion-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {
}

task runExpansionService (type: JavaExec) {
main = "org.apache.beam.sdk.expansion.service.ExpansionService"
mainClass = "org.apache.beam.sdk.expansion.service.ExpansionService"
classpath = sourceSets.main.runtimeClasspath
args = [project.findProperty("constructionService.port") ?: "8097"]
}
2 changes: 1 addition & 1 deletion sdks/java/io/expansion-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
}

task runExpansionService (type: JavaExec) {
main = "org.apache.beam.sdk.expansion.service.ExpansionService"
mainClass = "org.apache.beam.sdk.expansion.service.ExpansionService"
classpath = sourceSets.test.runtimeClasspath
args = [project.findProperty("constructionService.port") ?: "8097"]
}
2 changes: 1 addition & 1 deletion sdks/java/testing/expansion-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies {
}

task runTestExpansionService (type: JavaExec) {
main = "org.apache.beam.sdk.expansion.service.ExpansionService"
mainClass = "org.apache.beam.sdk.expansion.service.ExpansionService"
classpath = sourceSets.test.runtimeClasspath
args = [project.findProperty("constructionService.port") ?: "8097"]
}
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/testing/kafka-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies {
}

task runTestKafkaService (type: JavaExec) {
main = "org.apache.beam.sdk.testing.kafka.LocalKafka"
mainClass = "org.apache.beam.sdk.testing.kafka.LocalKafka"
classpath = sourceSets.test.runtimeClasspath
args = [
project.findProperty("kafka.port") ?: "9092",
Expand Down
3 changes: 1 addition & 2 deletions sdks/java/testing/load-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ description = "Apache Beam :: SDKs :: Java :: Load Tests"


def mainClassProperty = "loadTest.mainClass"
def mainClass = project.findProperty(mainClassProperty)

// When running via Gradle, this property can be used to pass commandline arguments
// to the load-tests launch
Expand Down Expand Up @@ -135,7 +134,7 @@ task run(type: JavaExec) {
dependsOn ":runners:google-cloud-dataflow-java:worker:legacy-worker:shadowJar"
}
}
main = mainClass
mainClass = project.findProperty(mainClassProperty)
classpath = configurations.gradleRun
args loadTestArgsList.toArray()
}
2 changes: 1 addition & 1 deletion sdks/java/testing/nexmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ task run(type: JavaExec) {
dependsOn ":runners:google-cloud-dataflow-java:worker:legacy-worker:shadowJar"
}
}
main = "org.apache.beam.sdk.nexmark.Main"
mainClass = "org.apache.beam.sdk.nexmark.Main"
classpath = configurations.gradleRun
args nexmarkArgsList.toArray()
}
2 changes: 1 addition & 1 deletion sdks/java/testing/tpcds/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ task run(type: JavaExec) {
tpcdsArgsList.add('--workerHarnessContainerImage=')
}

main = "org.apache.beam.sdk.tpcds.BeamTpcds"
mainClass = "org.apache.beam.sdk.tpcds.BeamTpcds"
classpath = configurations.gradleRun
args tpcdsArgsList.toArray()
}
2 changes: 1 addition & 1 deletion sdks/java/testing/watermarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ task run(type: JavaExec) {
" --workerHarnessContainerImage="
}

main = mainClass
mainClass = mainClass
classpath = configurations.gradleRun
args loadTestArgs.split()
}
Expand Down
2 changes: 1 addition & 1 deletion website/www/site/content/en/get-started/quickstart-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ repositories {
1. Add the following task in `build.gradle` to allow you to execute pipelines with Gradle:
{{< highlight >}}
task execute (type:JavaExec) {
main = System.getProperty("mainClass")
mainClass = System.getProperty("mainClass")
classpath = sourceSets.main.runtimeClasspath
systemProperties System.getProperties()
args System.getProperty("exec.args", "").split()
Expand Down

0 comments on commit 43a17a3

Please sign in to comment.