1+ import me.qoomon.gitversioning.commons.GitRefType
12import java.util.*
23
34plugins {
45 `java- library`
56 `maven- publish`
67 jacoco
8+ id(" org.sonarqube" ) version " 4.4.1.3373"
79 id(" org.cadixdev.licenser" ) version " 0.6.1"
8- id(" com.github.gradle-git-version-calculator" ) version " 1.1.0"
9- id(" io.freefair.lombok" ) version " 8.3"
10- id(" io.freefair.javadoc-links" ) version " 8.3"
11- id(" io.freefair.javadoc-utf-8" ) version " 8.3"
12- id(" org.sonarqube" ) version " 4.0.0.2929"
10+ id(" me.qoomon.git-versioning" ) version " 6.4.3"
11+ id(" io.freefair.lombok" ) version " 8.4"
12+ id(" io.freefair.javadoc-links" ) version " 8.4"
13+ id(" io.freefair.javadoc-utf-8" ) version " 8.4"
14+ id(" io.freefair.maven-central.validate-poms" ) version " 8.4"
15+ id(" com.github.ben-manes.versions" ) version " 0.50.0"
16+ id(" ru.vyarus.pom" ) version " 2.2.2"
17+ id(" io.codearte.nexus-staging" ) version " 0.30.0"
1318}
1419
1520group = " io.github.1c-syntax"
16- version = gitVersionCalculator.calculateVersion(" v" )
21+ gitVersioning.apply {
22+ refs {
23+ considerTagsOnBranches = true
24+ tag(" v(?<tagVersion>[0-9].*)" ) {
25+ version = " \$ {ref.tagVersion}\$ {dirty}"
26+ }
27+ branch(" .+" ) {
28+ version = " \$ {ref}-\$ {commit.short}\$ {dirty}"
29+ }
30+ }
31+
32+ rev {
33+ version = " \$ {commit.short}\$ {dirty}"
34+ }
35+ }
36+ val isSnapshot = gitVersioning.gitVersionDetails.refType != GitRefType .TAG
1737
1838repositories {
1939 mavenLocal()
@@ -23,24 +43,24 @@ repositories {
2343
2444dependencies {
2545 // логирование
26- implementation(" org.slf4j" , " slf4j-api" , " 1.7.30 " )
46+ implementation(" org.slf4j" , " slf4j-api" , " 2.0.11 " )
2747
2848 // прочее
29- implementation(" commons-io" , " commons-io" , " 2.8.0 " )
30- api(" io.github.1c-syntax" , " bsl-common-library" , " 0.4 .0" )
49+ implementation(" commons-io" , " commons-io" , " 2.15.1 " )
50+ api(" io.github.1c-syntax" , " bsl-common-library" , " 0.5 .0" )
3151
3252 // тестирование
33- testImplementation(" org.junit.jupiter" , " junit-jupiter-api" , " 5.7.0 " )
34- testImplementation(" org.junit.jupiter" , " junit-jupiter-engine" , " 5.7.0 " )
35- testImplementation(" org.assertj" , " assertj-core" , " 3.18.1 " )
53+ testImplementation(" org.junit.jupiter" , " junit-jupiter-api" , " 5.10.1 " )
54+ testImplementation(" org.junit.jupiter" , " junit-jupiter-engine" , " 5.10.1 " )
55+ testImplementation(" org.assertj" , " assertj-core" , " 3.25.0 " )
3656 // логирование
3757 // https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12
38- testImplementation(" org.slf4j" , " slf4j-log4j12" , " 1.7.30 " )
58+ testImplementation(" org.slf4j" , " slf4j-log4j12" , " 2.0.11 " )
3959}
4060
4161java {
42- sourceCompatibility = JavaVersion .VERSION_11
43- targetCompatibility = JavaVersion .VERSION_11
62+ sourceCompatibility = JavaVersion .VERSION_17
63+ targetCompatibility = JavaVersion .VERSION_17
4464 withSourcesJar()
4565 withJavadocJar()
4666}
@@ -103,9 +123,29 @@ license {
103123}
104124
105125publishing {
126+ repositories {
127+ maven {
128+ name = " sonatype"
129+ url = if (isSnapshot)
130+ uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" )
131+ else
132+ uri(" https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" )
133+
134+ val sonatypeUsername: String? by project
135+ val sonatypePassword: String? by project
136+
137+ credentials {
138+ username = sonatypeUsername // ORG_GRADLE_PROJECT_sonatypeUsername
139+ password = sonatypePassword // ORG_GRADLE_PROJECT_sonatypePassword
140+ }
141+ }
142+ }
106143 publications {
107144 create<MavenPublication >(" maven" ) {
108145 from(components[" java" ])
146+ if (isSnapshot && project.hasProperty(" simplifyVersion" )) {
147+ version = findProperty(" git.ref.slug" ) as String + " -SNAPSHOT"
148+ }
109149 pom {
110150 description.set(" Support configuration read library for Language 1C (BSL)" )
111151 url.set(" https://github.com/1c-syntax/supportconf" )
@@ -155,3 +195,8 @@ tasks.withType<Javadoc> {
155195 (options as StandardJavadocDocletOptions )
156196 .addStringOption(" Xdoclint:none" , " -quiet" )
157197}
198+
199+ nexusStaging {
200+ serverUrl = " https://s01.oss.sonatype.org/service/local/"
201+ stagingProfileId = " 15bd88b4d17915" // ./gradlew getStagingProfile
202+ }
0 commit comments