51 lines
1.5 KiB
Groovy
51 lines
1.5 KiB
Groovy
plugins {
|
|
id "scala"
|
|
}
|
|
|
|
group "${projectGroup}"
|
|
version "${projectVersion}"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly group: "org.scala-lang", name:"scala-library", version: "${scalaMajorVersion}.${scalaMinorVersion}"
|
|
|
|
compileOnly group: "org.apache.spark", name: "spark-core_${scalaMajorVersion}", version: "${apacheSparkVersion}"
|
|
compileOnly group: "org.apache.spark", name: "spark-sql_${scalaMajorVersion}", version: "${apacheSparkVersion}"
|
|
|
|
testImplementation group: "org.scalatest", name: "scalatest_${scalaMajorVersion}", version: "${scalaTestVersion}"
|
|
}
|
|
|
|
configurations {
|
|
testImplementation.extendsFrom compileOnly
|
|
}
|
|
|
|
tasks.withType(ScalaCompile).configureEach {
|
|
scalaCompileOptions.additionalParameters = ["-release:${JavaVersion.current()}".toString()]
|
|
}
|
|
|
|
tasks.register('scalaTest', JavaExec) {
|
|
dependsOn['testClasses']
|
|
mainClass = 'org.scalatest.tools.Runner'
|
|
args = ['-R', 'build/classes/scala/test', '-o']
|
|
jvmArgs = ['--add-exports=java.base/sun.nio.ch=ALL-UNNAMED'] // https://lists.apache.org/thread/p1yrwo126vjx5tht82cktgjbmm2xtpw9
|
|
classpath = sourceSets.test.runtimeClasspath
|
|
}
|
|
test.dependsOn scalaTest
|
|
|
|
jar {
|
|
manifest {
|
|
attributes "Main-Class": "${mainClass}"
|
|
}
|
|
from {
|
|
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
|
|
}
|
|
archiveFileName.set("${getArchiveBaseName().get()}-${projectVersion}.${getArchiveExtension().get()}")
|
|
}
|
|
|
|
clean.doFirst {
|
|
delete "logs/"
|
|
}
|