-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle
More file actions
152 lines (127 loc) · 4.56 KB
/
build.gradle
File metadata and controls
152 lines (127 loc) · 4.56 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
import com.vanniktech.maven.publish.*
plugins {
id 'java-library'
id 'checkstyle'
id 'jacoco'
id 'com.vanniktech.maven.publish' version '0.36.0' // publish to Maven Central
id 'com.github.ben-manes.versions' version '0.53.0' // check for out-of-date dependencies (run 'dependencyUpdates' manually)
id 'com.github.spotbugs' version '6.4.8' // spotbugs code analysis
id 'org.sonarqube' version '7.2.3.7755' // sonarQube analysis
}
group = 'com.imsweb'
version = file('VERSION').text
description = 'Java implementation of cancer-related algorithms'
println "Starting build using JDK ${Runtime.version().feature()}"
repositories {
mavenCentral()
}
dependencies {
implementation 'com.thoughtworks.xstream:xstream:1.4.21'
implementation 'org.apache.commons:commons-lang3:3.20.0'
implementation 'de.siegmar:fastcsv:4.1.1'
testImplementation 'com.imsweb:layout:7.1'
testImplementation 'com.imsweb:seerutils:5.7'
testImplementation 'com.imsweb:seerutils-gui:1.20'
testImplementation 'junit:junit:4.13.2'
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
options.addBooleanOption('html5', true)
}
jar {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Information Management Services Inc.',
'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.algorithms'
)
}
}
// checkstyle plugin settings
checkstyle {
ignoreFailures = false
configFile = project(':').file('config/checkstyle/checkstyle.xml')
configProperties = ['suppressionFile': project(':').file('config/checkstyle/checkstyle-exclude.xml')]
}
// jacoco plugin settings
jacocoTestReport {
reports {
xml.required = true
}
}
test.finalizedBy jacocoTestReport
// spotbugs plugin settings
spotbugs {
ignoreFailures = false
excludeFilter.set(project(':').file("config/spotbugs/spotbugs-exclude.xml"))
}
sonarqube {
properties {
property "sonar.projectKey", "imsweb_algorithms"
property "sonar.organization", "imsweb"
property "sonar.host.url", "https://sonarcloud.io"
property 'sonar.exclusions', '**/lab/*'
property 'sonar.coverage.exclusions', '**/lab/*'
}
}
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
// https://github.com/ben-manes/gradle-versions-plugin
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version)
}
}
// needed to deploy to Maven Central Portal
mavenPublishing {
configure(new JavaLibrary(new JavadocJar.Javadoc(), new SourcesJar.Sources()))
publishToMavenCentral(true)
signAllPublications()
pom {
name = 'Algorithms'
description = 'Java implementation of cancer-related algorithms (NHIA, NAPIIA, Survival Time, etc...)'
url = 'https://github.com/imsweb/algorithms'
inceptionYear = '2015'
licenses {
license {
name = 'A modified BSD License (BSD)'
url = 'https://github.com/imsweb/algorithms/blob/master/LICENSE'
distribution = 'repo'
}
}
developers {
developer {
id = 'depryf'
name = 'Fabian Depry'
email = '[email protected]'
}
}
scm {
url = 'https://github.com/imsweb/algorithms'
connection = 'scm:https://github.com/imsweb/algorithms.git'
developerConnection = 'scm:[email protected]:imsweb/algorithms.git'
}
}
}
// Gradle wrapper, this allows to build the project without having to install Gradle!
wrapper {
gradleVersion = '9.4.0'
distributionType = Wrapper.DistributionType.ALL
}