-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle.kts
100 lines (82 loc) · 2.84 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
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
import org.jetbrains.changelog.ChangelogSectionUrlBuilder
import org.jetbrains.dokka.gradle.DokkaTask
fun properties(key: String) = providers.gradleProperty(key)
plugins {
`kotlin-dsl`
`maven-publish`
alias(libs.plugins.pluginPublish)
alias(libs.plugins.changelog)
alias(libs.plugins.dokka)
}
repositories {
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
}
kotlin {
jvmToolchain(17)
}
@Suppress("UnstableApiUsage")
gradlePlugin {
website = properties("website")
vcsUrl = properties("vcsUrl")
plugins.create("grammarKitPlugin") {
id = properties("pluginId").get()
implementationClass = properties("pluginImplementationClass").get()
displayName = properties("pluginDisplayName").get()
description = properties("pluginDescription").get()
tags = properties("tags").map { it.split(',') }
}
}
val dokkaHtml by tasks.existing(DokkaTask::class)
val javadocJar by tasks.registering(Jar::class) {
dependsOn(dokkaHtml)
archiveClassifier = "javadoc"
from(dokkaHtml.map { it.outputDirectory })
}
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier = "sources"
from(sourceSets.main.get().allSource)
}
artifacts {
archives(javadocJar)
archives(sourcesJar)
}
changelog {
headerParserRegex = """(\d+(\.\d+)+)""".toRegex()
groups.empty()
repositoryUrl = properties("website")
sectionUrlBuilder = ChangelogSectionUrlBuilder { repositoryUrl, currentVersion, previousVersion, isUnreleased ->
repositoryUrl + when {
isUnreleased -> when (previousVersion) {
null -> "/commits"
else -> "/compare/$previousVersion...HEAD"
}
previousVersion == null -> "/commits/$currentVersion"
else -> "/compare/$previousVersion...$currentVersion"
}
}
}
tasks {
test {
val testGradleHome = properties("testGradleUserHome")
.map { File(it) }
.getOrElse(
layout.buildDirectory.asFile.map { it.resolve("testGradleHome") }.get()
)
systemProperties["test.gradle.home"] = testGradleHome
systemProperties["test.gradle.default"] = properties("gradleVersion").orNull
systemProperties["test.gradle.version"] = properties("testGradleVersion").orNull
systemProperties["test.gradle.arguments"] = properties("testGradleArguments").orNull
outputs.dir(testGradleHome)
}
wrapper {
gradleVersion = properties("gradleVersion").get()
distributionUrl = "https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
validatePlugins {
enableStricterValidation = true
}
}