1+ import me.qoomon.gitversioning.commons.GitRefType
12import java.util.*
23
34plugins {
@@ -6,9 +7,10 @@ plugins {
67 jacoco
78 `java- library`
89 antlr
10+ signing
911 id(" org.sonarqube" ) version " 4.4.1.3373"
1012 id(" org.cadixdev.licenser" ) version " 0.6.1"
11- id(" com.github.gradle- git-version-calculator " ) version " 1.1.0 "
13+ id(" me.qoomon. git-versioning " ) version " 6.4.3 "
1214 id(" io.freefair.javadoc-links" ) version " 8.4"
1315 id(" io.freefair.javadoc-utf-8" ) version " 8.4"
1416 id(" com.github.ben-manes.versions" ) version " 0.50.0"
@@ -22,7 +24,22 @@ repositories {
2224}
2325
2426group = " io.github.1c-syntax"
25- version = gitVersionCalculator.calculateVersion(" v" )
27+ gitVersioning.apply {
28+ refs {
29+ considerTagsOnBranches = true
30+ tag(" v(?<tagVersion>[0-9].*)" ) {
31+ version = " \$ {ref.tagVersion}\$ {dirty}"
32+ }
33+ branch(" .+" ) {
34+ version = " \$ {ref}-\$ {commit.short}\$ {dirty}"
35+ }
36+ }
37+
38+ rev {
39+ version = " \$ {commit.short}\$ {dirty}"
40+ }
41+ }
42+ val isSnapshot = gitVersioning.gitVersionDetails.refType != GitRefType .TAG
2643
2744val antlrVersion = " 4.9.0"
2845val antlrGroupId = " com.tunnelvisionlabs"
@@ -183,7 +200,33 @@ artifacts {
183200 archives(tasks[" javadocJar" ])
184201}
185202
203+ signing {
204+ val signingInMemoryKey: String? by project // env.ORG_GRADLE_PROJECT_signingInMemoryKey
205+ val signingInMemoryPassword: String? by project // env.ORG_GRADLE_PROJECT_signingInMemoryPassword
206+ if (signingInMemoryKey != null ) {
207+ useInMemoryPgpKeys(signingInMemoryKey, signingInMemoryPassword)
208+ sign(publishing.publications)
209+ }
210+ }
211+
186212publishing {
213+ repositories {
214+ maven {
215+ name = " sonatype"
216+ url = if (isSnapshot)
217+ uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" )
218+ else
219+ uri(" https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" )
220+
221+ val sonatypeUsername: String? by project
222+ val sonatypePassword: String? by project
223+
224+ credentials {
225+ username = sonatypeUsername // ORG_GRADLE_PROJECT_sonatypeUsername
226+ password = sonatypePassword // ORG_GRADLE_PROJECT_sonatypePassword
227+ }
228+ }
229+ }
187230 publications {
188231 create<MavenPublication >(" maven" ) {
189232 from(components[" java" ])
0 commit comments