-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
133 lines (110 loc) · 3.73 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
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins {
`java-library`
`maven-publish`
signing
id("io.freefair.aspectj") version ("6.3.0")
}
group = "io.github.maikbasel"
version = "0.1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
implementation(libs.aspectjrt)
testImplementation(libs.junit.jupiter)
testImplementation(libs.assertj.core)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
val isReleaseVersion by extra { version.toString().endsWith("SNAPSHOT").not() }
object Meta {
const val DESC =
"A Java adaptation of Rust's std::todo macro features using static factory methods, AspectJ's AOP, and annotations to mark unimplemented code sections."
const val LICENSE = "MIT"
const val GITHUB_REPO = "maikbasel/todo"
const val RELEASE_REPO = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
const val SNAPSHOT_REPO = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
pom {
name.set(project.name)
description.set(Meta.DESC)
url.set("https://github.com/${Meta.GITHUB_REPO}")
licenses {
license {
name.set(Meta.LICENSE)
url.set("https://opensource.org/license/mit")
}
}
developers {
developer {
id.set("maikbasel")
name.set("Maik Basel")
}
}
scm {
url.set(
"https://github.com/${Meta.GITHUB_REPO}.git"
)
connection.set(
"scm:git:git://github.com/${Meta.GITHUB_REPO}.git"
)
developerConnection.set(
"scm:git:git://github.com/${Meta.GITHUB_REPO}.git"
)
}
issueManagement {
url.set("https://github.com/${Meta.GITHUB_REPO}/issues")
}
}
repositories {
maven {
url = if (isReleaseVersion) uri(Meta.RELEASE_REPO) else uri(Meta.SNAPSHOT_REPO)
credentials {
val ossrhUsername: String? by project
val ossrhPassword: String? by project
username = ossrhUsername
password = ossrhPassword
}
}
}
}
}
}
signing {
val os: OperatingSystem = DefaultNativePlatform.getCurrentOperatingSystem()
if (os.isWindows) {
useGpgCmd()
} else {
val signingKeyId: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKeyId, signingPassword)
}
sign(publishing.publications["mavenJava"])
}
tasks.named<Test>("test") {
useJUnitPlatform()
}
tasks.register("javadocAspectj", Javadoc::class) {
description = "Generates JavaDoc documentation for the aspectj sources set."
group = "documentation"
source = sourceSets["aspectj"].allJava
}
tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}