1+ buildscript {
2+ dependencies {
3+ classpath " com.diffplug.spotless:spotless-plugin-gradle:6.19.0"
4+ }
5+ }
6+
17plugins {
8+ id " base"
29 id " jacoco"
3- id " java-library"
4- id " maven-publish"
10+ id " jacoco-report-aggregation"
11+ id " org.sonarqube" version " 4.2.1.3168"
12+ id " io.github.gradle-nexus.publish-plugin" version " 1.3.0"
13+ }
514
6- id " com.diffplug.spotless" version " 6.12.0"
15+ sonarqube {
16+ properties {
17+ property " sonar.host.url" , " https://sonarcloud.io"
18+ property " sonar.organization" , " goodforgod"
19+ property " sonar.projectKey" , " GoodforGod_$artifactRootId "
20+ property " sonar.coverage.jacoco.xmlReportPaths" , " build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
21+ }
722}
823
9- group = groupId
10- version = artifactVersion
24+ dependencies {
25+ jacocoAggregation project(" :graalvm-hint-annotations" )
26+ jacocoAggregation project(" :graalvm-hint-processor" )
27+ }
1128
12- subprojects {
13- apply plugin : " jacoco"
14- apply plugin : " java-library"
15- apply plugin : " maven-publish"
16- apply plugin : " com.diffplug.spotless"
29+ reporting {
30+ reports {
31+ testCodeCoverageReport(JacocoCoverageReport ) {
32+ testType = TestSuiteType . UNIT_TEST
33+ }
34+ }
35+ }
36+
37+ allprojects {
38+ group = groupId
39+ var ver = System . getenv(). getOrDefault(" RELEASE_VERSION" , artifactVersion)
40+ version = ver. startsWith(" v" ) ? ver. substring(1 ) : ver
1741
1842 repositories {
1943 mavenLocal()
2044 mavenCentral()
2145 maven { url " https://oss.sonatype.org/content/repositories/snapshots" }
2246 }
47+ }
2348
24- group = groupId
25- version = artifactVersion
49+ subprojects {
50+ apply plugin : " jacoco"
51+ apply plugin : " java-library"
52+ apply plugin : " com.diffplug.spotless"
2653
2754 sourceCompatibility = JavaVersion . VERSION_11
2855 targetCompatibility = JavaVersion . VERSION_11
2956
30- spotless {
31- java {
32- encoding(" UTF-8" )
33- importOrder()
34- removeUnusedImports()
35- eclipse(" 4.21.0" ). configFile(" ${ rootDir} /config/codestyle.xml" )
36- }
37- }
38-
3957 test {
4058 useJUnitPlatform()
4159 testLogging {
@@ -44,12 +62,20 @@ subprojects {
4462 }
4563
4664 reports {
47- html. enabled(false )
48- junitXml. enabled(false )
65+ html. required = false
66+ junitXml. required = false
67+ }
68+ }
69+
70+ spotless {
71+ java {
72+ encoding(" UTF-8" )
73+ importOrder()
74+ removeUnusedImports()
75+ eclipse(" 4.21" ). configFile(" ${ rootDir} /config/codestyle.xml" )
4976 }
5077 }
5178
52- jar. enabled(true )
5379
5480 tasks. withType(JavaCompile ) {
5581 options. encoding(" UTF-8" )
@@ -60,7 +86,7 @@ subprojects {
6086 check. dependsOn jacocoTestReport
6187 jacocoTestReport {
6288 reports {
63- xml. enabled true
89+ xml. required = true
6490 html. destination file(" ${ buildDir} /jacocoHtml" )
6591 }
6692 }
@@ -71,4 +97,100 @@ subprojects {
7197 options. addBooleanOption(" html5" , true )
7298 }
7399 }
100+ }
101+
102+ nexusPublishing {
103+ packageGroup = groupId
104+ repositories {
105+ sonatype {
106+ username = System . getenv(" OSS_USERNAME" )
107+ password = System . getenv(" OSS_PASSWORD" )
108+ nexusUrl. set(uri(" https://s01.oss.sonatype.org/service/local/" ))
109+ snapshotRepositoryUrl. set(uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" ))
110+ }
111+ }
112+ }
113+
114+ subprojects {
115+ apply plugin : " maven-publish"
116+ apply plugin : " org.sonarqube"
117+
118+ sonarqube {
119+ properties {
120+ property " sonar.host.url" , " https://sonarcloud.io"
121+ property " sonar.organization" , " goodforgod"
122+ property " sonar.projectKey" , " GoodforGod_$artifactRootId "
123+ }
124+ }
125+
126+ publishing {
127+ publications {
128+ mavenJava(MavenPublication ) {
129+ from components. java
130+ artifactId = " $artifactRootId -${ project.name} "
131+
132+ var artifactName = artifactId
133+ pom {
134+ url = " https://github.com/GoodforGod/$artifactRootId "
135+ name = artifactName
136+ description = " Annotation Processors that generate GraalVM configuration hints for native-image applications."
137+
138+ license {
139+ name = " Apache License 2.0"
140+ url = " https://github.com/GoodforGod/$artifactRootId /blob/master/LICENSE"
141+ distribution = " repo"
142+ }
143+
144+ developer {
145+ id = " GoodforGod"
146+ name = " Anton Kurako"
147+ email = " goodforgod.dev@gmail.com"
148+ url = " https://github.com/GoodforGod"
149+ }
150+
151+ scm {
152+ connection = " scm:git:git://github.com/GoodforGod/${ artifactRootId} .git"
153+ developerConnection = " scm:git:ssh://GoodforGod/${ artifactRootId} .git"
154+ url = " https://github.com/GoodforGod/$artifactRootId /tree/master"
155+ }
156+ }
157+ }
158+ }
159+ repositories {
160+ maven {
161+ def releasesRepoUrl = " https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
162+ def snapshotsRepoUrl = " https://s01.oss.sonatype.org/content/repositories/snapshots/"
163+ url = version. endsWith(" SNAPSHOT" ) ? snapshotsRepoUrl : releasesRepoUrl
164+ credentials {
165+ username System . getenv(" OSS_USERNAME" )
166+ password System . getenv(" OSS_PASSWORD" )
167+ }
168+ }
169+ if (! version. endsWith(" SNAPSHOT" )) {
170+ maven {
171+ name = " GitHubPackages"
172+ url = " https://maven.pkg.github.com/GoodforGod/$artifactRootId "
173+ credentials {
174+ username = System . getenv(" GITHUB_ACTOR" )
175+ password = System . getenv(" GITHUB_TOKEN" )
176+ }
177+ }
178+ }
179+ }
180+ }
181+
182+ java {
183+ withJavadocJar()
184+ withSourcesJar()
185+ }
186+
187+ if (project. hasProperty(" signingKey" )) {
188+ apply plugin : " signing"
189+ signing {
190+ def signingKey = findProperty(" signingKey" )
191+ def signingPassword = findProperty(" signingPassword" )
192+ useInMemoryPgpKeys(signingKey, signingPassword)
193+ sign publishing. publications. mavenJava
194+ }
195+ }
74196}
0 commit comments