Skip to content

Commit e8b41d7

Browse files
authored
Fix execute gradle task for examples (#36421)
1 parent 4181f6f commit e8b41d7

4 files changed

Lines changed: 32 additions & 81 deletions

File tree

examples/java/build.gradle

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,6 @@ artifact includes all Apache Beam Java SDK examples."""
3838

3939
apply from: "$projectDir/common.gradle"
4040

41-
/** Define the list of runners which execute a precommit test.
42-
* Some runners are run from separate projects, see the preCommit task below
43-
* for details.
44-
*/
45-
def preCommitRunners = ["directRunner", "flinkRunner", "sparkRunner"]
46-
// The following runners have configuration created but not added to preCommit
47-
def nonPreCommitRunners = ["dataflowRunner", "prismRunner"]
48-
for (String runner : preCommitRunners) {
49-
configurations.create(runner + "PreCommit")
50-
}
51-
for (String runner: nonPreCommitRunners) {
52-
configurations.create(runner + "PreCommit")
53-
}
54-
configurations.sparkRunnerPreCommit {
55-
// Ban certain dependencies to prevent a StackOverflow within Spark
56-
// because JUL -> SLF4J -> JUL, and similarly JDK14 -> SLF4J -> JDK14
57-
exclude group: "org.slf4j", module: "jul-to-slf4j"
58-
exclude group: "org.slf4j", module: "slf4j-jdk14"
59-
}
60-
6141
dependencies {
6242
implementation enforcedPlatform(library.java.google_cloud_platform_libraries_bom)
6343
implementation library.java.vendored_guava_32_1_2_jre
@@ -124,14 +104,6 @@ dependencies {
124104
for (String runner : preCommitRunners) {
125105
delegate.add(runner + "PreCommit", project(path: ":examples:java", configuration: "testRuntimeMigration"))
126106
}
127-
directRunnerPreCommit project(path: ":runners:direct-java", configuration: "shadow")
128-
flinkRunnerPreCommit project(":runners:flink:${project.ext.latestFlinkVersion}")
129-
sparkRunnerPreCommit project(":runners:spark:3")
130-
sparkRunnerPreCommit project(":sdks:java:io:hadoop-file-system")
131-
dataflowRunnerPreCommit project(":runners:google-cloud-dataflow-java")
132-
dataflowRunnerPreCommit project(":runners:google-cloud-dataflow-java:worker") // v2 worker
133-
dataflowRunnerPreCommit project(":sdks:java:harness") // v2 worker
134-
prismRunnerPreCommit project(":runners:prism:java")
135107

136108
// Add dependency if requested on command line for runner
137109
if (project.hasProperty("runnerDependency")) {

examples/java/common.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,37 @@
1616
* limitations under the License.
1717
*/
1818

19+
/** Define the list of runners which execute a precommit test.
20+
* Some runners are run from separate projects, see the preCommit task below
21+
* for details.
22+
*/
23+
project.ext.preCommitRunners = ["directRunner", "flinkRunner", "sparkRunner"]
24+
// The following runners have configuration created but not added to preCommit
25+
project.ext.nonPreCommitRunners = ["dataflowRunner", "prismRunner"]
26+
for (String runner : ext.preCommitRunners) {
27+
configurations.create(runner + "PreCommit")
28+
}
29+
for (String runner: ext.nonPreCommitRunners) {
30+
configurations.create(runner + "PreCommit")
31+
}
32+
configurations.sparkRunnerPreCommit {
33+
// Ban certain dependencies to prevent a StackOverflow within Spark
34+
// because JUL -> SLF4J -> JUL, and similarly JDK14 -> SLF4J -> JDK14
35+
exclude group: "org.slf4j", module: "jul-to-slf4j"
36+
exclude group: "org.slf4j", module: "slf4j-jdk14"
37+
}
38+
39+
dependencies {
40+
directRunnerPreCommit project(path: ":runners:direct-java", configuration: "shadow")
41+
flinkRunnerPreCommit project(":runners:flink:${project.ext.latestFlinkVersion}")
42+
sparkRunnerPreCommit project(":runners:spark:3")
43+
sparkRunnerPreCommit project(":sdks:java:io:hadoop-file-system")
44+
dataflowRunnerPreCommit project(":runners:google-cloud-dataflow-java")
45+
dataflowRunnerPreCommit project(":runners:google-cloud-dataflow-java:worker") // v1 worker
46+
dataflowRunnerPreCommit project(":sdks:java:harness") // v2 worker
47+
prismRunnerPreCommit project(":runners:prism:java")
48+
}
49+
1950
/*
2051
* A convenient task to run individual example directly on Beam repo.
2152
*

examples/java/iceberg/build.gradle

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,6 @@ ext.summary = """Apache Beam Java SDK examples using IcebergIO."""
3535

3636
apply from: "$project.rootDir/examples/java/common.gradle"
3737

38-
/** Define the list of runners which execute a precommit test.
39-
* Some runners are run from separate projects, see the preCommit task below
40-
* for details.
41-
*/
42-
def preCommitRunners = ["directRunner", "flinkRunner", "sparkRunner"]
43-
// The following runners have configuration created but not added to preCommit
44-
def nonPreCommitRunners = ["dataflowRunner", "prismRunner"]
45-
for (String runner : preCommitRunners) {
46-
configurations.create(runner + "PreCommit")
47-
}
48-
for (String runner: nonPreCommitRunners) {
49-
configurations.create(runner + "PreCommit")
50-
}
51-
configurations.sparkRunnerPreCommit {
52-
// Ban certain dependencies to prevent a StackOverflow within Spark
53-
// because JUL -> SLF4J -> JUL, and similarly JDK14 -> SLF4J -> JDK14
54-
exclude group: "org.slf4j", module: "jul-to-slf4j"
55-
exclude group: "org.slf4j", module: "slf4j-jdk14"
56-
}
57-
5838
dependencies {
5939
implementation enforcedPlatform(library.java.google_cloud_platform_libraries_bom)
6040
runtimeOnly project(":sdks:java:io:iceberg")
@@ -75,14 +55,6 @@ dependencies {
7555
for (String runner : preCommitRunners) {
7656
delegate.add(runner + "PreCommit", project(path: ":examples:java", configuration: "testRuntimeMigration"))
7757
}
78-
directRunnerPreCommit project(path: ":runners:direct-java", configuration: "shadow")
79-
flinkRunnerPreCommit project(":runners:flink:${project.ext.latestFlinkVersion}")
80-
sparkRunnerPreCommit project(":runners:spark:3")
81-
sparkRunnerPreCommit project(":sdks:java:io:hadoop-file-system")
82-
dataflowRunnerPreCommit project(":runners:google-cloud-dataflow-java")
83-
dataflowRunnerPreCommit project(":runners:google-cloud-dataflow-java:worker") // v2 worker
84-
dataflowRunnerPreCommit project(":sdks:java:harness") // v2 worker
85-
prismRunnerPreCommit project(":runners:prism:java")
8658

8759
// Add dependency if requested on command line for runner
8860
if (project.hasProperty("runnerDependency")) {

examples/java/sql/build.gradle

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,7 @@ ext.summary = """Apache Beam SDK provides a simple, Java-based
3636
interface for processing virtually any size data. This
3737
artifact includes all Apache Beam Java SDK examples."""
3838

39-
/** Define the list of runners which execute a precommit test.
40-
* Some runners are run from separate projects, see the preCommit task below
41-
* for details.
42-
*/
43-
def preCommitRunners = ["directRunner", "flinkRunner", "sparkRunner"]
44-
for (String runner : preCommitRunners) {
45-
configurations.create(runner + "PreCommit")
46-
}
47-
configurations.sparkRunnerPreCommit {
48-
// Ban certain dependencies to prevent a StackOverflow within Spark
49-
// because JUL -> SLF4J -> JUL, and similarly JDK14 -> SLF4J -> JDK14
50-
exclude group: "org.slf4j", module: "jul-to-slf4j"
51-
exclude group: "org.slf4j", module: "slf4j-jdk14"
52-
}
39+
apply from: "$project.rootDir/examples/java/common.gradle"
5340

5441
dependencies {
5542
implementation enforcedPlatform(library.java.google_cloud_platform_libraries_bom)
@@ -70,10 +57,6 @@ dependencies {
7057
for (String runner : preCommitRunners) {
7158
delegate.add(runner + "PreCommit", project(path: ":examples:java", configuration: "testRuntimeMigration"))
7259
}
73-
directRunnerPreCommit project(path: ":runners:direct-java", configuration: "shadow")
74-
flinkRunnerPreCommit project(":runners:flink:${project.ext.latestFlinkVersion}")
75-
sparkRunnerPreCommit project(":runners:spark:3")
76-
sparkRunnerPreCommit project(":sdks:java:io:hadoop-file-system")
7760

7861
// Add dependency if requested on command line for runner
7962
if (project.hasProperty("runnerDependency")) {
@@ -113,10 +96,3 @@ task preCommit() {
11396
dependsOn runner + "PreCommit"
11497
}
11598
}
116-
117-
tasks.create(name:"execute", type:JavaExec) {
118-
main = project.hasProperty("mainClass") ? project.getProperty("mainClass") : "NONE"
119-
classpath = sourceSets.main.runtimeClasspath
120-
systemProperties System.getProperties()
121-
args project.hasProperty("exec.args") ? project.getProperty("exec.args").split() : []
122-
}

0 commit comments

Comments
 (0)