-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
123 lines (111 loc) · 2.75 KB
/
build.gradle.kts
File metadata and controls
123 lines (111 loc) · 2.75 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
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
plugins {
kotlin("jvm") version "2.1.21"
id("io.papermc.paperweight.userdev") version "2.0.0-beta.18"
idea
`maven-publish`
id("com.diffplug.spotless") version "7.2.0"
}
group = "com.github.peco2282"
val propVer = project.property("version")
version =
if (propVer != null && propVer.toString() != "unspecified") propVer.toString()
else "v1.0.0"
repositories {
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(23))
}
tasks.build {
dependsOn("spotlessApply")
}
tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(21)
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
val sourcesJar by tasks.registering(Jar::class, fun Jar.() {
group = JavaBasePlugin.BUILD_TASK_NAME
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
})
val javadocJar by tasks.registering(Jar::class, fun Jar.() {
group = JavaBasePlugin.BUILD_TASK_NAME
archiveClassifier.set("javadoc")
val javadocTask = tasks.named("javadoc", Javadoc::class).get()
dependsOn(javadocTask)
from(javadocTask.destinationDir)
})
artifacts {
archives(sourcesJar)
archives(javadocJar)
}
val owningRepo = "peco2282/PaperKit"
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)
pom {
name.set(project.name.lowercase())
artifactId = project.name.lowercase()
description.set("PaperKit for Plugin-Dev")
url.set("https://github.com/${owningRepo}")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
}
scm {
connection.set("scm:git:git://github.com/${owningRepo}.git")
developerConnection.set("scm:git:ssh://github.com/${owningRepo}.git")
url.set("https://github.com/${owningRepo}")
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/${owningRepo}")
credentials {
username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("gpr.user") as String?
password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.token") as String?
}
}
}
}
spotless {
kotlin {
ktlint("1.7.0").setEditorConfigPath(".editorconfig")
toggleOffOn()
}
java {
googleJavaFormat()
importOrder(
"*",
"",
"java",
"static *"
)
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
leadingTabsToSpaces(2)
}
}