-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
103 lines (83 loc) · 2.42 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
103 lines (83 loc) · 2.42 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
import java.time.Year
plugins {
`java-library`
alias(libs.plugins.indraLicenserSpotless)
alias(libs.plugins.mavenPublish)
}
val javaVersion = 25
group = "net.hypejet"
version = releaseTag() ?: "1.0.5-SNAPSHOT"
description = "A Java library making modular programming easier"
repositories {
mavenCentral()
}
dependencies {
api(libs.slf4j)
compileOnlyApi(libs.jspecify)
compileOnlyApi(libs.jetbrainsAnnotations)
testImplementation(libs.junitJupiter)
testRuntimeOnly(libs.junitPlatformLauncher)
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(javaVersion))
withJavadocJar()
withSourcesJar()
}
tasks {
compileJava {
options.release = javaVersion
}
javadoc {
val docletOptions = options as StandardJavadocDocletOptions
docletOptions.addBooleanOption("html5", true)
}
test {
useJUnitPlatform()
}
}
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
pom {
artifactId = project.name.lowercase()
name = project.name
description = project.description
url = "https://github.com/Hypejet/Modules"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "Codestech1"
name = "Codestech"
email = "codestech@hypejet.net"
}
}
scm {
connection = "scm:git:git://github.com/Hypejet/Modules.git"
developerConnection = "scm:git:ssh://github.com:Hypejet/Modules.git"
url = "https://github.com/Hypejet/Modules"
}
}
}
}
mavenPublishing {
publishToMavenCentral()
signAllPublications()
}
indraSpotlessLicenser {
licenseHeaderFile(rootProject.file("LICENSE_HEADER"))
property("YEAR", Year.now().value.toString())
}
private fun releaseTag(): String? {
val ref = System.getenv("GITHUB_REF") ?: return null
val tagRefPrefix = "refs/tags/"
if (!ref.startsWith(tagRefPrefix))
return null
val tag = ref.removePrefix(tagRefPrefix)
if (tag.isEmpty() || !tag.startsWith("v")) return null
return tag.removePrefix("v").ifEmpty { null }
}