-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
212 lines (188 loc) · 6.62 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
212 lines (188 loc) · 6.62 KB
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
import me.qoomon.gitversioning.commons.GitRefType
import java.util.*
plugins {
`java-library`
`maven-publish`
jacoco
signing
id("org.sonarqube") version "6.0.1.5171"
id("org.cadixdev.licenser") version "0.6.1"
id("me.qoomon.git-versioning") version "6.4.4"
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 {
mavenLocal()
mavenCentral()
maven(url = "https://jitpack.io")
}
dependencies {
// логирование
implementation("org.slf4j", "slf4j-api", "2.0.11")
// прочее
implementation("commons-io", "commons-io", "2.15.1")
api("io.github.1c-syntax", "bsl-common-library", "0.5.0")
// тестирование
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.10.1")
testImplementation("org.junit.jupiter", "junit-jupiter-engine", "5.10.1")
testImplementation("org.assertj", "assertj-core", "3.25.0")
// логирование
// https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12
testImplementation("org.slf4j", "slf4j-log4j12", "2.0.11")
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed", "standard_error")
}
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"))
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-parameters")
}
sonarqube {
properties {
property("sonar.sourceEncoding", "UTF-8")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.organization", "1c-syntax")
property("sonar.projectKey", "1c-syntax_supportconf")
property("sonar.projectName", "Support Configuration")
property("sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/test/jacoco.xml")
}
}
artifacts {
archives(tasks["jar"])
archives(tasks["sourcesJar"])
archives(tasks["javadocJar"])
}
license {
header(rootProject.file("license/HEADER.txt"))
newLine(false)
ext["year"] = "2019 - " + Calendar.getInstance().get(Calendar.YEAR)
ext["name"] = "Tymko Oleg <olegtymko@yandex.ru>, Maximov Valery <maximovvalery@gmail.com>"
ext["project"] = "Support Configuration"
exclude("**/*.properties")
exclude("**/*.orig")
exclude("**/*.xml")
}
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("Support configuration read library for Language 1C (BSL)")
url.set("https://github.com/1c-syntax/supportconf")
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("otymko")
name.set("Oleg Tymko")
email.set("olegtymko@yandex.ru")
url.set("https://github.com/otymko")
organization.set("1c-syntax")
organizationUrl.set("https://github.com/1c-syntax")
}
developer {
id.set("theshadowco")
name.set("Valery Maximov")
email.set("maximovvalery@gmail.com")
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/supportconf.git")
developerConnection.set("scm:git:git@github.com:1c-syntax/supportconf.git")
url.set("https://github.com/1c-syntax/supportconf")
}
}
}
}
}
tasks.register("precommit") {
description = "Run all precommit tasks"
group = "Developer tools"
dependsOn(":test")
dependsOn(":updateLicenses")
}
tasks.withType<Javadoc> {
(options as StandardJavadocDocletOptions)
.addStringOption("Xdoclint:none", "-quiet")
}
nexusStaging {
serverUrl = "https://s01.oss.sonatype.org/service/local/"
stagingProfileId = "15bd88b4d17915" // ./gradlew getStagingProfile
}