Changed gradle to kotlin DSL and updated gradle wrapper to 6.0

This commit is contained in:
Obique
2020-03-21 12:18:48 -04:00
parent 90fc5aab8d
commit 965e85fd5e
3 changed files with 117 additions and 114 deletions

View File

@@ -1,113 +0,0 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id 'application'
id 'java'
id 'idea'
id "com.github.johnrengelman.shadow" version "5.1.0"
id "org.javamodularity.moduleplugin" version "1.6.0"
id 'org.jetbrains.kotlin.jvm' version '1.3.50'
id "org.beryx.jlink" version "2.16.2"
}
mainClassName = 'holocore/com.projectswg.holocore.ProjectSWG'
sourceSets {
main
display
utility
integration
}
test {
afterSuite { TestDescriptor td, TestResult tr ->
if (td.parent == null) {
println 'Tests run: (' + tr.getTestCount() + '), Failures: (' + tr.getFailedTestCount() + ')' // IMPORTANT - this is required for Lightspeed
}
}
}
idea {
module {
inheritOutputDirs = true
}
}
jlink {
// addOptions '--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'
imageDir.set(file("$buildDir/holocore"))
imageZip.set(file("$buildDir/holocore.zip"))
launcher {
name = 'holocore'
jvmArgs = []
unixScriptTemplate = file('src/main/resources/jlink-unix-launch-template.txt')
}
}
shadowJar {
archivesBaseName = 'Holocore'
archiveClassifier.set(null)
archiveVersion.set(null)
}
repositories {
jcenter()
}
dependencies {
compile project(':pswgcommon')
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.3.50'
compile group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.3.0'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0'
compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.5.2'
compile group: 'org.mongodb', name: 'mongodb-driver-sync', version: '3.11.0'
compile group: 'me.joshlarson', name: "fast-json", version: '3.0.0'
compile group: 'me.joshlarson', name: 'jlcommon-network', version: '1.0.0'
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
testCompile 'junit:junit:4.12'
displayCompile project(':pswgcommon')
displayCompile sourceSets.main.output
utilityCompile project(':pswgcommon')
utilityCompile sourceSets.main.output
utilityCompile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.3.50'
utilityCompile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.23.1'
utilityCompile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.6.3'
utilityCompile group: 'me.joshlarson', name: "fast-json", version: '3.0.0'
integrationCompile project(':pswgcommon')
integrationCompile project(':client-holocore')
integrationCompile sourceSets.main.output
integrationCompile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.23.1'
integrationCompile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.6.3'
integrationCompile 'junit:junit:4.12'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "12"
}
}
task CreateConvertLoginJar(type: ShadowJar) {
archivesBaseName = "ConvertLogin"
archiveClassifier.set(null)
archiveVersion.set(null)
manifest.attributes 'Main-Class': 'com.projectswg.utility.ConvertLogin'
from sourceSets.utility.output
configurations = [project.configurations.utilityRuntime]
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
}
task CreatePacketCaptureProcessor(type: ShadowJar) {
archivesBaseName = "PacketCaptureProcessor"
archiveClassifier.set(null)
archiveVersion.set(null)
manifest.attributes 'Main-Class': 'com.projectswg.utility.packets.ProcessPacketCapture'
from sourceSets.utility.output
configurations = [project.configurations.utilityRuntime]
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
}

116
build.gradle.kts Normal file
View File

@@ -0,0 +1,116 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
application
idea
java
kotlin("jvm") version "1.3.70"
id("com.github.johnrengelman.shadow") version "5.2.0"
id("org.javamodularity.moduleplugin") version "1.5.0"
id("org.beryx.jlink") version "2.17.2"
}
val javaMajorVersion = "12"
application {
mainClassName = "holocore/com.projectswg.holocore.ProjectSWG"
}
repositories {
jcenter()
}
sourceSets {
main {
dependencies {
implementation(project(":pswgcommon"))
implementation(kotlin("stdlib"))
implementation(group="org.jetbrains.kotlinx", name="kotlinx-coroutines-core", version="1.3.5")
implementation(group="org.xerial", name="sqlite-jdbc", version="3.30.1")
implementation(group="org.mariadb.jdbc", name="mariadb-java-client", version="2.5.4")
implementation(group="org.mongodb", name="mongodb-driver-sync", version="3.12.2")
implementation(group="me.joshlarson", name="fast-json", version="3.0.0")
implementation(group="me.joshlarson", name="jlcommon-network", version="1.0.0")
implementation(group="commons-cli", name="commons-cli", version="1.4")
}
}
test {
dependencies {
implementation(group="junit", name="junit", version="4.12")
}
}
create("display") {
dependencies {
implementation(project(":pswgcommon"))
}
}
create("utility") {
dependencies {
implementation(project(":pswgcommon"))
implementation(group="org.jetbrains.kotlin", name="kotlin-stdlib", version="1.3.50")
implementation(group="org.xerial", name="sqlite-jdbc", version="3.23.1")
implementation(group="org.mongodb", name="mongodb-driver-sync", version="3.12.2")
implementation(group="me.joshlarson", name="fast-json", version="3.0.0")
}
}
create("integration") {
dependencies {
implementation(project(":pswgcommon"))
implementation(project(":client-holocore"))
implementation(group="org.xerial", name="sqlite-jdbc", version="3.23.1")
implementation(group="org.mongodb", name="mongodb-driver-sync", version="3.12.2")
implementation(group="junit", name="junit", version="4.12")
}
}
}
idea {
targetVersion = javaMajorVersion
module {
inheritOutputDirs = true
}
}
jlink {
// addOptions("--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages")
imageDir.set(file("$buildDir/holocore"))
imageZip.set(file("$buildDir/holocore.zip"))
launcher {
name = "holocore"
jvmArgs = listOf()
unixScriptTemplate = file("src/main/resources/jlink-unix-launch-template.txt")
}
}
tasks.named<ShadowJar>("shadowJar") {
archiveBaseName.set("Holocore")
archiveClassifier.set("")
archiveVersion.set("")
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class).configureEach {
kotlinOptions {
jvmTarget = javaMajorVersion
}
}
tasks.create<ShadowJar>("CreateConvertLoginJar") {
archiveBaseName.set("ConvertLogin")
archiveClassifier.set(null as String?)
archiveVersion.set(null as String?)
manifest.attributes["Main-Class"] = "com.projectswg.utility.ConvertLogin"
from(sourceSets.getByName("utility").output)
configurations = listOf(project.configurations.getByName("utilityRuntime"))
exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA")
}
tasks.create<ShadowJar>("CreatePacketCaptureProcessor") {
archiveBaseName.set("PacketCaptureProcessor")
archiveClassifier.set(null as String?)
archiveVersion.set(null as String?)
manifest.attributes["Main-Class"] = "com.projectswg.utility.packets.ProcessPacketCapture"
from(sourceSets.getByName("utility").output)
configurations = listOf(project.configurations.getByName("utilityRuntime"))
exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA")
}

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists