-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
171 lines (143 loc) · 4.72 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
// Copyright 2022 Israel Herraiz
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
plugins {
id 'application'
id "maven-publish"
id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.0"
id "com.diffplug.spotless" version "6.20.0"
id 'com.palantir.git-version' version '0.15.0'
}
ext {
packageName = "elastic2bq"
javaPackagePath = "dev.herraiz"
appName = "elastic2bq"
appVersion = "${gitVersion()}-SNAPSHOT"
beamVersion = "2.49.0"
bigqueryVersion = "1.116.6"
commonsCliVersion = "1.5.0"
slf4jVersion = "1.7.36"
junitVersion = "4.13.2"
hamcrestVersion = "2.2"
autoValueVersion = '1.10'
autoServiceVersion = '1.0.1'
protoVersion = '3.22.0'
googleJavaFormatVersion = '1.17.0'
confluentRepoURL = "https://packages.confluent.io/maven"
}
repositories {
mavenCentral()
maven {
// Apache Snapshots repository
url "https://repository.apache.org/content/repositories/snapshots/"
}
maven {
// For Kafka required packages for Beam Google Cloud IO pkgs
url confluentRepoURL
}
}
application {
mainClass = "${javaPackagePath}.pipelines.Elastic2BQ"
version = appVersion
}
test {
// JUnit 4.
useJUnit()
}
compileJava {
options.compilerArgs.addAll(['-Xlint:deprecation'])
}
run {
if (project.hasProperty('args')) {
args project.args.split('\\s')
}
}
dependencies {
// App dependencies.
implementation platform("org.apache.beam:beam-sdks-java-google-cloud-platform-bom:${beamVersion}")
implementation "org.apache.beam:beam-sdks-java-core"
runtimeOnly "org.apache.beam:beam-runners-direct-java"
implementation "org.apache.beam:beam-runners-google-cloud-dataflow-java"
runtimeOnly "org.apache.beam:beam-runners-google-cloud-dataflow-java"
implementation "org.apache.beam:beam-sdks-java-io-google-cloud-platform"
implementation "org.apache.beam:beam-sdks-java-io-elasticsearch"
implementation "com.google.cloud:google-cloud-bigquery:${bigqueryVersion}"
implementation "com.google.cloud:google-cloud-storage:2.8.1"
implementation "commons-cli:commons-cli:${commonsCliVersion}"
implementation "org.slf4j:slf4j-jdk14:${slf4jVersion}"
implementation "com.google.auto.value:auto-value-annotations:${autoValueVersion}"
annotationProcessor "com.google.auto.value:auto-value:${autoValueVersion}"
implementation "com.google.auto.service:auto-service-annotations:${autoServiceVersion}"
annotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}"
// Tests dependencies.
testImplementation "junit:junit:${junitVersion}"
testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
}
// Package a self-contained jar file.
jar {
archiveBaseName = packageName
zip64 = true
destinationDirectory = file('build')
manifest {
attributes 'Main-Class': "${javaPackagePath}.pipelines.Elastic2BQ"
}
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
exclude 'manifests/*'
exclude 'data/*'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = javaPackagePath
artifactId = packageName
from components.java
}
}
}
spotless {
format 'misc', {
// define the files to apply `misc` to
target 'build.gradle', '*.md', '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
target project.fileTree(project.rootDir) {
include '**/*.java'
exclude 'build/*'
}
googleJavaFormat("${googleJavaFormatVersion}")
.aosp()
.reflowLongStrings()
.groupArtifact('com.google.googlejavaformat:google-java-format')
// fix formatting of type annotations
formatAnnotations()
// make sure every file has the following copyright header.
licenseHeader '/*\n * Copyright $YEAR Israel Herraiz.\n' +
' *\n' +
' * Licensed under the Apache License, Version 2.0 (the \'License\');\n' +
' * you may not use this file except in compliance with the License.\n' +
' * You may obtain a copy of the License at\n' +
' *\n' +
' * http://www.apache.org/licenses/LICENSE-2.0\n' +
' *\n' +
' * Unless required by applicable law or agreed to in writing, software\n' +
'* distributed under the License is distributed on an "AS IS" BASIS,\n' +
'* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n' +
'* See the License for the specific language governing permissions and\n' +
'* limitations under the License.\n' +
'*/\n\n'
}
}