-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
90 lines (76 loc) · 2.85 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
plugins {
id 'scala'
id 'com.github.johnrengelman.shadow' version "$shadowVersion"
id 'com.diffplug.gradle.spotless' version "$spotlessVersion"
id "com.github.hierynomus.license" version "$licenseVersion"
}
apply from: 'codequality/lint.gradle'
apply from: 'codequality/fmt.gradle'
apply from: 'codequality/license.gradle'
repositories {
jcenter()
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = '0.1.0-SNAPSHOT'
dependencies {
implementation group: 'org.scala-lang', name: 'scala-library', version: scalaVersion
compileOnly group: 'org.apache.beam', name: 'beam-runners-google-cloud-dataflow-java', version: beamVersion
compileOnly group: 'org.apache.beam', name: 'beam-runners-direct-java', version: beamVersion
runtimeOnly group: 'org.slf4j', name: 'slf4j-jdk14', version: slf4jVersion
// odd I know to repeat these dependencies but for local direct running, unlike provided cluster
runtimeOnly group: 'org.apache.beam', name: 'beam-runners-google-cloud-dataflow-java', version: beamVersion
runtimeOnly group: 'org.apache.beam', name: 'beam-runners-direct-java', version: beamVersion
// Examples actually depends on hamcrest :C
runtimeOnly group: 'org.hamcrest', name: 'hamcrest-all', version: hamcrestVersion
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
// Split up the runnerJar for local compilation and testing, much faster to
// recompilation of shadowJar
task dependencyJar(type: ShadowJar) {
setAppendix('dependencies')
configurations = [ project.configurations.runtimeClasspath ]
mergeServiceFiles()
}
task appJar(type: ShadowJar) {
setAppendix('app')
manifest {
attributes(
'Implementation-Title': 'Word Count',
'Implementation-Version': version,
'Main-Class': 'org.apache.beam.examples.scala.WordCount'
)
}
from sourceSets.main.output
configurations = [ ]
mergeServiceFiles()
}
// One Assembly FatJar
task assemblyJar(type: ShadowJar) {
// baseName = project.name + '-dependencies'
// version = "0.1.0"
setAppendix('assembly')
manifest {
attributes(
'Implementation-Title': 'Word Count',
'Implementation-Version': version,
'Main-Class': 'org.apache.beam.examples.scala.WordCount'
)
}
from sourceSets.main.output
configurations = [ project.configurations.runtimeClasspath ]
mergeServiceFiles()
}
ext.mainClass = project.properties['mainClass'] ?: ''
task exec(type: JavaExec) {
// select main with `-PmainClass=path.to.MainClass`
main = mainClass
classpath = sourceSets.main.runtimeClasspath
}
task execJar(dependsOn: [appJar, dependencyJar], type: JavaExec) {
main = mainClass
classpath = files([
"${appJar.archiveFile.get()}",
"${dependencyJar.archiveFile.get()}"])
}