-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle
More file actions
205 lines (178 loc) · 6.62 KB
/
build.gradle
File metadata and controls
205 lines (178 loc) · 6.62 KB
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
193
194
195
196
197
198
199
200
201
202
203
204
205
plugins {
id 'scala'
id 'java-library'
id 'maven-publish'
id 'signing'
}
final def scalaVersion = getScalaVersion()
final def scalaLibraryVersion = getScalaLibraryVersion()
final def sparkVersion = getSparkVersion()
final def sparkLibraryVersion = getSparkLibraryVersion()
dependencies {
// We use Spark in API, so clients will need it when compiling
// In most cases, the actual Spark code should be provided by the
// execution envrionment, so compileOnlyApi is more technically correct than api
// although the generated POM is the same regardless
compileOnlyApi "org.apache.spark:spark-core_$scalaVersion:$sparkLibraryVersion"
compileOnlyApi "org.apache.spark:spark-sql_$scalaVersion:$sparkLibraryVersion"
compileOnlyApi "org.apache.spark:spark-catalyst_$scalaVersion:$sparkLibraryVersion"
compileOnly "org.scala-lang:scala-library:$scalaLibraryVersion"
implementation "com.squareup.okhttp3:okhttp:4.10.0"
// 2.13.5 is the last release that supports Java 8, and Java 8 is the only official
// supported for Databricks. Java 11 is only in preview for Databricks 10.
implementation "com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_$scalaVersion:2.13.5"
implementation "com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-macros_$scalaVersion:2.13.5"
implementation "io.reactivex.rxjava3:rxjava:3.1.5"
testImplementation "org.apache.spark:spark-core_$scalaVersion:$sparkLibraryVersion"
testImplementation "org.apache.spark:spark-sql_$scalaVersion:$sparkLibraryVersion"
testImplementation "org.scalatest:scalatest_$scalaVersion:3.0.8"
testImplementation "junit:junit:4.13.2"
}
repositories {
mavenCentral()
}
java {
toolchain {
targetCompatibility = JavaLanguageVersion.of(8)
}
}
scaladoc {
title = 'Joom Spark Platform'
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allScala
}
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
def scaladoc = tasks.scaladoc
from scaladoc.destinationDir
dependsOn scaladoc
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'com.joom.spark'
artifactId = "spark-platform_$scalaVersion"
version = '0.4.10'
from components.java
artifact tasks.sourcesJar
artifact tasks.javadocJar
pom {
name = 'spark-platform'
description = 'Foundational Spark tool from Joom.'
inceptionYear = '2022'
url = 'https://github.com/joomcode/spark-platform'
licenses {
license {
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
distribution = 'repo'
}
}
organization {
name = 'Joom'
url = 'https://joom-group.com'
}
developers {
developer {
id = 'vprus'
name = 'Vladimir Prus'
email = 'vladimir.prus@gmail.com'
}
}
scm {
connection = 'scm:git:git://github.com/joomcode/spark-platform.git'
developerConnection = 'scm:git:ssh://git@github.com/joomcode/spark-platform.git'
url = 'https://github.com/joomcode/spark-platform'
}
}
}
}
repositories {
def mavenUrl = findProperty('publication.repository.maven.url')
if (mavenUrl != null) {
maven {
url mavenUrl
def mavenName = findProperty('publication.repository.maven.name')
def mavenUsername = findProperty('publication.repository.maven.username')
def mavenPassword = findProperty('publication.repository.maven.password')
if (mavenName != null) {
name mavenName
}
credentials {
username mavenUsername
password mavenPassword
}
}
}
}
}
signing {
def isSigningEnabled = findProperty('publication.signing.enabled')?.toBoolean() ?: true
if (isSigningEnabled) {
def keyId = findProperty('publication.signing.keyId')
def secretKey = findProperty('publication.signing.secretKey')
def password = findProperty('publication.signing.password')
if (secretKey != null && password != null) {
useInMemoryPgpKeys(keyId, secretKey, password)
sign publishing.publications.maven
}
}
}
getProperty('java.test.versions')
.split(',')
.collect { JavaLanguageVersion.of(it).asInt() }
.unique()
.each { majorVersion ->
def jdkTest = tasks.register("testJdk$majorVersion", Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(majorVersion)
}
description = "Runs the test suite on JDK $majorVersion"
group = LifecycleBasePlugin.VERIFICATION_GROUP
// Copy inputs from normal Test task.
def testTask = tasks.getByName("test")
classpath = testTask.classpath
testClassesDirs = testTask.testClassesDirs
}
tasks.named("check").configure { dependsOn(jdkTest) }
}
String getScalaLibraryVersion() {
def scalaVersion = getProperty('scala.version').toString()
def parts = scalaVersion.split('\\.')
if (parts.length >= 3) {
return scalaVersion
} else {
return (parts + '+').join('.')
}
}
String getScalaVersion() {
def scalaVersion = getProperty('scala.version').toString()
def parts = scalaVersion.split('\\.')
switch (parts[0]) {
case '2':
return "${parts[0]}.${parts[1]}"
default:
throw new IllegalArgumentException("Unsupported scala version $scalaVersion")
}
}
String getSparkLibraryVersion() {
def scalaVersion = getProperty('spark.version').toString()
def parts = scalaVersion.split('\\.')
if (parts.length >= 3) {
return scalaVersion
} else {
return (parts + '+').join('.')
}
}
String getSparkVersion() {
def scalaVersion = getProperty('spark.version').toString()
def parts = scalaVersion.split('\\.')
switch (parts[0]) {
case '3':
return "${parts[0]}.${parts[1]}"
default:
throw new IllegalArgumentException("Unsupported Spark version $scalaVersion")
}
}