-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
105 lines (90 loc) · 2.96 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.plugin.serialization)
alias(libs.plugins.dokka)
`java-library`
`maven-publish`
}
group = "me.tomasan7"
version = "5.0.1"
dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization.core)
implementation(libs.jsoup)
api(libs.ktor.client.core)
implementation(libs.ktor.client.cio)
// Debugging only
//implementation("io.ktor:ktor-client-logging-jvm:2.2.4")
testImplementation(kotlin("test"))
}
allprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "org.jetbrains.dokka")
dependencies {
/* Kotlin standard library */
implementation(kotlin("stdlib"))
/* Align versions of all Kotlin components. */
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
}
group = rootProject.group
version = rootProject.version
tasks {
val checkMainDoesntExist by registering {
doLast {
sourceSets.main.get().allSource.forEach { file ->
if (file.name in setOf("Main.kt", "Main.java"))
throw IllegalStateException("Main file found: $file")
}
}
}
publishToMavenLocal {
dependsOn(clean, test, checkMainDoesntExist)
}
}
java {
withSourcesJar()
}
kotlin {
jvmToolchain(17)
}
// https://kotlinlang.org/docs/dokka-gradle.html#build-javadoc-jar
val dokkaJavadocJar by tasks.registering(Jar::class) {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
val dokkaHtmlJar by tasks.registering(Jar::class) {
dependsOn(tasks.dokkaHtml)
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("html-doc")
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
artifact(dokkaJavadocJar)
artifact(dokkaHtmlJar)
pom {
name.set("JecnaAPI")
description.set("A library to access data from the SPSE Jecna web.")
licenses {
license {
name.set("MIT License")
url.set("https://www.opensource.org/licenses/mit-license.php")
distribution.set("repo")
}
}
developers {
developer {
id.set("Tomasan7")
name.set("Tomáš Hůla")
email.set("tomashula06@gmail.com")
}
}
}
}
}
}
}