-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
190 lines (167 loc) · 5.41 KB
/
build.gradle
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
import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.render.JsonReportRenderer
plugins {
id 'java-platform'
id 'maven-publish'
alias(libs.plugins.publish.plugin)
id 'signing'
alias(libs.plugins.dependencycheck)
alias(libs.plugins.gradle.git.properties)
alias(libs.plugins.dependency.license.report)
alias(libs.plugins.download)
}
group = 'com.exactpro.th2'
version = release_version
dependencyLocking {
lockAllConfigurations()
}
repositories {
mavenCentral()
}
javaPlatform {
allowDependencies()
}
dependencyCheck {
formats = ['SARIF', 'JSON', 'HTML']
failBuildOnCVSS = 5
nvd {
apiKey = project.findProperty("nvdApiKey") as String
delay = Integer.valueOf(project.findProperty("nvdDelay") as String)
}
analyzers {
assemblyEnabled = false
nugetconfEnabled = false
nodeEnabled = false
}
}
dependencies {
api platform(libs.kotlin.bom)
api platform(libs.grpc.bom)
api platform(libs.jackson.bom)
api platform(libs.java.driver.bom)
api platform(libs.netty.bom)
api platform(libs.log4j.bom)
api platform(libs.slf4j.bom)
constraints {
// Libraries
api(libs.amqp.client)
api(libs.annotations)
api(libs.commons.text)
api(libs.commons.lang3)
api(libs.commons.io)
api(libs.commons.cli)
api(libs.commons.collections4)
api(libs.guava)
api(libs.protobuf.java.util)
api(libs.protoc)
api("org.slf4j:slf4j-api")
// Prometheus FIXME: remove when we have a facade in common
api(libs.simpleclient)
api(libs.simpleclient.hotspot)
api(libs.simpleclient.httpserver)
api(libs.simpleclient.log4j2)
api(libs.simpleclient.log4j)
}
}
// conditionals for publications
tasks.withType(PublishToMavenRepository).configureEach {
onlyIf {
(repository == publishing.repositories.nexusRepository &&
project.hasProperty('nexus_user') &&
project.hasProperty('nexus_password') &&
project.hasProperty('nexus_url')) ||
(repository == publishing.repositories.sonatype &&
project.hasProperty('sonatypeUsername') &&
project.hasProperty('sonatypePassword'))
}
}
tasks.withType(Sign).configureEach {
onlyIf {
project.hasProperty('signingKey') &&
project.hasProperty('signingPassword')
}
}
// disable running task 'initializeSonatypeStagingRepository' on a gitlab
tasks.configureEach { task ->
if (task.name == 'initializeSonatypeStagingRepository' &&
!(project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword'))
) {
task.enabled = false
}
}
publishing {
publishing {
publications {
th2Platform(MavenPublication) {
from components.javaPlatform
pom {
name = rootProject.name
description = rootProject.description
url = vcs_url
scm {
url = vcs_url
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'developer'
name = 'developer'
email = '[email protected]'
}
}
scm {
url = vcs_url
}
}
}
}
}
repositories {
//Nexus repo to publish from gitlab
maven {
name = 'nexusRepository'
credentials {
username = project.findProperty('nexus_user')
password = project.findProperty('nexus_password')
}
url = project.findProperty('nexus_url')
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
signing {
String signingKey = findProperty("signingKey")
String signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.th2Platform
}
licenseReport {
def licenseNormalizerBundlePath = "$buildDir/license-normalizer-bundle.json"
if (!file(licenseNormalizerBundlePath).exists()) {
download.run {
src 'https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/license-normalizer-bundle.json'
dest "$buildDir/license-normalizer-bundle.json"
overwrite false
}
}
filters = [
new LicenseBundleNormalizer(licenseNormalizerBundlePath, false)
]
renderers = [
new JsonReportRenderer('licenses.json', false),
]
excludeOwnGroup = false
allowedLicensesFile = new URL("https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/allowed-licenses.json")
}