-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
198 lines (176 loc) · 7.87 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
plugins {
`kotlin-dsl`
`maven-publish`
id("org.jlleitschuh.gradle.ktlint")
id("io.gitlab.arturbosch.detekt")
id("org.jetbrains.dokka")
id("com.gradle.plugin-publish")
id("org.shipkit.shipkit-auto-version")
id("org.shipkit.shipkit-changelog")
id("org.shipkit.shipkit-github-release")
id("com.adarshr.test-logger")
}
group = "dev.mythicdrops"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
withJavadocJar()
withSourcesJar()
}
@Suppress("UnstableApiUsage")
gradlePlugin {
website.set("https://github.com/MythicDrops/mythicdrops-gradle-plugin")
vcsUrl.set("https://github.com/MythicDrops/mythicdrops-gradle-plugin")
plugins {
create("mythicDropsProject") {
id = "dev.mythicdrops.gradle.project"
displayName = "mythicDropsGradleProject"
description = "Orchestration plugin for all MythicDrops Gradle projects."
implementationClass = "dev.mythicdrops.gradle.MythicDropsPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsProjectRoot") {
id = "dev.mythicdrops.gradle.project.root"
displayName = "mythicDropsGradleProjectRoot"
description = "Common conventions for MythicDrops root Gradle projects."
implementationClass = "dev.mythicdrops.gradle.projects.MythicDropsRootPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsProjectBase") {
id = "dev.mythicdrops.gradle.project.base"
displayName = "mythicDropsGradleProjectBase"
description = "Common conventions for all MythicDrops Gradle projects."
implementationClass = "dev.mythicdrops.gradle.projects.MythicDropsBasePlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsReleaseGitHub") {
id = "dev.mythicdrops.gradle.release.github"
displayName = "mythicDropsGradleReleaseGitHub"
description = "Create a GitHub Release via GitHub Actions for all MythicDrops Gradle projects."
implementationClass = "dev.mythicdrops.gradle.release.MythicDropsReleaseGitHubPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionJava") {
id = "dev.mythicdrops.gradle.convention.java"
displayName = "mythicDropsGradleConventionJava"
description = "Common conventions for all MythicDrops Java Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsJavaPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionJavaPlatform") {
id = "dev.mythicdrops.gradle.convention.java-platform"
displayName = "mythicDropsGradleConventionJavaPlatform"
description = "Common conventions for all MythicDrops Java Platform Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsJavaPlatformPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionJvmTestSuite") {
id = "dev.mythicdrops.gradle.convention.jvm-test-suite"
displayName = "mythicDropsGradleConventionJvmSuite"
description = "Common conventions for all MythicDrops JVM Test Suite Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsJvmTestSuitePlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionKotlinJvm") {
id = "dev.mythicdrops.gradle.convention.kotlin.jvm"
displayName = "mythicDropsGradleConventionKotlinJvm"
description = "Common conventions for all MythicDrops Kotlin JVM Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsKotlinJvmPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionsMavenPublish") {
id = "dev.mythicdrops.gradle.convention.maven-publish"
displayName = "mythicDropsGradle"
description = "Common conventions for all MythicDrops Maven Publishing Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsMavenPublishPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsSpigotBuildTools") {
id = "dev.mythicdrops.gradle.spigot.build"
displayName = "mythicDropsGradleSpigotBuildTools"
description = "Builds and installs versions of Spigot to Maven Local."
implementationClass = "dev.mythicdrops.gradle.spigot.MythicDropsSpigotBuildToolsGradlePlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention", "spigot"))
}
}
}
ktlint {
version.set("1.1.1")
}
tasks {
// get dokkaJavadoc task and make javadocJar depend on it
val dokkaJavadoc by this
getByName<Jar>("javadocJar") {
dependsOn(dokkaJavadoc)
from(dokkaJavadoc)
}
// use JUnit Jupiter
withType<Test> {
useJUnitPlatform()
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
}
}
getByName("generateChangelog") {
dependsOn(
"compileJava",
"compileKotlin",
"javadoc",
"dokkaJavadoc",
"javadocJar",
"sourcesJar",
"generateMetadataFileForPluginMavenPublication",
"generatePomFileForPluginMavenPublication",
)
}
// Make GitHub release depend on generating a changelog
val generateChangelog =
getByName<org.shipkit.changelog.GenerateChangelogTask>("generateChangelog") {
previousRevision = project.ext.get("shipkit-auto-version.previous-tag")?.toString()
githubToken = System.getenv("GITHUB_TOKEN")
repository = "MythicDrops/mythicdrops-gradle-plugin"
}
getByName<org.shipkit.github.release.GithubReleaseTask>("githubRelease") {
dependsOn(generateChangelog)
repository = generateChangelog.repository
changelog = generateChangelog.outputFile
githubToken = System.getenv("GITHUB_TOKEN")
newTagRevision = System.getenv("GITHUB_SHA")
}
}
repositories {
gradlePluginPortal() // other plugins on the plugin portal
mavenCentral() // general dependencies
}
dependencies {
// kotlin reflection
implementation(kotlin("reflect"))
// kotlin gradle plugin
implementation(kotlin("gradle-plugin"))
// nebula plugins
implementation("com.netflix.nebula:nebula-project-plugin:_")
// dokka plugins
implementation("org.jetbrains.dokka:dokka-core:_")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:_")
// shipkit
implementation("org.shipkit:shipkit-auto-version:_")
implementation("org.shipkit:shipkit-changelog:_")
// test logger plugin
implementation("com.adarshr:gradle-test-logger-plugin:_")
// detekt plugin
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:_")
// ktlint plugin
implementation("org.jlleitschuh.gradle:ktlint-gradle:_")
// gradle nexus publish plugin
implementation("io.github.gradle-nexus:publish-plugin:_")
// github api
implementation("org.kohsuke:github-api:_")
// spigot remapper
implementation("io.github.patrick-choe:mojang-spigot-remapper:_")
}
project.ext.set("gradle.publish.key", System.getenv("GRADLE_PUBLISH_KEY"))
project.ext.set("gradle.publish.secret", System.getenv("GRADLE_PUBLISH_SECRET"))