kommons/build.gradle.kts
2024-02-11 12:57:02 +07:00

121 lines
2.2 KiB
Plaintext

plugins {
kotlin("jvm") version "1.8.0"
`maven-publish`
}
repositories {
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()
}
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)
}
}
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)
}
}
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
}
}
}
}