-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
137 lines (123 loc) · 3.97 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
plugins {
id("java-gradle-plugin")
id("maven-publish")
id("signing")
id("com.diffplug.spotless")
}
group = "org.ajoberstar.defaults"
description = "ajoberstar's Gradle convention plugins"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
withJavadocJar()
withSourcesJar()
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
}
gradlePlugin {
plugins {
create("gradlePluginPlugin") {
id = "org.ajoberstar.defaults.gradle-plugin"
displayName = "ajoberstar's gradle-plugin convention"
description = "ajoberstar's gradle-plugin convention"
implementationClass = "org.ajoberstar.gradle.defaults.GradlePluginConventionPlugin"
}
create("javaLibraryPlugin") {
id = "org.ajoberstar.defaults.java-library"
displayName = "ajoberstar's java-library convention"
description = "ajoberstar's java-library convention"
implementationClass = "org.ajoberstar.gradle.defaults.JavaLibraryConventionPlugin"
}
create("lockingPlugin") {
id = "org.ajoberstar.defaults.locking"
displayName = "ajoberstar's locking convention"
description = "ajoberstar's locking convention"
implementationClass = "org.ajoberstar.gradle.defaults.LockingConventionPlugin"
}
create("mavenCentralPlugin") {
id = "org.ajoberstar.defaults.maven-central"
displayName = "ajoberstar's Maven Central convention"
description = "ajoberstar's Maven Central convention"
implementationClass = "org.ajoberstar.gradle.defaults.MavenCentralConventionPlugin"
}
create("spotlessPlugin") {
id = "org.ajoberstar.defaults.spotless"
displayName = "ajoberstar's Spotless convention"
description = "ajoberstar's Spotless convention"
implementationClass = "org.ajoberstar.gradle.defaults.SpotlessConventionPlugin"
}
}
}
publishing {
repositories {
maven {
name = "CentralReleases"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = providers.environmentVariable("OSSRH_USERNAME").orNull
password = providers.environmentVariable("OSSRH_PASSWORD").orNull
}
}
maven {
name = "CentralSnapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
credentials {
username = providers.environmentVariable("OSSRH_USERNAME").orNull
password = providers.environmentVariable("OSSRH_PASSWORD").orNull
}
}
}
publications {
withType<MavenPublication> {
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set("org.ajoberstar.defaults")
description.set("ajoberstar's Gradle convention plugins")
url.set("https://github.com/ajoberstar/gradle-defaults")
developers {
developer {
name.set("Andrew Oberstar")
email.set("ajoberstar@gmail.com")
}
}
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0")
}
}
scm {
url.set("https://github.com/ajoberstar/gradle-defaults")
connection.set("scm:git:git@github.com:ajoberstar/gradle-defaults.git")
developerConnection.set("scm:git:ssh:git@github.com:ajoberstar/gradle-defaults.git")
}
}
}
}
}
signing {
setRequired(providers.environmentVariable("CI").orNull)
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassphrase: String? by project
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassphrase)
sign(publishing.publications)
}
spotless {
java {
importOrder("java", "javax", "");
eclipse().configFile(rootProject.file("gradle/eclipse-java-formatter.xml"))
}
}