1- import me.qoomon.gitversioning.commons.GitRefType
2- import java.util .*
1+ import java.util.Calendar
2+ import org.jreleaser.model.Active .*
33
44plugins {
55 `java- library`
66 `maven- publish`
77 jacoco
8- signing
98 id(" org.cadixdev.licenser" ) version " 0.6.1"
109 id(" me.qoomon.git-versioning" ) version " 6.4.4"
11- id(" com.gorylenko.gradle-git-properties " ) version " 2.4 .2"
12- id(" io.freefair.lombok " ) version " 8.12.1 "
13- id(" io.freefair.javadoc-links " ) version " 8.12.1 "
14- id(" io.freefair.javadoc-utf-8 " ) version " 8.12.1 "
15- id(" io.freefair.maven-central.validate-poms " ) version " 8.12.1 "
10+ id(" io.freefair.lombok " ) version " 8.14 .2"
11+ id(" io.freefair.javadoc-links " ) version " 8.14.2 "
12+ id(" io.freefair.javadoc-utf-8 " ) version " 8.14.2 "
13+ id(" io.freefair.maven-central.validate-poms " ) version " 8.14.2 "
14+ id(" com.github.ben-manes.versions " ) version " 0.52.0 "
1615 id(" ru.vyarus.pom" ) version " 3.0.0"
17- id(" org.sonarqube " ) version " 6.0.1.5171 "
18- id(" io.codearte.nexus-staging " ) version " 0.30.0 "
16+ id(" org.jreleaser " ) version " 1.19.0 "
17+ id(" org.sonarqube " ) version " 6.2.0.5505 "
1918}
2019
2120group = " io.github.1c-syntax"
2221gitVersioning.apply {
2322 refs {
24- considerTagsOnBranches = true
23+ describeTagFirstParent = false
2524 tag(" v(?<tagVersion>[0-9].*)" ) {
2625 version = " \$ {ref.tagVersion}\$ {dirty}"
2726 }
27+
28+ branch(" develop" ) {
29+ version = " \$ {describe.tag.version.major}." +
30+ " \$ {describe.tag.version.minor.next}.0." +
31+ " \$ {describe.distance}-SNAPSHOT\$ {dirty}"
32+ }
33+
2834 branch(" .+" ) {
2935 version = " \$ {ref}-\$ {commit.short}\$ {dirty}"
3036 }
@@ -34,12 +40,10 @@ gitVersioning.apply {
3440 version = " \$ {commit.short}\$ {dirty}"
3541 }
3642}
37- val isSnapshot = gitVersioning.gitVersionDetails.refType != GitRefType .TAG
3843
3944repositories {
4045 mavenLocal()
4146 mavenCentral()
42- maven(url = " https://s01.oss.sonatype.org/content/repositories/snapshots/" )
4347}
4448
4549dependencies {
@@ -53,9 +57,9 @@ dependencies {
5357
5458 // прочее
5559 implementation(" commons-io" , " commons-io" , " 2.18.0" )
56- implementation(" io.github.1c-syntax" , " utils" , " 0.6.2 " )
57- implementation(" io.github.1c-syntax" , " bsl-common-library" , " 0.8.0 " )
58- implementation(" io.github.1c-syntax" , " supportconf" , " 0.14.2 " )
60+ implementation(" io.github.1c-syntax" , " utils" , " 0.6.3 " )
61+ implementation(" io.github.1c-syntax" , " bsl-common-library" , " 0.8.1 " )
62+ implementation(" io.github.1c-syntax" , " supportconf" , " 0.14.3 " )
5963
6064 // быстрый поиск классов
6165 implementation(" io.github.classgraph" , " classgraph" , " 4.8.179" )
@@ -105,7 +109,7 @@ tasks.check {
105109tasks.jacocoTestReport {
106110 reports {
107111 xml.required.set(true )
108- xml.outputLocation.set(File ( " $buildDir / reports/jacoco/test/jacoco.xml" ))
112+ xml.outputLocation.set(layout.buildDirectory.file( " reports/jacoco/test/jacoco.xml" ))
109113 }
110114}
111115
@@ -134,7 +138,7 @@ sonar {
134138 property(" sonar.projectKey" , " 1c-syntax_mdclasses" )
135139 property(" sonar.projectName" , " MDClasses" )
136140 property(" sonar.exclusions" , " **/resources/**/*.*" )
137- property(" sonar.coverage.jacoco.xmlReportPaths" , " $buildDir /reports/jacoco/test/jacoco.xml" )
141+ property(" sonar.coverage.jacoco.xmlReportPaths" , " ${layout.buildDirectory.get()} /reports/jacoco/test/jacoco.xml" )
138142 }
139143}
140144
@@ -161,41 +165,18 @@ license {
161165 exclude(" **/*.orig" )
162166}
163167
164- signing {
165- val signingInMemoryKey: String? by project // env.ORG_GRADLE_PROJECT_signingInMemoryKey
166- val signingInMemoryPassword: String? by project // env.ORG_GRADLE_PROJECT_signingInMemoryPassword
167- if (signingInMemoryKey != null ) {
168- useInMemoryPgpKeys(signingInMemoryKey, signingInMemoryPassword)
169- sign(publishing.publications)
170- }
171- }
172168
173169publishing {
174170 repositories {
175171 maven {
176- name = " sonatype"
177- url = if (isSnapshot)
178- uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" )
179- else
180- uri(" https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" )
181-
182- val sonatypeUsername: String? by project
183- val sonatypePassword: String? by project
184-
185- credentials {
186- username = sonatypeUsername // ORG_GRADLE_PROJECT_sonatypeUsername
187- password = sonatypePassword // ORG_GRADLE_PROJECT_sonatypePassword
188- }
172+ name = " staging"
173+ url = layout.buildDirectory.dir(" staging-deploy" ).get().asFile.toURI()
189174 }
190175 }
191176 publications {
192177 create<MavenPublication >(" maven" ) {
193178 from(components[" java" ])
194179
195- if (isSnapshot && project.hasProperty(" simplifyVersion" )) {
196- version = findProperty(" git.ref.slug" ) as String + " -SNAPSHOT"
197- }
198-
199180 pom {
200181 description.set(" Metadata read/write library for Language 1C (BSL)" )
201182 url.set(" https://github.com/1c-syntax/mdclasses" )
@@ -229,19 +210,53 @@ publishing {
229210 developerConnection.set(
" scm:git:[email protected] :1c-syntax/mdclasses.git" )
230211 url.set(" https://github.com/1c-syntax/mdclasses" )
231212 }
213+ // Добавлено для Maven Central validation
214+ issueManagement {
215+ system.set(" GitHub Issues" )
216+ url.set(" https://github.com/1c-syntax/mdclasses/issues" )
217+ }
218+ // Добавлено для Maven Central validation
219+ ciManagement {
220+ system.set(" GitHub Actions" )
221+ url.set(" https://github.com/1c-syntax/mdclasses/actions" )
222+ }
232223 }
233224 }
234225 }
235226}
236227
237- nexusStaging {
238- serverUrl = " https://s01.oss.sonatype.org/service/local/"
239- stagingProfileId = " 15bd88b4d17915" // ./gradlew getStagingProfile
240- }
241-
242228tasks.register(" precommit" ) {
243229 description = " Run all precommit tasks"
244230 group = " Developer tools"
245231 dependsOn(" :test" )
246232 dependsOn(" :updateLicenses" )
247233}
234+
235+ jreleaser {
236+ signing {
237+ active = ALWAYS
238+ armored = true
239+ }
240+ deploy {
241+ maven {
242+ mavenCentral {
243+ create(" release-deploy" ) {
244+ active = RELEASE
245+ url = " https://central.sonatype.com/api/v1/publisher"
246+ stagingRepository(" build/staging-deploy" )
247+ }
248+ }
249+ nexus2 {
250+ create(" snapshot-deploy" ) {
251+ active = SNAPSHOT
252+ snapshotUrl = " https://central.sonatype.com/repository/maven-snapshots/"
253+ applyMavenCentralRules = true
254+ snapshotSupported = true
255+ closeRepository = true
256+ releaseRepository = true
257+ stagingRepository(" build/staging-deploy" )
258+ }
259+ }
260+ }
261+ }
262+ }
0 commit comments