kommons/build.gradle.kts

146 lines
2.6 KiB
Plaintext

plugins {
kotlin("jvm") version "1.8.0"
`maven-publish`
}
repositories {
maven(url = "https://maven.minecraftforge.net") {
name = "Minecraft Forge"
content {
includeGroup("net.minecraftforge.gradle")
includeGroup("net.minecraftforge")
}
}
mavenCentral()
}
tasks.compileKotlin {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
freeCompilerArgs += "-Xjvm-default=all"
}
}
val projectGroup: String by project
val projectVersion: String by project
val specifyKotlinAsDependency: String by project
val fastutilVersion: String by project
val jupiterVersion: String by project
tasks.test {
useJUnitPlatform()
maxHeapSize = "8G"
}
dependencies {
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.junit.jupiter:junit-jupiter:${jupiterVersion}")
implementation("it.unimi.dsi:fastutil:$fastutilVersion")
}
tasks {
create("sourceJar", org.gradle.jvm.tasks.Jar::class.java) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
jar {
manifest {
attributes(
"Automatic-Module-Name" to "ru.dbotthepony.kommons",
"FMLModType" to "LIBRARY"
)
}
}
}
version = projectVersion
group = projectGroup
subprojects {
apply(plugin = "maven-publish")
apply(plugin = "kotlin")
group = projectGroup
version = projectVersion
tasks.compileKotlin {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
freeCompilerArgs += "-Xjvm-default=all"
}
}
tasks {
create("sourceJar", org.gradle.jvm.tasks.Jar::class.java) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
jar {
manifest {
attributes("FMLModType" to "LIBRARY")
}
}
}
kotlin {
jvmToolchain(17)
}
tasks.test {
useJUnitPlatform()
}
publishing {
repositories {
maven {
url = uri("sftp://maven@dbotthepony.ru:22/maven")
credentials {
val mavenUser: String by project
val mavenPassword: String by project
username = mavenUser
password = mavenPassword
}
}
}
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks["sourceJar"])
pom {
dependencies {
if (specifyKotlinAsDependency.toBoolean()) implementation(kotlin("stdlib"))
implementation("it.unimi.dsi:fastutil:[8.0,)")
}
}
}
}
repositories {
maven {
url = uri("sftp://maven@dbotthepony.ru:22/maven")
credentials {
val mavenUser: String by project
val mavenPassword: String by project
username = mavenUser
password = mavenPassword
}
}
}
}