1
- import io.spring.gradle.bintray.SpringBintrayExtension
2
1
import nebula.plugin.contacts.Contact
3
2
import nebula.plugin.contacts.ContactsExtension
4
- import nebula.plugin.info.InfoBrokerPlugin
5
3
import nl.javadude.gradle.plugins.license.LicenseExtension
6
4
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
7
- import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
8
- import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
9
5
import java.util.*
10
6
11
7
buildscript {
12
8
repositories {
13
- jcenter()
14
9
gradlePluginPortal()
15
10
}
16
-
17
- dependencies {
18
- classpath(" io.spring.gradle:spring-release-plugin:0.20.1" )
19
-
20
- constraints {
21
- classpath(" org.jfrog.buildinfo:build-info-extractor-gradle:4.13.0" ) {
22
- because(" Need recent version for Gradle 6+ compatibility" )
23
- }
24
- }
25
- }
26
11
}
27
12
28
13
plugins {
29
14
`java- library`
30
- id(" org.jetbrains.kotlin.jvm" ) version " 1.4.20"
31
- id(" io.spring.release" ) version " 0.20.1"
32
- }
15
+ `maven- publish`
16
+ signing
17
+
18
+ id(" nebula.maven-resolved-dependencies" ) version " 17.3.2"
19
+ id(" nebula.release" ) version " 15.3.1"
20
+ id(" io.github.gradle-nexus.publish-plugin" ) version " 1.0.0"
33
21
34
- apply (plugin = " license" )
35
- apply (plugin = " nebula.maven-resolved-dependencies" )
36
- apply (plugin = " io.spring.publishing" )
22
+ id(" com.github.hierynomus.license" ) version " 0.15.0"
23
+ id(" org.jetbrains.kotlin.jvm" ) version " 1.4.21"
24
+ id(" com.github.jk1.dependency-license-report" ) version " 1.16"
25
+
26
+ id(" nebula.maven-publish" ) version " 17.3.2"
27
+ id(" nebula.contacts" ) version " 5.1.0"
28
+ id(" nebula.info" ) version " 9.3.0"
29
+
30
+ id(" nebula.javadoc-jar" ) version " 17.3.2"
31
+ id(" nebula.source-jar" ) version " 17.3.2"
32
+ id(" nebula.maven-apache-license" ) version " 17.3.2"
33
+ }
37
34
38
35
group = " org.openrewrite.recipe"
39
- description = " A rewrite module automating best practices and major version migrations for popular Java test frameworks like JUnit and Mockito "
36
+ description = " A rewrite module automating best practices and major version migrations for popular Java test frameworks like JUnit and Mockito"
40
37
41
38
repositories {
42
39
mavenLocal()
43
- maven { url = uri(" https://dl.bintray.com/openrewrite/maven" ) }
44
40
mavenCentral()
45
41
}
46
42
43
+ nexusPublishing {
44
+ repositories {
45
+ sonatype {
46
+ username.set(project.findProperty(" ossrhUsername" ) as String? ? : System .getenv(" OSSRH_USERNAME" ))
47
+ password.set(project.findProperty(" ossrhToken" ) as String? ? : System .getenv(" OSSRH_TOKEN" ))
48
+ }
49
+ }
50
+ }
51
+
52
+ signing {
53
+ setRequired({
54
+ ! project.version.toString().endsWith(" SNAPSHOT" ) || project.hasProperty(" forceSigning" )
55
+ })
56
+ val signingKey = project.findProperty(" signingKey" ) as String? ? : System .getenv(" SIGNING_KEY" )
57
+ val signingPassword = project.findProperty(" signingPassword" ) as String? ? : System .getenv(" SIGNING_PASSWORD" )
58
+ useInMemoryPgpKeys(signingKey, signingPassword)
59
+ sign(publishing.publications[" nebula" ])
60
+ }
61
+
47
62
sourceSets {
48
63
create(" before" )
49
64
create(" after" )
@@ -140,7 +155,8 @@ configure<PublishingExtension> {
140
155
while (i < length) {
141
156
(dependencyList.item(i) as org.w3c.dom.Element ).let { dependency ->
142
157
if ((dependency.getElementsByTagName(" scope" )
143
- .item(0 ) as org.w3c.dom.Element ).textContent == " provided" ) {
158
+ .item(0 ) as org.w3c.dom.Element ).textContent == " provided"
159
+ ) {
144
160
dependencies.removeChild(dependency)
145
161
i--
146
162
length--
@@ -155,67 +171,9 @@ configure<PublishingExtension> {
155
171
}
156
172
}
157
173
158
- configure<SpringBintrayExtension > {
159
- org = " openrewrite"
160
- repo = " maven"
161
- }
162
-
163
- project.withConvention(ArtifactoryPluginConvention ::class ) {
164
- setContextUrl(" https://oss.jfrog.org/artifactory" )
165
- publisherConfig.let {
166
- val repository: PublisherConfig .Repository = it.javaClass
167
- .getDeclaredField(" repository" )
168
- .apply { isAccessible = true }
169
- .get(it) as PublisherConfig .Repository
170
-
171
- repository.setRepoKey(" oss-snapshot-local" )
172
- repository.setUsername(project.findProperty(" bintrayUser" ))
173
- repository.setPassword(project.findProperty(" bintrayKey" ))
174
- }
175
- }
176
-
177
- tasks.withType<GenerateMavenPom > {
178
- doLast {
179
- // because pom.withXml adds blank lines
180
- destination.writeText(
181
- destination.readLines().filter { it.isNotBlank() }.joinToString(" \n " )
182
- )
183
- }
184
-
185
- doFirst {
186
- val runtimeClasspath = configurations.getByName(" runtimeClasspath" )
187
-
188
- val gav = { dep: ResolvedDependency ->
189
- " ${dep.moduleGroup} :${dep.moduleName} :${dep.moduleVersion} "
190
- }
191
-
192
- val observedDependencies = TreeSet <ResolvedDependency > { d1, d2 ->
193
- gav(d1).compareTo(gav(d2))
194
- }
195
-
196
- fun reduceDependenciesAtIndent (indent : Int ):
197
- (List <String >, ResolvedDependency ) -> List <String > =
198
- { dependenciesAsList: List <String >, dep: ResolvedDependency ->
199
- dependenciesAsList + listOf (" " .repeat(indent) + dep.module.id.toString()) + (
200
- if (observedDependencies.add(dep)) {
201
- dep.children
202
- .sortedBy(gav)
203
- .fold(emptyList(), reduceDependenciesAtIndent(indent + 2 ))
204
- } else {
205
- // this dependency subtree has already been printed, so skip it
206
- emptyList()
207
- }
208
- )
209
- }
210
-
211
- project.plugins.withType<InfoBrokerPlugin > {
212
- add(" Resolved-Dependencies" , runtimeClasspath
213
- .resolvedConfiguration
214
- .lenientConfiguration
215
- .firstLevelModuleDependencies
216
- .sortedBy(gav)
217
- .fold(emptyList(), reduceDependenciesAtIndent(6 ))
218
- .joinToString(" \n " , " \n " , " \n " + " " .repeat(4 )))
219
- }
220
- }
174
+ tasks.withType<Javadoc > {
175
+ // assertTrue(boolean condition) -> assertThat(condition).isTrue()
176
+ // warning - invalid usage of tag >
177
+ // see also: https://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
178
+ (options as StandardJavadocDocletOptions ).addStringOption(" Xdoclint:none" , " -quiet" )
221
179
}
0 commit comments