forked from ClickHouse/spark-clickhouse-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
188 lines (158 loc) · 5.98 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
/*
* 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
*
* https://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 "idea"
id "org.scoverage" version "7.0.1" apply false
id "org.sonarqube" version "3.4.0.2513"
id "com.diffplug.spotless" version "6.12.1" apply false
id "org.nosphere.apache.rat" version "0.8.0"
id "com.github.maiflai.scalatest" version "0.32" apply false
id "com.github.johnrengelman.shadow" version "7.1.2" apply false
}
project.ext {
scala_binary_version = System.getProperty("scala_binary_version")
spark_binary_version = System.getProperty("spark_binary_version")
scala_212_version = spark_binary_version == "3.3" ? project.getProperty("spark_33_scala_212_version") : project.getProperty("spark_34_scala_212_version")
scala_version = scala_binary_version == "2.12" ? scala_212_version : scala_213_version
antlr_version = spark_binary_version == "3.3" ? project.getProperty("spark_33_antlr_version") : project.getProperty("spark_34_antlr_version")
jackson_version = spark_binary_version == "3.3" ? project.getProperty("spark_33_jackson_version") : project.getProperty("spark_34_jackson_version")
slf4j_version = spark_binary_version == "3.3" ? project.getProperty("spark_33_slf4j_version") : project.getProperty("spark_34_slf4j_version")
}
rat {
verbose.set(true)
exclude(
"**/README.md",
"CODE_OF_CONDUCT.md",
"version.txt",
"clickhouse-core/src/main/scala-2.12/scala/util/Using.scala",
"**/.gitkeep",
"docs/imgs",
"site/**",
".python-version",
// Gradle
"gradle/wrapper/**",
"gradlew*",
"**/build/**",
// IDEs
"*.iml",
"*.ipr",
"*.iws",
"*.idea/**",
".editorconfig"
)
}
allprojects {
version = getProjectVersion()
repositories {
maven { url = "$mavenCentralMirror" }
}
}
subprojects {
apply plugin: "scala"
apply plugin: "java-library"
apply plugin: "org.scoverage"
apply plugin: "com.diffplug.spotless"
apply plugin: "com.github.maiflai.scalatest"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}
compileScala {
options.fork = true
options.forkOptions.jvmArgs += ["-Xss8M"]
}
test {
maxParallelForks = 1
environment("ROOT_PROJECT_DIR", rootProject.projectDir)
tags {
exclude 'org.scalatest.tags.Slow'
}
}
tasks.register('slowTest', Test) {
maxParallelForks = 1
environment("ROOT_PROJECT_DIR", rootProject.projectDir)
tags {
include 'org.scalatest.tags.Slow'
}
}
scoverage {
scoverageVersion = "1.4.11"
reportDir.set(file("${rootProject.buildDir}/reports/scoverage"))
highlighting.set(false)
minimumRate.set(0.0)
}
spotless {
scala {
scalafmt("3.6.1")
.configFile("${rootProject.projectDir}/.scalafmt.conf")
.scalaMajorVersion("2.12")
}
}
}
project(':clickhouse-core') {
apply plugin: "idea"
apply plugin: "antlr"
apply plugin: "java-test-fixtures"
sourceSets.main.scala {
srcDirs += "src/main/scala-$scala_binary_version"
}
configurations {
api {
// workaround for https://github.com/gradle/gradle/issues/820
extendsFrom = extendsFrom.findAll { it != configurations.antlr }
}
}
generateGrammarSource {
maxHeapSize = "64m"
arguments += ["-visitor", "-package", "xenon.clickhouse"]
}
test {
classpath += files("$projectDir/src/testFixtures/conf")
}
sourcesJar {
dependsOn generateGrammarSource
}
dependencies {
api "org.scala-lang:scala-library:$scala_version"
antlr "org.antlr:antlr4:$antlr_version"
api "org.antlr:antlr4-runtime:$antlr_version"
api "org.slf4j:slf4j-api:$slf4j_version"
api "org.apache.commons:commons-lang3:$commons_lang3_version"
api "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
api "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
api "com.fasterxml.jackson.module:jackson-module-scala_$scala_binary_version:$jackson_version"
api("com.clickhouse:clickhouse-jdbc:$clickhouse_jdbc_version:all") { transitive = false }
compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_api_version"
testFixturesApi "org.slf4j:slf4j-api:$slf4j_version"
testFixturesApi "org.scalatest:scalatest_$scala_binary_version:$scalatest_version"
testFixturesRuntimeOnly "com.vladsch.flexmark:flexmark-all:$flexmark_version"
testFixturesApi "com.dimafeng:testcontainers-scala-scalatest_$scala_binary_version:$testcontainers_scala_version"
testFixturesApi "com.dimafeng:testcontainers-scala-clickhouse_$scala_binary_version:$testcontainers_scala_version"
testImplementation "org.slf4j:slf4j-log4j12:$slf4j_version"
}
}
boolean isVersionFileExists() {
return file("version.txt").exists()
}
String getVersionFromFile() {
return file("version.txt").text.trim()
}
String getProjectVersion() {
if (!isVersionFileExists())
throw new IllegalStateException("Can not find version.txt")
return getVersionFromFile()
}
apply from: file("spark-$spark_binary_version/build.gradle")
apply from: "deploy.gradle"