rcdbquery/build.gradle.kts

101 lines
2.5 KiB
Text

import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
extra.apply {
set("pheeraiBomVersion", "0.0.3-SNAPSHOT")
set("kotlinApiVersion", "1.4")
set("javaVersion", JavaVersion.VERSION_11)
}
}
inline fun <reified T> getFromExtra(prop: String) = project.extra[prop] as T
// TODO: Documentation
// TODO: Source Jar
// TODO: Doc Jar
// TODO: Proper Maven publish
plugins {
kotlin("jvm")
`maven-publish`
id("org.jetbrains.dokka")
}
repositories {
mavenCentral()
jcenter()
google()
maven {
url = uri("https://git.f3l.de/api/v4/projects/160/packages/maven")
mavenContent {
includeGroup("de.pheerai")
includeGroup("de.pheerai.eap")
}
}
}
project.version = "0.0.3-SNAPSHOT"
project.group = "de.pheerai.rcdb"
java {
targetCompatibility = getFromExtra("javaVersion")
sourceCompatibility = getFromExtra("javaVersion")
withSourcesJar()
}
kotlin {
explicitApi = ExplicitApiMode.Strict
}
dependencies {
implementation(enforcedPlatform("de.pheerai:kotlin-crawler-app-bom:${getFromExtra<String>("pheeraiBomVersion")}"))
testImplementation("io.kotest", "kotest-runner-junit5-jvm")
testImplementation("io.kotest", "kotest-assertions-core-jvm")
}
tasks {
withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = getFromExtra("kotlinApiVersion")
languageVersion = getFromExtra("kotlinApiVersion")
jvmTarget = getFromExtra<JavaVersion>("javaVersion").toString()
}
}
test {
useJUnitPlatform()
}
val javadocJar by registering(Jar::class) {
from("dokkaJavadoc")
archiveClassifier.set("javadoc")
}
artifacts {
archives(javadocJar)
archives(jar)
}
}
publishing {
publications {
create<MavenPublication>("QueryBuilder") {
from(components["java"])
artifact(tasks["javadocJar"])
}
repositories {
maven {
url = uri("https://git.f3l.de/api/v4/projects/180/packages/maven")
name = "GitLab"
credentials(HttpHeaderCredentials::class.java) {
name = "Job-Token"
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
create<HttpHeaderAuthentication>("header")
}
}
}
}
}