1- import me.qoomon.gradle.gitversioning.GitVersioningPluginConfig
2- import me.qoomon.gradle.gitversioning.GitVersioningPluginConfig.CommitVersionDescription
3- import me.qoomon.gradle.gitversioning.GitVersioningPluginConfig.VersionDescription
1+ import me.qoomon.gitversioning.commons.GitRefType
42import java.util.Calendar
53
64plugins {
7- java
8- jacoco
9- maven
5+ `java- library`
106 `maven- publish`
11- id(" com.github.hierynomus.license" ) version " 0.15.0"
12- id(" io.franzbecker.gradle-lombok" ) version " 3.2.0"
13- id(" me.qoomon.git-versioning" ) version " 2.1.1"
7+ jacoco
8+ signing
9+ id(" org.cadixdev.licenser" ) version " 0.6.1"
10+ id(" me.qoomon.git-versioning" ) version " 6.4.3"
11+ id(" com.gorylenko.gradle-git-properties" ) version " 2.4.1"
12+ id(" io.freefair.lombok" ) version " 8.6"
13+ id(" io.freefair.javadoc-links" ) version " 8.6"
14+ id(" io.freefair.javadoc-utf-8" ) version " 8.6"
15+ id(" io.freefair.maven-central.validate-poms" ) version " 8.6"
1416 id(" com.github.ben-manes.versions" ) version " 0.27.0"
17+ id(" ru.vyarus.pom" ) version " 3.0.0"
18+ id(" io.codearte.nexus-staging" ) version " 0.30.0"
1519}
1620
17- group = " com.github.1c-syntax"
21+ group = " io.github.1c-syntax"
22+ gitVersioning.apply {
23+ refs {
24+ considerTagsOnBranches = true
25+ tag(" v(?<tagVersion>[0-9].*)" ) {
26+ version = " \$ {ref.tagVersion}\$ {dirty}"
27+ }
28+ branch(" .+" ) {
29+ version = " \$ {ref}-\$ {commit.short}\$ {dirty}"
30+ }
31+ }
32+
33+ rev {
34+ version = " \$ {commit.short}\$ {dirty}"
35+ }
36+ }
37+ val isSnapshot = gitVersioning.gitVersionDetails.refType != GitRefType .TAG
1838
1939repositories {
2040 mavenCentral()
2141}
2242
23- val junitVersion = " 5.6 .0"
43+ val junitVersion = " 5.7 .0"
2444
2545dependencies {
26-
27- compileOnly(" org.projectlombok" , " lombok" , lombok.version)
28-
46+ compileOnly(" com.github.spotbugs:spotbugs-annotations:4.8.3" )
2947 testImplementation(" org.junit.jupiter" , " junit-jupiter-api" , junitVersion)
3048 testRuntimeOnly(" org.junit.jupiter" , " junit-jupiter-engine" , junitVersion)
31-
32- testImplementation(" org.assertj" , " assertj-core" , " 3.14.0" )
49+ testImplementation(" org.assertj" , " assertj-core" , " 3.18.1" )
3350}
3451
3552java {
36- sourceCompatibility = JavaVersion .VERSION_11
37- targetCompatibility = JavaVersion .VERSION_11
53+ sourceCompatibility = JavaVersion .VERSION_17
54+ targetCompatibility = JavaVersion .VERSION_17
3855 withSourcesJar()
56+ withJavadocJar()
3957}
4058
4159tasks.withType<JavaCompile > {
@@ -52,51 +70,128 @@ tasks.test {
5270 }
5371
5472 reports {
55- html.isEnabled = true
73+ html.required.set( true )
5674 }
5775}
5876
59-
6077tasks.check {
6178 dependsOn(tasks.jacocoTestReport)
6279}
6380
6481tasks.jacocoTestReport {
6582 reports {
66- xml.isEnabled = true
67- xml.destination = File (" $buildDir /reports/jacoco/test/jacoco.xml" )
83+ xml.required.set( true )
84+ xml.outputLocation.set( File (" $buildDir /reports/jacoco/test/jacoco.xml" ) )
6885 }
6986}
7087
7188license {
72- header = rootProject.file(" license/HEADER.txt" )
89+ header(rootProject.file(" license/HEADER.txt" ))
90+ newLine(false )
7391 ext[" year" ] = " 2018-" + Calendar .getInstance().get(Calendar .YEAR )
7492 ext[" name" ] = " Alexey Sosnoviy <labotamy@gmail.com>, Nikita Fedkin <nixel2007@gmail.com>"
7593 ext[" project" ] = " 1c-syntax utils"
76- strictCheck = true
77- mapping(" java" , " SLASHSTAR_STYLE" )
7894 exclude(" **/*.properties" )
7995 exclude(" **/*.xml" )
8096 exclude(" **/*.json" )
8197 exclude(" **/*.bsl" )
8298}
8399
84- gitVersioning.apply (closureOf<GitVersioningPluginConfig > {
85- preferTags = true
86- branch(closureOf<VersionDescription > {
87- pattern = " ^(?!v[0-9]+).*"
88- versionFormat = " \$ {branch}-\$ {commit.short}\$ {dirty}"
89- })
90- tag(closureOf<VersionDescription >{
91- pattern = " v(?<tagVersion>[0-9].*)"
92- versionFormat = " \$ {tagVersion}\$ {dirty}"
93- })
94- commit(closureOf<CommitVersionDescription >{
95- versionFormat = " \$ {commit.short}\$ {dirty}"
96- })
97- })
98-
99- lombok {
100- version = " 1.18.10"
101- sha256 = " 2836e954823bfcbad45e78c18896e3d01058e6f643749810c608b7005ee7b2fa"
102- }
100+ tasks.javadoc {
101+ options {
102+ this as StandardJavadocDocletOptions
103+ noComment(false )
104+ }
105+ }
106+
107+ artifacts {
108+ archives(tasks[" jar" ])
109+ archives(tasks[" sourcesJar" ])
110+ archives(tasks[" javadocJar" ])
111+ }
112+
113+ signing {
114+ val signingInMemoryKey: String? by project // env.ORG_GRADLE_PROJECT_signingInMemoryKey
115+ val signingInMemoryPassword: String? by project // env.ORG_GRADLE_PROJECT_signingInMemoryPassword
116+ if (signingInMemoryKey != null ) {
117+ useInMemoryPgpKeys(signingInMemoryKey, signingInMemoryPassword)
118+ sign(publishing.publications)
119+ }
120+ }
121+
122+ publishing {
123+ repositories {
124+ maven {
125+ name = " sonatype"
126+ url = if (isSnapshot)
127+ uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" )
128+ else
129+ uri(" https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" )
130+
131+ val sonatypeUsername: String? by project
132+ val sonatypePassword: String? by project
133+
134+ credentials {
135+ username = sonatypeUsername // ORG_GRADLE_PROJECT_sonatypeUsername
136+ password = sonatypePassword // ORG_GRADLE_PROJECT_sonatypePassword
137+ }
138+ }
139+ }
140+ publications {
141+ create<MavenPublication >(" maven" ) {
142+ from(components[" java" ])
143+
144+ if (isSnapshot && project.hasProperty(" simplifyVersion" )) {
145+ version = findProperty(" git.ref.slug" ) as String + " -SNAPSHOT"
146+ }
147+
148+ pom {
149+ description.set(" Common utils for 1c-syntax team java projects" )
150+ url.set(" https://github.com/1c-syntax/utils" )
151+ licenses {
152+ license {
153+ name.set(" GNU LGPL 3" )
154+ url.set(" https://www.gnu.org/licenses/lgpl-3.0.txt" )
155+ distribution.set(" repo" )
156+ }
157+ }
158+ developers {
159+ developer {
160+ id.set(" asosnoviy" )
161+ name.set(" Alexey Sosnoviy" )
162+ email.set(" labotamy@gmail.com" )
163+ url.set(" https://github.com/asosnoviy" )
164+ organization.set(" 1c-syntax" )
165+ organizationUrl.set(" https://github.com/1c-syntax" )
166+ }
167+ developer {
168+ id.set(" nixel2007" )
169+ name.set(" Nikita Fedkin" )
170+ email.set(" nixel2007@gmail.com" )
171+ url.set(" https://github.com/nixel2007" )
172+ organization.set(" 1c-syntax" )
173+ organizationUrl.set(" https://github.com/1c-syntax" )
174+ }
175+ developer {
176+ id.set(" theshadowco" )
177+ name.set(" Valery Maximov" )
178+ email.set(" maximovvalery@gmail.com" )
179+ url.set(" https://github.com/theshadowco" )
180+ organization.set(" 1c-syntax" )
181+ organizationUrl.set(" https://github.com/1c-syntax" )
182+ }
183+ }
184+ scm {
185+ connection.set(" scm:git:git://github.com/1c-syntax/utils.git" )
186+ developerConnection.set(" scm:git:git@github.com:1c-syntax/utils.git" )
187+ url.set(" https://github.com/1c-syntax/utils" )
188+ }
189+ }
190+ }
191+ }
192+ }
193+
194+ nexusStaging {
195+ serverUrl = " https://s01.oss.sonatype.org/service/local/"
196+ stagingProfileId = " 15bd88b4d17915" // ./gradlew getStagingProfile
197+ }
0 commit comments