4
0
Fork 0
mirror of https://github.com/Anvilcraft/modpacktools synced 2024-06-02 18:49:31 +02:00
modpacktools/build.gradle.kts

95 lines
3.1 KiB
Plaintext
Raw Normal View History

import groovy.lang.GroovyObject
import org.gradle.api.JavaVersion.VERSION_1_8
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
//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"
version = "1.2-SNAPSHOT"
plugins {
id("java")
id("application")
id("idea")
id("org.jetbrains.kotlin.jvm") version "1.3.72"
id("org.jetbrains.dokka") version "1.4.0-rc"
}
configure<JavaPluginConvention> {
sourceCompatibility = VERSION_1_8
targetCompatibility = VERSION_1_8
}
repositories {
mavenCentral()
jcenter() //Used for dokka jdoc
maven("https://data.tilera.xyz/maven/") //Used for Addonscript
}
dependencies {
2020-08-06 17:31:21 +02:00
//Implementation
arrayOf(
2020-08-06 17:31:21 +02:00
//Anvilcraft
"ley.anvil:addonscript:1.0-SNAPSHOT",
2020-08-06 17:31:21 +02:00
//Kotlin
"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
"org.apache.commons:commons-csv:1.8",
2020-08-06 17:31:21 +02:00
"com.j2html:j2html:1.4.0", //HTML builder
"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
"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"
).forEach {implementation(it)}
testImplementation("junit:junit:4.12")
}
//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 17:31:21 +02:00
@Suppress("DEPRECATION") //"version" is deprecated and archiveVersion cannot be set outside task scope. Too Bad!
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)
set("Specification-Title", specTitle)
set("Implementation-Title", implTitle)
}
archiveBaseName.set(jarName)
2020-08-06 17:31:21 +02:00
from(configurations.runtimeClasspath.get()
.map {if(it.isDirectory) it else zipTree(it)})
with(tasks.jar.get())
}