Convert gradle from kotlin to groovy (at the moment, kotlin makes it more difficult)

This commit is contained in:
nathan 2018-06-20 17:14:57 +02:00
parent 112b2b0451
commit a9fd6f1464
2 changed files with 70 additions and 107 deletions

70
build.gradle Normal file
View File

@ -0,0 +1,70 @@
plugins {
id 'java'
id 'maven'
}
ext {
bcVersion = '1.59'
jnaVersion = '4.5.1'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceSets {
main {
java {
setSrcDirs Collections.singletonList('src')
}
}
test {
java {
setSrcDirs Collections.singletonList('test')
}
}
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
compile group: 'com.github.jponge', name: 'lzma-java', version: '1.3'
compile group: 'com.fasterxml.uuid', name: 'java-uuid-generator', version: '3.1.5'
compile group: 'com.esotericsoftware', name: 'kryo', version: '4.0.2'
compile group: 'io.netty', name: 'netty-all', version: '4.1.24.Final'
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: bcVersion
compile group: 'org.bouncycastle', name: 'bcpg-jdk15on', version: bcVersion
compile group: 'org.bouncycastle', name: 'bcmail-jdk15on', version: bcVersion
// compile group: 'org.bouncycastle', name: 'bctls-jdk15on', version: bcVersion
compile group: 'org.lwjgl', name: 'lwjgl-xxhash', version: '3.1.6'
compile group: 'org.javassist', name: 'javassist', version: '3.21.0-GA'
compile group: 'com.dorkbox', name: 'ShellExecutor', version: '1.1+'
compile group: 'net.java.dev.jna', name: 'jna', version: jnaVersion
compile group: 'net.java.dev.jna', name: 'jna-platform', version: jnaVersion
// unit testing
testCompile group: 'junit', name: 'junit', version: '4.12'
testRuntime group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.6'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.incremental = true
options.fork = true
options.forkOptions.executable = 'javac'
// setup compile options. we specifically want to suppress usage of "Unsafe"
options.compilerArgs += ['-XDignore.symbol.file', '-Xlint:deprecation']
}

View File

@ -1,107 +0,0 @@
import org.gradle.api.internal.HasConvention
import org.gradle.internal.impldep.org.apache.http.client.methods.RequestBuilder.options
import org.jetbrains.kotlin.gradle.dsl.Coroutines
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.android.AndroidGradleWrapper.srcDir
import java.io.File
buildscript {
dependencies {
// classpath("com.bmuschko:gradle-docker-plugin:${property("gradle_docker_plugin.version")}")
}
}
plugins {
java
maven
// the version is defined in the parent project. Change this if you are working DIRECTLY with Utilities
// kotlin("jvm") version "1.2.40"
kotlin("jvm")
}
apply {
plugin("java")
plugin("kotlin")
}
kotlin.experimental.coroutines = Coroutines.ENABLE
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
// make working with sourcesets easier
val sourceSets = java.sourceSets
fun sourceSets(block: SourceSetContainer.() -> Unit) = sourceSets.apply(block)
val SourceSetContainer.main: SourceSet get() = getByName("main")
fun SourceSetContainer.main(block: SourceSet.() -> Unit) = main.apply(block)
val SourceSetContainer.test: SourceSet get() = getByName("test")
fun SourceSetContainer.test(block: SourceSet.() -> Unit) = test.apply(block)
var SourceDirectorySet.sourceDirs: Iterable<File>
get() = srcDirs
set(value) {
setSrcDirs(value)
}
sourceSets {
main {
java {
sourceDirs = files("src")
}
}
test {
java {
sourceDirs = files("test")
}
}
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
val bcVersion = "1.59"
compile(group = "org.slf4j", name = "slf4j-api", version = "1.7.25")
compile(group = "ch.qos.logback", name = "logback-classic", version = "1.1.6")
compile(group = "com.github.jponge", name = "lzma-java", version = "1.3")
compile(group = "com.fasterxml.uuid", name = "java-uuid-generator", version = "3.1.5")
compile(group = "com.esotericsoftware", name = "kryo", version = "4.0.2")
compile(group = "io.netty", name = "netty-all", version = "4.1.24.Final")
compile(group = "org.bouncycastle", name = "bcprov-jdk15on", version = bcVersion)
compile(group = "org.bouncycastle", name = "bcpg-jdk15on", version = bcVersion)
compile(group = "org.bouncycastle", name = "bcmail-jdk15on", version = bcVersion)
// compile(group = "org.bouncycastle", name = "bctls-jdk15on", version = bcVersion)
compile(group = "org.lwjgl", name = "lwjgl-xxhash", version = "3.1.6")
compile(group = "org.javassist", name = "javassist", version = "3.21.0-GA")
compile(group = "com.dorkbox", name = "ShellExecutor", version = "1.1+")
compile(group = "net.java.dev.jna", name = "jna", version = "4.5.1")
compile(group = "net.java.dev.jna", name = "jna-platform", version = "4.5.1")
// unit testing
testCompile(group = "junit", name = "junit", version = "4.12")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.isIncremental = true
options.isFork = true
options.forkOptions.executable = "javac"
// setup compile options. we specifically want to suppress usage of "Unsafe"
options.compilerArgs = listOf("-XDignore.symbol.file", "-Xlint:deprecation")
}