-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathbuild.gradle
192 lines (173 loc) · 6.61 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*
* Copyright 2018 Google LLC
*
* Licensed 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.
*/
plugins {
id 'java'
id 'application'
id 'eclipse'
id 'idea'
id 'com.diffplug.spotless' version '6.22.0'
id 'com.google.cloud.tools.jib' version '3.4.0'
id 'jacoco'
}
// Licence header enforced by spotless
def javaLicenseHeader = """/*
* Copyright \$YEAR Google LLC
*
* Licensed 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.
*/
"""
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
application {
applicationDefaultJvmArgs = ['-Xms4g', '-Xmx16g']
mainClass = System.getProperty('mainClass', 'com.google.swarm.tokenization.DLPTextToBigQueryStreamingV2')
}
jib {
from {
image = 'gcr.io/dataflow-templates-base/java8-template-launcher-base:latest'
}
container {
appRoot = '/template/df-dlp-inspect-template'
entrypoint = 'INHERIT'
environment = [DATAFLOW_JAVA_COMMAND_SPEC: '/template/df-dlp-inspect-template/resources/java_command_spec.json']
}
}
group 'com.google.swarm'
version '0.1.0'
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
}
dependencies {
ext {
dataflowBeamVersion = '2.46.0'
}
implementation group: 'org.apache.beam', name: 'beam-sdks-java-core', version: dataflowBeamVersion
implementation(group: 'org.apache.beam', name: 'beam-runners-google-cloud-dataflow-java', version: dataflowBeamVersion) {
exclude group: 'io.confluent', module: 'kafka-schema-registry-client'
exclude group: 'io.confluent', module: 'kafka-avro-serializer'
}
implementation group: 'org.apache.beam', name: 'beam-runners-direct-java', version: dataflowBeamVersion
implementation group: 'org.apache.beam', name: 'beam-sdks-java-extensions-ml', version: dataflowBeamVersion
implementation group: 'org.apache.beam', name: 'beam-sdks-java-io-amazon-web-services', version: dataflowBeamVersion
implementation group: 'org.apache.parquet', name: 'parquet-avro', version: '1.13.1'
implementation group: 'org.apache.parquet', name: 'parquet-hadoop', version: '1.13.1'
implementation group: 'org.apache.beam', name: 'beam-sdks-java-io-parquet', version: '2.14.0'
implementation group: 'org.slf4j', name: 'slf4j-jdk14', version: '2.0.6'
implementation 'com.google.cloud:google-cloud-kms:2.15.0'
implementation 'com.google.guava:guava:32.1.2-jre'
implementation group: 'com.google.cloud', name: 'google-cloud-dlp', version: '3.16.0'
implementation 'com.google.api-client:google-api-client:2.2.0'
implementation group: 'com.google.apis', name: 'google-api-services-cloudkms', version: 'v1-rev108-1.25.0'
implementation group: 'org.apache.beam', name: 'beam-sdks-java-io-amazon-web-services', version: dataflowBeamVersion
implementation "com.google.auto.value:auto-value-annotations:1.10.1"
implementation 'com.google.cloud:google-cloud-storage:2.20.1'
implementation group: 'org.apache.orc', name: 'orc-core', version: '1.9.1'
implementation group: 'org.apache.hadoop', name: 'hadoop-hdfs-client', version: '3.3.6'
implementation group: 'org.apache.hadoop', name: 'hadoop-common', version: '3.3.6'
implementation group: 'com.google.cloud.bigdataoss', name: 'gcs-connector', version: 'hadoop3-2.2.17'
implementation group: 'org.apache.hive', name: 'hive-storage-api', version: '2.8.1'
implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.10.0'
annotationProcessor group: 'com.google.auto.value', name: 'auto-value', version: '1.10.1'
testImplementation group: 'org.apache.beam', name: 'beam-runners-direct-java', version: dataflowBeamVersion
testImplementation group: 'org.slf4j', name: 'slf4j-jdk14', version: '2.0.6'
testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
testImplementation group: 'junit', name: 'junit', version: '4.13.1'
}
jar {
manifest {
attributes('Main-Class': application.mainClass)
}
}
compileJava {
options.encoding = 'UTF-8'
// Add additional jvm arguments
options.compilerArgs.addAll(['-Xlint:all', '-Xlint:-serial', '-Xlint:-processing'])
}
// default tasks when you run ./gradlew
defaultTasks 'clean', 'assemble', 'jar'
// Google cloud dataflow requires the resource/main directory to exist
tasks.register('resources') {
def resourcesDir = new File('build/resources/main')
resourcesDir.mkdirs()
}
run {
if (project.hasProperty('args')) {
args project.args.split('\\s')
}
}
test {
useJUnit()
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
exceptionFormat "full"
}
finalizedBy jacocoTestReport
}
sourceSets {
test {
java.srcDir file('src/test')
}
}
spotless {
java {
licenseHeader javaLicenseHeader
googleJavaFormat()
}
}
run.mustRunAfter 'resources'
run.mustRunAfter 'resources'
tasks.register('fatJar', Jar) {
manifest {
attributes 'Implementation-Title': 'dlp-demo-tool',
'Implementation-Version': archiveVersion,
'Main-Class': application.mainClass
}
archiveFileName = project.name + '-all'
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
with jar
}
jacocoTestReport {
dependsOn test
reports {
csv.required = true
html.required = false
xml.required = true
}
}