-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
83 lines (68 loc) · 2.23 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
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
// Apply GraalVM Native Image plugin
id 'org.graalvm.buildtools.native' version '0.9.18'
id 'application'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenLocal()
mavenCentral()
}
application {
mainClass = 'org.apache.beam.examples.MinimalWordCount'
}
def beamVersion = '2.43.0'
sourceSets {
graal
}
configurations {
graalImplementation.extendsFrom(implementation)
nativeImageCompileOnly.extendsFrom(graalCompileOnly)
all {
resolutionStrategy {
force "org.apache.beam:beam-sdks-java-core:${beamVersion}-SNAPSHOT"
force "org.apache.beam:beam-runners-direct-java:${beamVersion}-SNAPSHOT"
}
}
}
dependencies {
// main dependencies
implementation "org.apache.beam:beam-sdks-java-core:${beamVersion}"
implementation "org.apache.beam:beam-runners-direct-java:${beamVersion}"
implementation "org.slf4j:slf4j-jdk14:1.7.32"
// dependencies to build the native image
graalCompileOnly "org.graalvm.nativeimage:svm:22.3.0"
// use graal source set to compile native-image
nativeImageCompileOnly sourceSets.graal.output
}
graalvmNative {
agent {
// Unfortunately this isn't sufficient to support dynamically generated classes in Beam.
// Beam loads such classes into the context classloader using ClassLoadingStrategy.UsingLookup(MethodHandle).
// Class define support will skip such classes: https://github.com/oracle/graal/issues/4248
// enableExperimentalPredefinedClasses = true
}
binaries {
main {
buildArgs '--features=beam.dofns.PredefinedDoFnInvokerFeature'
buildArgs '--initialize-at-run-time=' +
'org.apache.beam.sdk.values.TupleTag,' + // uses random numbers, must be at runtime
'org.apache.beam.sdk.transforms.JsonToRow$JsonToRowWithErrFn' // not used, triggers init of TupleTag
buildArgs '--initialize-at-build-time=' +
'org.apache.beam,' +
'org.slf4j,' +
'com.fasterxml.jackson,' +
'org.codehaus.jackson,' +
'org.joda.time,' +
'org.apache.avro,' +
'avro.shaded.com.google.common,' +
'net.bytebuddy,' +
'java.beans'
}
}
}
shadowJar {
mergeServiceFiles() // merging service files in META-INF
}