forked from CadixDev/Lorenz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
139 lines (117 loc) · 4.23 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
import com.google.cloud.artifactregistry.gradle.plugin.ArtifactRegistryGradlePlugin
import org.cadixdev.gradle.licenser.Licenser
import org.cadixdev.gradle.licenser.LicenseExtension
plugins {
`java-library`
id("org.cadixdev.licenser") version "0.5.0" apply false
id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.0" apply false
}
val projectName: String by project
val projectUrl: String by project
val projectInceptionYear: String by project
val bombeVersion: String by project
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
allprojects {
group = "org.cadixdev"
version = "0.5.10-SNAPSHOT"
}
subprojects {
apply<JavaLibraryPlugin>()
apply<MavenPublishPlugin>()
apply<Licenser>()
apply<ArtifactRegistryGradlePlugin>()
repositories {
mavenCentral()
if (bombeVersion.endsWith("-SNAPSHOT")) {
maven("https://oss.sonatype.org/content/groups/public/")
}
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.7.0"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-engine")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
withSourcesJar()
withJavadocJar()
}
tasks.javadoc {
options.optionFiles(rootProject.file("gradle/javadoc.options"))
}
configure<LicenseExtension> {
header = rootProject.file("HEADER.txt")
}
tasks.withType<JavaCompile>().configureEach {
options.release.set(8)
}
tasks.test {
useJUnitPlatform()
}
tasks.processResources {
from(rootProject.file("LICENSE.txt"))
}
configure<PublishingExtension> {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
withoutBuildIdentifier()
pom {
name.set(projectName)
description.set(project.description)
packaging = "jar"
url.set(projectUrl)
inceptionYear.set(projectInceptionYear)
scm {
connection.set("scm:git:https://github.com/CadixDev/Lorenz.git")
developerConnection.set("scm:git:git@github.com:CadixDev/Lorenz.git")
url.set("https://github.com/CadixDev/Lorenz")
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/CadixDev/Lorenz/issues")
}
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
distribution.set("repo")
}
}
developers {
developer {
id.set("jamierocks")
name.set("Jamie Mansfield")
email.set("jmansfield@cadixdev.org")
url.set("https://www.jamiemansfield.me")
timezone.set("Europe/London")
}
}
}
}
}
repositories {
maven {
url = uri("artifactregistry://us-maven.pkg.dev/moonsworth-299m4oir/maven-public")
}
}
}
if (project.hasProperty("ossrhUsername") && project.hasProperty("ossrhPassword")) {
apply<SigningPlugin>()
configure<SigningExtension> {
useGpgCmd()
setRequired {
!isSnapshot && (
gradle.taskGraph.hasTask("publishAllPublicationsToOssrhRepository")
|| gradle.taskGraph.hasTask("publishMavenPublicationToOssrhRepository")
)
}
sign(project.extensions.getByType<PublishingExtension>().publications["maven"])
}
}
}