-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
197 lines (174 loc) · 6.25 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import me.qoomon.gitversioning.commons.GitRefType
import java.util.Calendar
plugins {
`java-library`
`maven-publish`
jacoco
signing
id("org.cadixdev.licenser") version "0.6.1"
id("me.qoomon.git-versioning") version "6.4.4"
id("com.gorylenko.gradle-git-properties") version "2.4.2"
id("io.freefair.lombok") version "8.10"
id("io.freefair.javadoc-links") version "8.10"
id("io.freefair.javadoc-utf-8") version "8.10"
id("io.freefair.maven-central.validate-poms") version "8.10"
id("com.github.ben-manes.versions") version "0.51.0"
id("ru.vyarus.pom") version "3.0.0"
id("io.codearte.nexus-staging") version "0.30.0"
}
group = "io.github.1c-syntax"
gitVersioning.apply {
refs {
considerTagsOnBranches = true
tag("v(?<tagVersion>[0-9].*)") {
version = "\${ref.tagVersion}\${dirty}"
}
branch(".+") {
version = "\${ref}-\${commit.short}\${dirty}"
}
}
rev {
version = "\${commit.short}\${dirty}"
}
}
val isSnapshot = gitVersioning.gitVersionDetails.refType != GitRefType.TAG
repositories {
mavenCentral()
}
val junitVersion = "5.7.0"
dependencies {
compileOnly("com.github.spotbugs:spotbugs-annotations:4.8.6")
testImplementation("org.junit.jupiter", "junit-jupiter-api", junitVersion)
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", junitVersion)
testImplementation("org.assertj", "assertj-core", "3.18.1")
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-Xlint:deprecation")
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
reports {
html.required.set(true)
}
}
tasks.check {
dependsOn(tasks.jacocoTestReport)
}
tasks.jacocoTestReport {
reports {
xml.required.set(true)
xml.outputLocation.set(File("$buildDir/reports/jacoco/test/jacoco.xml"))
}
}
license {
header(rootProject.file("license/HEADER.txt"))
newLine(false)
ext["year"] = "2018-" + Calendar.getInstance().get(Calendar.YEAR)
ext["name"] = "Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]>"
ext["project"] = "1c-syntax utils"
exclude("**/*.properties")
exclude("**/*.xml")
exclude("**/*.json")
exclude("**/*.bsl")
}
tasks.javadoc {
options {
this as StandardJavadocDocletOptions
noComment(false)
}
}
artifacts {
archives(tasks["jar"])
archives(tasks["sourcesJar"])
archives(tasks["javadocJar"])
}
signing {
val signingInMemoryKey: String? by project // env.ORG_GRADLE_PROJECT_signingInMemoryKey
val signingInMemoryPassword: String? by project // env.ORG_GRADLE_PROJECT_signingInMemoryPassword
if (signingInMemoryKey != null) {
useInMemoryPgpKeys(signingInMemoryKey, signingInMemoryPassword)
sign(publishing.publications)
}
}
publishing {
repositories {
maven {
name = "sonatype"
url = if (isSnapshot)
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
else
uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val sonatypeUsername: String? by project
val sonatypePassword: String? by project
credentials {
username = sonatypeUsername // ORG_GRADLE_PROJECT_sonatypeUsername
password = sonatypePassword // ORG_GRADLE_PROJECT_sonatypePassword
}
}
}
publications {
create<MavenPublication>("maven") {
from(components["java"])
if (isSnapshot && project.hasProperty("simplifyVersion")) {
version = findProperty("git.ref.slug") as String + "-SNAPSHOT"
}
pom {
description.set("Common utils for 1c-syntax team java projects")
url.set("https://github.com/1c-syntax/utils")
licenses {
license {
name.set("GNU LGPL 3")
url.set("https://www.gnu.org/licenses/lgpl-3.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("asosnoviy")
name.set("Alexey Sosnoviy")
email.set("[email protected]")
url.set("https://github.com/asosnoviy")
organization.set("1c-syntax")
organizationUrl.set("https://github.com/1c-syntax")
}
developer {
id.set("nixel2007")
name.set("Nikita Fedkin")
email.set("[email protected]")
url.set("https://github.com/nixel2007")
organization.set("1c-syntax")
organizationUrl.set("https://github.com/1c-syntax")
}
developer {
id.set("theshadowco")
name.set("Valery Maximov")
email.set("[email protected]")
url.set("https://github.com/theshadowco")
organization.set("1c-syntax")
organizationUrl.set("https://github.com/1c-syntax")
}
}
scm {
connection.set("scm:git:git://github.com/1c-syntax/utils.git")
developerConnection.set("scm:git:[email protected]:1c-syntax/utils.git")
url.set("https://github.com/1c-syntax/utils")
}
}
}
}
}
nexusStaging {
serverUrl = "https://s01.oss.sonatype.org/service/local/"
stagingProfileId = "15bd88b4d17915" // ./gradlew getStagingProfile
}