-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
73 lines (61 loc) · 1.85 KB
/
build.gradle.kts
File metadata and controls
73 lines (61 loc) · 1.85 KB
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
import java.util.Properties
plugins {
kotlin("jvm") version "1.6.10" // Use the appropriate Kotlin version
id("com.github.johnrengelman.shadow") version "7.0.0" // Shadow plugin for creating a fat JAR
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
id("org.jetbrains.dokka") version "1.9.10"
`maven-publish` // Required for publishing the library
}
// Read properties file
val versionProperties =
Properties().apply {
load(file("version.properties").inputStream())
}
// Set the library version
version = versionProperties["version"] as String
group = "dev.onelenyk" // Replace with your group id
repositories {
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
testImplementation("org.mockito.kotlin:mockito-kotlin:5.0.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
}
// Include necessary information for JitPack
tasks.named<Jar>("jar") {
manifest {
attributes["Implementation-Title"] = project.name
attributes["Implementation-Version"] = project.version
}
}
// Shadow plugin configuration to create a fat JAR (if needed)
tasks.shadowJar {
archiveClassifier.set("")
manifest {
attributes["Main-Class"] = group + "LibraryKt" // Replace with your main class
}
}
tasks.test {
useJUnitPlatform()
}
// dokka
tasks.register<Jar>("dokkaHtmlJar") {
dependsOn(tasks.dokkaHtml)
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
// Configure publishing
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks["dokkaJavadocJar"])
}
}
}