-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathbuild.gradle
139 lines (121 loc) · 4.22 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
/*
* Copyright 2020 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.
*/
buildscript {
ext {
dataflowBeamVersion = '2.23.0'
}
repositories {
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
dependencies {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.19"
classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:1.4.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.24.2"
}
}
}
group 'com.google.solutions'
version '0.1.0'
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "net.ltgt.apt"
apply plugin: 'com.google.cloud.tools.jib'
apply plugin: "com.diffplug.gradle.spotless"
// Licence header enforced by spotless
def javaLicenseHeader = """/*
* Copyright 2020 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.
*/
"""
sourceCompatibility = 1.8
targetCompatibility = 1.8
applicationDefaultJvmArgs = ['-Xms4g', '-Xmx16g']
mainClassName = System.getProperty('mainClass', 'com.google.solutions.df.video.analytics.VideoAnalyticsPipeline')
dependencies {
compile group: 'org.apache.beam', name: 'beam-sdks-java-core', version: dataflowBeamVersion
compile group: 'org.apache.beam', name: 'beam-runners-google-cloud-dataflow-java', version:dataflowBeamVersion
compile group: 'org.apache.beam', name: 'beam-runners-direct-java', version: dataflowBeamVersion
compile group: 'org.apache.beam', name: 'beam-sdks-java-extensions-ml', version: dataflowBeamVersion
compile group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.30'
compile "com.google.auto.value:auto-value-annotations:1.6.2"
compile 'com.google.cloud:google-cloud-video-intelligence:1.2.1'
annotationProcessor "com.google.auto.value:auto-value:1.6.2"
testCompile group: 'org.apache.beam', name: 'beam-runners-direct-java', version: dataflowBeamVersion
testCompile group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.30'
}
jar {
manifest {
attributes ('Main-Class': mainClassName)
}
}
compileJava {
options.compilerArgs.addAll(['-Xlint:all', '-Xlint:-serial'])
options.encoding = 'UTF-8'
}
// default tasks when you run ./gradlew
defaultTasks 'clean', 'assemble'
// Google Cloud Dataflow requires the resource/main directory to exist
task resources {
def resourcesDir = new File('build/resources/main')
resourcesDir.mkdirs()
}
run {
if (project.hasProperty('args')) {
args project.args.split('\\s')
}
mustRunAfter 'resources'
}
// Spotless configuration
def enableSpotlessCheck = project.hasProperty('enableSpotlessCheck') && project.enableSpotlessCheck == 'true'
spotless {
enforceCheck enableSpotlessCheck
java {
licenseHeader javaLicenseHeader
googleJavaFormat()
}
}
jib {
from {
image = 'gcr.io/dataflow-templates-base/java8-template-launcher-base:latest'
}
to {
credHelper = 'gcloud'
}
container {
appRoot = '/template/df-video-analytics-template'
entrypoint = 'INHERIT'
environment = [DATAFLOW_JAVA_COMMAND_SPEC:'/template/df-video-analytics-template/resources/java_command_spec.json']
}
}