forked from webauthn4j/webauthn4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
285 lines (242 loc) · 8.89 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
/*
* Copyright 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
def springBootVersion = "2.2.6.RELEASE"
def sonarqubeVersion = "2.8.0.1969"
def asciidoctorGradleVersion="1.6.1"
def artifactoryVersion="4.15.1"
def bintrayVersion = "1.8.4"
def owaspDependencyCheckVersion = "5.3.0"
def httpBuilderVersion = "0.7.2"
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:$sonarqubeVersion")
classpath("org.asciidoctor:asciidoctor-gradle-plugin:$asciidoctorGradleVersion")
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:$artifactoryVersion")
classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintrayVersion")
classpath("org.owasp:dependency-check-gradle:$owaspDependencyCheckVersion")
classpath("org.codehaus.groovy.modules.http-builder:http-builder:$httpBuilderVersion")
}
}
apply plugin: 'java'
apply plugin: 'org.sonarqube'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'org.asciidoctor.convert'
apply plugin: 'org.owasp.dependencycheck'
allprojects {
group 'com.webauthn4j'
version "$webAuthn4JVersion"
dependencyCheck {
failBuildOnCVSS = project.hasProperty("failBuildOnCVSS") ? project.property("failBuildOnCVSS").toInteger() : 11 // Never fail with this value. CI build argument updates this property for blocking vulnerable release.
suppressionFile = "$rootDir/owasp/suppression.xml"
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: 'com.jfrog.bintray'
apply plugin: "maven-publish"
apply plugin: "com.jfrog.artifactory"
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
def springBootVersion = "2.1.12.RELEASE"
def jacksonBomVersion = "2.10.3"
def bouncyCastleVersion = "1.64"
def kerbyVersion = "2.0.0"
dependencyManagement {
dependencies {
dependency("org.apache.kerby:kerby-asn1:$kerbyVersion")
dependency("org.bouncycastle:bcprov-jdk15on:$bouncyCastleVersion")
dependency("org.bouncycastle:bcpkix-jdk15on:$bouncyCastleVersion")
}
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
// Import Jackson Bom independently as Spring Boot Bom 2.2.x does not depend Jackson 2.10.x series
mavenBom "com.fasterxml.jackson:jackson-bom:${jacksonBomVersion}"
}
}
javadoc {
options.charSet = 'UTF-8'
options.encoding = 'UTF-8'
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror" << "-Xlint:deprecation"
}
check.dependsOn dependencyCheckAnalyze
artifacts {
archives sourcesJar
archives javadocJar
}
jacocoTestReport {
reports {
xml.enabled true
}
}
apply from: "../helper.gradle"
def githubUrl = "https://github.com/webauthn4j/webauthn4j"
publishing {
publications {
standard(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = project.name
description = project.description
url = githubUrl
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'ynojima'
name = 'Yoshikazu Nojima'
email = '[email protected]'
}
}
scm {
url = githubUrl
}
resolveStrategy = DELEGATE_FIRST
}
}
}
}
def bintrayUser = getVariable('BINTRAY_USER', 'bintrayUser')
def bintrayToken = getVariable('BINTRAY_TOKEN', 'bintrayToken')
def artifactoryUser = getVariable('ARTIFACTORY_USER', 'artifactoryUser')
def artifactoryPassword = getVariable('ARTIFACTORY_PASSWORD', 'artifactoryPassword')
def mavenCentralUser = getVariable('MAVEN_CENTRAL_USER', 'mavenCentralUser')
def mavenCentralPassword = getVariable('MAVEN_CENTRAL_PASSWORD', 'mavenCentralPassword')
task bintrayGpgSign(){
group = "publishing"
doLast{
signArtifactsOnBintray(bintrayUser, bintrayToken);
}
}
task bintrayMavenCentralSync(){
group = "publishing"
doLast{
syncMavenCentralToBintray(bintrayUser, bintrayToken);
}
}
artifactory {
contextUrl = 'http://oss.jfrog.org/artifactory/simple/'
publish {
repository {
repoKey = 'oss-snapshot-local' // The Artifactory repository key to publish to
username = artifactoryUser
password = artifactoryPassword
}
defaults {
publications('standard')
}
}
}
artifactoryPublish {
skip = !"${webAuthn4JVersion}".endsWith("-SNAPSHOT") // Publish only when it is SNAPSHOT release
}
bintray {
user = bintrayUser
key = bintrayToken
configurations = ['archives']
publish = true
dryRun = !("${webAuthn4JVersion}".endsWith(".RELEASE")) // Publish only when it is RELEASE release
publications = ['standard']
pkg {
userOrg = "webauthn4j"
repo = "webauthn4j"
name = project.name
desc = project.description
licenses = ['Apache-2.0']
vcsUrl = githubUrl
version {
name = "${webAuthn4JVersion}"
released = new Date()
vcsTag = "${webAuthn4JVersion}"
gpg {
sign = true
}
//Optional configuration for Maven Central sync of the version
mavenCentralSync {
user = mavenCentralUser
password = mavenCentralPassword
}
}
}
}
}
check.dependsOn dependencyCheckAggregate
task updateVersionsInDocuments() {
group = "documentation"
String regex = "<webauthn4j\\.version>.*</webauthn4j\\.version>";
String replacement = "<webauthn4j\\.version>" + latestReleasedWebAuthn4JVersion + "</webauthn4j.version>";
def files = [file('README.md'), file('docs/src/reference/asciidoc/en/introduction.adoc'), file('docs/src/reference/asciidoc/ja/introduction.adoc')]
files.each { file ->
String updated = file.getText('UTF-8').replaceFirst(regex, replacement)
file.setText(updated, 'UTF-8')
}
}
task generateReleaseNote(type: JavaExec) {
group = "documentation"
classpath = files('gradle/lib/github-release-notes-generator.jar')
args(latestReleasedWebAuthn4JVersion, file("build/release-note.md").absolutePath, "--spring.config.location=file:" + file("github-release-notes-generator.yml").absolutePath)
}
asciidoctorj {
version = "1.6.2"
}
asciidoctor {
sourceDir = file("docs/src/reference/asciidoc")
// backends = ['docbook5']
resources {
from(sourceDir) {
include '*/images/**'
}
}
options eruby: 'erubis'
//noinspection GroovyAssignabilityCheck
attributes docinfo: '',
copycss: '',
icons: 'font',
'source-highlighter': 'prettify',
sectanchors: '',
toc2: '',
idprefix: '',
idseparator: '-',
doctype: 'book',
numbered: '',
revnumber: "${webAuthn4JVersion}"
}