-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
196 lines (161 loc) · 4.82 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
/*
* This is the build.gradle configuration file of JUniverse.
*/
/************************
* Plugin Configuration *
************************/
apply plugin: "eclipse"
apply plugin: "java"
apply plugin: "jacoco"
apply plugin: "maven-publish"
/**********************
* Main Configuration *
**********************/
def outDir = "${rootDir}/dist"
def jarDir = "${outDir}/home"
group = "fr.cril"
version = "0.2.14"
ext.moduleName = "fr.univartois.cril.juniverse"
sourceCompatibility = "10"
targetCompatibility = "10"
/*************************
* Eclipse Configuration *
*************************/
eclipse.classpath.file.whenMerged {
// Modularizing project dependencies.
entries.findAll{ isModule(it) }.each{ it.entryAttributes["module"] = "true" }
}
/****************************************
* Compilation Configuration for Jigsaw *
****************************************/
afterEvaluate {
compileJava {
// Setting the module name.
inputs.property("moduleName", moduleName)
// Adding the classpath to the module path.
doFirst {
options.compilerArgs = [
"--module-path", classpath.asPath
]
classpath = files()
}
}
}
/**********************
* Test Configuration *
**********************/
// Making test resources available during test execution.
task copyTestResources(type: Copy) {
from "${projectDir}/src/test/resources"
into "${buildDir}/classes/java/test"
}
processTestResources.dependsOn copyTestResources
// Configuring the use of JUnit 5.
test {
useJUnitPlatform()
}
// Configuring the version of JaCoCo to use.
jacoco {
toolVersion = "0.8.7"
}
// Asking for an XML output for JaCoCo.
jacocoTestReport {
reports {
xml.required = true
}
}
/*************************
* Javadoc Configuration *
*************************/
tasks.withType(Javadoc) {
// Adding the classpath to the module path.
doFirst {
options.modulePath = [] + classpath.files
options.classpath = []
}
// Specifying how to deal with '@implSpec' tags.
configure(options) {
tags('implSpec:a:Implementation Requirements:')
}
}
/****************
* Distribution *
****************/
// Adding the Javadoc and source JARs to the generated artifacts.
java {
withJavadocJar()
withSourcesJar()
}
// Configuring the POM file to publish.
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name = "JUniverse"
description = "A universal solver interface."
url = "https://github.com/crillab/juniverse"
licenses {
license {
name = "GNU Lesser General Public License, Version 3"
url = "https://www.gnu.org/licenses/lgpl-3.0.html"
}
}
developers {
developer {
id = "thibaultfalque"
name = "Thibault Falque"
email = "[email protected]"
}
developer {
id = "romainwallon"
name = "Romain Wallon"
email = "[email protected]"
}
}
scm {
connection = "scm:git:https://github.com/crillab/juniverse"
developerConnection = "scm:git:https://github.com/crillab/juniverse"
url = "https://github.com/crillab/juniverse"
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/crillab/juniverse")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
}
/*************
* Packaging *
*************/
// Putting the generated jars in the output directory.
tasks.withType(Jar) {
destinationDirectory = file("${jarDir}")
}
// Removes the binary files of JUniverse when cleaning.
task removeBinaries(type: Delete) {
delete "dist"
}
clean.dependsOn removeBinaries
/*************
* Functions *
*************/
// Checking whether an Eclipse classpath entry must be put in the module path.
boolean isModule(entry) {
(entry.kind == "src") || ((entry.kind == "lib") && (entry.entryAttributes["gradle_used_by_scope"] != "test"))
}