0
0
mirror of https://github.com/tursom/TursomServer.git synced 2025-02-16 23:00:59 +08:00
TursomServer/build.gradle.kts

87 lines
2.2 KiB
Plaintext
Raw Normal View History

2021-04-11 18:15:58 +08:00
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
ext["netty.version"] = "4.1.59.Final"
ext["excludeTest"] = { project: Project, tasks: TaskContainer ->
if (project.gradle.startParameter.taskNames.firstOrNull { taskName ->
taskName.endsWith(":test")
} == null) {
tasks {
test { enabled = false }
testClasses { enabled = false }
compileTestJava { enabled = false }
compileTestKotlin { enabled = false }
processTestResources { enabled = false }
}
}
}
plugins {
2021-06-30 22:02:28 +08:00
kotlin("jvm") version "1.5.20"
2021-04-11 18:48:18 +08:00
`maven-publish`
2021-04-11 18:15:58 +08:00
}
allprojects {
group = "cn.tursom"
version = "0.2"
repositories {
mavenLocal()
mavenCentral()
}
tasks.withType<JavaCompile> {
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
if (project.gradle.startParameter.taskNames.firstOrNull { taskName ->
taskName.endsWith(":test")
} == null) {
tasks.withType<Test> {
enabled = false
}
}
}
2021-04-19 16:19:35 +08:00
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
//kotlinOptions.useIR = true
}
2021-04-11 18:15:58 +08:00
}
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
dependencies {
api(kotlin("stdlib-jdk8"))
api(kotlin("reflect"))
testImplementation(group = "junit", name = "junit", version = "4.12")
}
2021-04-11 18:48:18 +08:00
2021-04-19 16:19:35 +08:00
artifacts {
archives(tasks["kotlinSourcesJar"])
}
2021-04-11 18:48:18 +08:00
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
2021-04-19 16:19:35 +08:00
artifact(tasks["kotlinSourcesJar"])
2021-04-11 18:48:18 +08:00
} catch (e: Exception) {
}
}
}
}