-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle.kts
111 lines (106 loc) · 3.8 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
106
107
108
109
110
111
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
import java.io.ByteArrayOutputStream
import java.net.URL
plugins {
kotlin("jvm") version (libs.versions.kotlin.get()) apply false
alias(libs.plugins.dokka)
alias(libs.plugins.shadow) apply false
alias(libs.plugins.mkdocs)
}
fun cmd(vararg args: String): String? {
val output = ByteArrayOutputStream()
val r = exec {
this.commandLine(args.toList())
this.isIgnoreExitValue = true
this.standardOutput = output
this.errorOutput = ByteArrayOutputStream()
}
return if (r.exitValue == 0) output.toByteArray().decodeToString().trim()
else null
}
val tag = cmd("git", "describe", "--tags", "HEAD")
val hash = cmd("git", "rev-parse", "--short", "HEAD")!!
val isSnapshot = tag == null || hash in tag
allprojects {
group = "org.notenoughupdates.moulconfig"
version = if (isSnapshot) "9999.9999.9999" else tag!!
repositories {
mavenLocal()
mavenCentral()
maven("https://repo.nea.moe/releases")
maven("https://repo.spongepowered.org/maven/")
maven("https://maven.neoforged.net/releases")
}
afterEvaluate {
tasks.withType(AbstractDokkaLeafTask::class).configureEach {
dokkaSourceSets.configureEach {
println("Configuring $this")
sourceLink {
localDirectory.set(project.file("src/"))
remoteUrl.set(URL("https://github.com/NotEnoughUpdates/MoulConfig/blob/$hash/${project.name}/src"))
remoteLineSuffix.set("#L")
}
}
}
tasks.withType(ShadowJar::class).configureEach {
relocate("juuxel.libninepatch", "io.github.notenoughupdates.moulconfig.deps.libninepatch")
}
extensions.findByType<PublishingExtension>()?.apply {
repositories {
if (project.hasProperty("moulconfigPassword") && !isSnapshot) {
maven {
url = uri("https://maven.notenoughupdates.org/releases")
name = "moulconfig"
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}
}
publications.filterIsInstance<MavenPublication>().forEach {
it.pom {
licenses {
license {
name.set("LGPL-3.0 or later")
url.set("https://github.com/NotEnoughUpdates/NotEnoughUpdates/blob/HEAD/COPYING.LESSER")
}
}
developers {
developer {
name.set("NotEnoughUpdates contributors")
}
developer {
name.set("Linnea Gräf")
}
}
scm {
url.set("https://github.com/NotEnoughUpdates/MoulConfig")
}
}
}
}
}
}
mkdocs {
python {
pip("mkdocs-zettelkasten:0.1.9")
}
strict = false
}
tasks.register("compileAllDocs", Copy::class) {
dependsOn(tasks.mkdocsBuild)
dependsOn(tasks.dokkaHtmlMultiModule)
destinationDir = layout.buildDirectory.dir("allDocs").get().asFile
from(tasks.mkdocsBuild)
from(tasks.dokkaHtmlMultiModule.get().outputDirectory) {
into("javadocs")
}
}
subprojects {
if (plugins.hasPlugin("org.jetbrains.dokka"))
dependencies {
"dokkaPlugin"("org.jetbrains.dokka:kotlin-as-java-plugin:1.9.10")
}
}