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
4
2
import java.util.Calendar
5
3
6
4
plugins {
7
- java
8
- jacoco
9
- maven
5
+ `java- library`
10
6
`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"
14
16
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"
15
19
}
16
20
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
18
38
19
39
repositories {
20
40
mavenCentral()
21
41
}
22
42
23
- val junitVersion = " 5.6 .0"
43
+ val junitVersion = " 5.7 .0"
24
44
25
45
dependencies {
26
-
27
- compileOnly(" org.projectlombok" , " lombok" , lombok.version)
28
-
46
+ compileOnly(" com.github.spotbugs:spotbugs-annotations:4.8.3" )
29
47
testImplementation(" org.junit.jupiter" , " junit-jupiter-api" , junitVersion)
30
48
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" )
33
50
}
34
51
35
52
java {
36
- sourceCompatibility = JavaVersion .VERSION_11
37
- targetCompatibility = JavaVersion .VERSION_11
53
+ sourceCompatibility = JavaVersion .VERSION_17
54
+ targetCompatibility = JavaVersion .VERSION_17
38
55
withSourcesJar()
56
+ withJavadocJar()
39
57
}
40
58
41
59
tasks.withType<JavaCompile > {
@@ -52,51 +70,128 @@ tasks.test {
52
70
}
53
71
54
72
reports {
55
- html.isEnabled = true
73
+ html.required.set( true )
56
74
}
57
75
}
58
76
59
-
60
77
tasks.check {
61
78
dependsOn(tasks.jacocoTestReport)
62
79
}
63
80
64
81
tasks.jacocoTestReport {
65
82
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" ) )
68
85
}
69
86
}
70
87
71
88
license {
72
- header = rootProject.file(" license/HEADER.txt" )
89
+ header(rootProject.file(" license/HEADER.txt" ))
90
+ newLine(false )
73
91
ext[" year" ] = " 2018-" + Calendar .getInstance().get(Calendar .YEAR )
74
92
ext[" name" ] = " Alexey Sosnoviy <labotamy@gmail.com>, Nikita Fedkin <nixel2007@gmail.com>"
75
93
ext[" project" ] = " 1c-syntax utils"
76
- strictCheck = true
77
- mapping(" java" , " SLASHSTAR_STYLE" )
78
94
exclude(" **/*.properties" )
79
95
exclude(" **/*.xml" )
80
96
exclude(" **/*.json" )
81
97
exclude(" **/*.bsl" )
82
98
}
83
99
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