2020-08-06 15:56:04 +02:00
|
|
|
import groovy.lang.GroovyObject
|
2020-08-06 18:38:57 +02:00
|
|
|
import org.gradle.api.JavaVersion.VERSION_1_8
|
2020-08-06 15:56:04 +02:00
|
|
|
import org.gradle.jvm.tasks.Jar
|
2020-08-06 17:31:21 +02:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinTest
|
|
|
|
|
2020-08-06 18:38:57 +02:00
|
|
|
//settings for manifest and stuff
|
|
|
|
val specTitle = "ModPackTools"
|
|
|
|
val jarName = specTitle
|
|
|
|
val implTitle = "ley.anvil.modpacktools"
|
2020-08-06 17:31:21 +02:00
|
|
|
group = "ley.anvil"
|
|
|
|
application.mainClassName = "ley.anvil.modpacktools.Main"
|
|
|
|
|
2020-08-08 15:19:28 +02:00
|
|
|
version = "1.2-SNAPSHOT"
|
2020-08-06 15:56:04 +02:00
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("java")
|
|
|
|
id("application")
|
|
|
|
id("idea")
|
|
|
|
id("org.jetbrains.kotlin.jvm") version "1.3.72"
|
2020-08-09 18:33:14 +02:00
|
|
|
id("org.jetbrains.dokka") version "1.4.0-rc"
|
2020-08-06 15:56:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
configure<JavaPluginConvention> {
|
2020-08-06 18:38:57 +02:00
|
|
|
sourceCompatibility = VERSION_1_8
|
|
|
|
targetCompatibility = VERSION_1_8
|
2020-08-06 15:56:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2020-08-09 18:33:14 +02:00
|
|
|
jcenter() //Used for dokka jdoc
|
2020-08-06 18:38:57 +02:00
|
|
|
maven("https://data.tilera.xyz/maven/") //Used for Addonscript
|
2020-08-06 15:56:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2020-08-06 17:31:21 +02:00
|
|
|
//Implementation
|
2020-08-06 15:56:04 +02:00
|
|
|
arrayOf(
|
2020-08-06 17:31:21 +02:00
|
|
|
//Anvilcraft
|
2020-08-06 18:38:57 +02:00
|
|
|
"ley.anvil:addonscript:1.0-SNAPSHOT",
|
2020-08-06 15:56:04 +02:00
|
|
|
|
2020-08-06 17:31:21 +02:00
|
|
|
//Kotlin
|
2020-08-06 15:56:04 +02:00
|
|
|
"org.jetbrains.kotlin:kotlin-reflect:1.3.72",
|
|
|
|
"org.jetbrains.kotlin:kotlin-stdlib-jdk8",
|
|
|
|
"org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.3.8",
|
2020-08-06 17:31:21 +02:00
|
|
|
|
|
|
|
//IO
|
|
|
|
"com.squareup.okhttp3:okhttp:4.8.0", //HTTP client
|
|
|
|
"com.moandjiezana.toml:toml4j:0.7.2", //Config file parser
|
2020-08-06 15:56:04 +02:00
|
|
|
"org.apache.commons:commons-csv:1.8",
|
2020-08-06 17:31:21 +02:00
|
|
|
"com.j2html:j2html:1.4.0", //HTML builder
|
2020-08-06 15:56:04 +02:00
|
|
|
"commons-io:commons-io:2.7",
|
2020-08-06 17:31:21 +02:00
|
|
|
"com.google.code.gson:gson:2.8.6",
|
|
|
|
|
|
|
|
//CLI
|
|
|
|
"net.sourceforge.argparse4j:argparse4j:0.8.1", //CLI argument parser
|
|
|
|
"com.github.ajalt:mordant:1.2.1", //CLI text formatting
|
2020-08-06 22:14:14 +02:00
|
|
|
"com.jakewharton.fliptables:fliptables:1.1.0", //Text Table
|
2020-08-06 17:31:21 +02:00
|
|
|
|
|
|
|
//Other
|
|
|
|
"org.slf4j:slf4j-simple:2.0.0-alpha1",
|
|
|
|
"org.reflections:reflections:0.9.12"
|
2020-08-06 17:03:17 +02:00
|
|
|
).forEach {implementation(it)}
|
2020-08-06 15:56:04 +02:00
|
|
|
|
2020-08-06 17:03:17 +02:00
|
|
|
testImplementation("junit:junit:4.12")
|
2020-08-06 15:56:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//This exists so options can be set for test compile and compile at once
|
|
|
|
val kOptions = {obj: GroovyObject ->
|
|
|
|
//This is sorta garbage, but if i would do this the proper way Intelli'ntJ would think its an error even tho it is not
|
|
|
|
obj.withGroovyBuilder {
|
|
|
|
"kotlinOptions" {
|
|
|
|
setProperty("jvmTarget", "1.8")
|
|
|
|
//without this option, kotlin interfaces dont support default methods in java (will be changed in kt 1.4)
|
|
|
|
setProperty("freeCompilerArgs", arrayOf("-Xjvm-default=compatibility"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-06 17:31:21 +02:00
|
|
|
tasks.withType<KotlinCompile> {kOptions(this as GroovyObject)}
|
|
|
|
tasks.withType<KotlinTest> {kOptions(this as GroovyObject)}
|
2020-08-06 15:56:04 +02:00
|
|
|
|
2020-08-06 17:31:21 +02:00
|
|
|
@Suppress("DEPRECATION") //"version" is deprecated and archiveVersion cannot be set outside task scope. Too Bad!
|
2020-08-06 15:56:04 +02:00
|
|
|
task("fatJar", Jar::class) {
|
2020-08-06 17:31:21 +02:00
|
|
|
group = "build" //sets group in intelliJ's side bar
|
|
|
|
manifest.attributes.apply {
|
|
|
|
set("Main-Class", application.mainClassName)
|
|
|
|
set("Implementation-Version", version)
|
2020-08-06 18:38:57 +02:00
|
|
|
set("Specification-Title", specTitle)
|
|
|
|
set("Implementation-Title", implTitle)
|
2020-08-06 15:56:04 +02:00
|
|
|
}
|
|
|
|
archiveBaseName.set(jarName)
|
2020-08-06 17:31:21 +02:00
|
|
|
from(configurations.runtimeClasspath.get()
|
|
|
|
.map {if(it.isDirectory) it else zipTree(it)})
|
2020-08-06 15:56:04 +02:00
|
|
|
with(tasks.jar.get())
|
|
|
|
}
|