This repository was archived by the owner on Jun 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
193 lines (164 loc) · 5.68 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
plugins {
id 'java-library'
id 'checkstyle'
id 'jacoco'
id "com.github.spotbugs" version "5.0.6"
id 'maven-publish'
id 'signing'
id "io.codearte.nexus-staging" version "0.30.0" // logs into Sonotype OSS and does a "Close" and "Release"
id 'com.adarshr.test-logger' version '3.2.0'
id "com.github.ben-manes.versions" version "0.42.0"
id 'org.sonatype.gradle.plugins.scan' version '2.3.0'
id "org.sonarqube" version "3.3"
}
group = 'com.imsweb'
version = '1.9.9'
description = 'TNM algorithm for the java-staging-client'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:all" << "-Xlint:-serial" << "-Werror"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
repositories {
mavenCentral()
}
dependencies {
spotbugs 'com.github.spotbugs:spotbugs:4.6.0'
api 'com.imsweb:staging-client-java:6.3.0'
testImplementation 'org.slf4j:slf4j-api:1.7.36'
testImplementation 'org.slf4j:slf4j-simple:1.7.36'
testImplementation 'junit:junit:4.13.2'
testImplementation 'com.squareup.retrofit2:retrofit:2.9.0'
testImplementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
}
jar {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': archiveVersion,
'Implementation-Vendor': group,
'Created-By': System.properties['java.vm.version'] + ' (' + System.properties['java.vm.vendor'] + ')',
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Automatic-Module-Name': 'com.imsweb.staging.tnm'
)
}
}
// Nexus vulnerability scan (https://github.com/sonatype-nexus-community/scan-gradle-plugin)
ossIndexAudit {
printBanner = false
}
checkstyle {
toolVersion = '8.29'
configFile = file('config/checkstyle/checkstyle.xml')
}
spotbugs {
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
}
jacocoTestReport {
reports {
xml.enabled true
}
}
test.finalizedBy jacocoTestReport
sonarqube {
properties {
property "sonar.projectKey", "imsweb_staging-algorithm-tnm"
property "sonar.organization", "imsweb"
property "sonar.host.url", "https://sonarcloud.io"
}
}
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { qualifier -> version.toUpperCase().contains(qualifier) }
def regex = /^[0-9,.v-]+$/
return !stableKeyword && !(version ==~ regex)
}
dependencyUpdates {
// ignore alpha, beta, etc. versions
rejectVersionIf { selection ->
isNonStable(selection.candidate.version)
}
}
// don't try to release a snapshot to a non-snapshot repository, that won't work anyway
if (version.endsWith('-SNAPSHOT')) {
gradle.startParameter.excludedTaskNames += 'signMavenJavaPublication'
gradle.startParameter.excludedTaskNames += 'closeAndReleaseRepository'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'staging-algorithm-tnm'
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'TNM Staging Algorithm'
description = 'TNM algorithm for the staging-client-java'
url = 'https://github.com/imsweb/staging-algorithm-tnm'
inceptionYear = '2015'
licenses {
license {
name = 'A modified BSD License (BSD)'
url = 'https://github.com/imsweb/staging-algorithm-tnm/blob/master/LICENSE'
distribution = 'repo'
}
}
developers {
developer {
id = 'ctmay4'
name = 'Chuck May'
email = 'mayc@imsweb.com'
}
}
scm {
url = 'https://github.com/imsweb/staging-algorithm-tnm'
connection = 'scm:https://github.com/imsweb/staging-algorithm-tnm.git'
developerConnection = 'scm:git@github.com:imsweb/staging-algorithm-tnm.git'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = project.findProperty('nexusUsername') ?: ''
password = project.findProperty('nexusPassword') ?: ''
}
}
}
}
signing {
def signingKey = project.findProperty('signingKey') ?: ''
def signingPassword = project.findProperty('signingPassword') ?: ''
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
options.addStringOption('Xdoclint:none', '-quiet')
}
}
// configure nexus staging plugin
nexusStaging {
numberOfRetries = 50
delayBetweenRetriesInMillis = 5000
}
wrapper {
gradleVersion = '7.4.2'
distributionType = Wrapper.DistributionType.ALL
}