-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
172 lines (142 loc) · 4.04 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
plugins{
id 'java'
id 'jacoco'
id 'eclipse'
id 'application'
id 'base'
}
import org.apache.tools.ant.filters.ReplaceTokens
mainClassName = 'org.jreliability.tester.ReliabilityTester'
group = 'org.jreliability'
/*
* define global parameters here, e.g. versions numbers of tools which need to be consistent for all subprojects
* they are all accesible via project.parametername e.g. project.opt4jJavaVersion to get the used java version for Opt4J
*/
ext{
jreliabilityJavaVersion = "21"
junitVersion = "5.10.2"
mockitoVersion = "5.10.0"
jacocoVersion = "0.8.11"
}
jacoco{
toolVersion = project.jacocoVersion
}
java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = project.jreliabilityJavaVersion
targetCompatibility = project.jreliabilityJavaVersion
toolchain {
languageVersion.set(JavaLanguageVersion.of(project.jreliabilityJavaVersion))
}
}
/*
* Gets the version name from the latest Git tag
*/
def getVersionName = {
->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
ignoreExitValue true
}
version=stdout.toString().trim()
if (version.indexOf('-') >= 0 || version.isEmpty())
version += '-SNAPSHOT'
return version
}
version=getVersionName()
ext {
dateISO = new Date().format("yyyy-MM-dd")
}
repositories {
mavenCentral()
}
dependencies {
implementation group: 'net.sourceforge.collections', name: 'collections-generic', version: '4.01'
implementation group: 'com.github.com-github-javabdd', name: 'com.github.javabdd', version: '9.0.0'
implementation files('lib/ptolemyplot-5.7.jar')
testImplementation platform(group: 'org.junit', name: 'junit-bom', version: project.junitVersion)
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter'
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher'
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: project.mockitoVersion
}
jar {
manifest {
attributes 'Main-Class': mainClassName
}
}
/* for now ignore all javadoc errors in case of Java 8 */
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
test {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()
// Always run tests, even when nothing changed.
dependsOn 'cleanTest'
// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
}
jacocoTestCoverageVerification {
dependsOn check
}
jacocoTestReport {
dependsOn jacocoTestCoverageVerification
reports {
html.required = true
html.destination(file("${buildDir}/reports/jacoco"))
xml.required = true
xml.destination(file("${buildDir}/reports/jacoco/report.xml"))
csv.required = true
csv.destination(file("${buildDir}/reports/jacoco/report.csv"))
}
onlyIf = {
true
}
afterEvaluate {
getClassDirectories().setFrom(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'org/jreliability/gui/**',
'org/jreliability/tutorial/**',
'org/jreliability/tester/**'
])
})
}
}
artifacts {
archives sourcesJar
archives javadocJar
}
task alldocs(type: Javadoc, dependsOn: javadoc) {
title = "JReliability version $version Project API Documentation"
destinationDir = new File(project.buildDir, 'docs/javadoc')
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PUBLIC
options.links "https://docs.oracle.com/en/java/javase/${jreliabilityJavaVersion}/docs/api/"
options.linkSource = true
}
task copyWebsite(type: Copy){
from('src/main/website/') {
include '**/*.html'
filter(ReplaceTokens, tokens: [version : project.version, date : project.dateISO])
}
from('src/main/website/') {
exclude '**/*.html'
}
into 'build/website/'
}
task copyJavadoc(type: Copy, dependsOn: 'alldocs'){
from new File(project.buildDir, 'docs/javadoc')
into 'build/website/javadoc/'+version
}
task website(dependsOn: [copyWebsite, copyJavadoc]) {
description = 'build the website to deploy it when releasing'
group = 'distribution'
}