-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
233 lines (191 loc) · 6.37 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
/*
* Gradle build script for the universal remote control for solvers (RCL).
*/
/************************************
* Plugin Configuration and Imports *
************************************/
plugins {
id "application"
id "eclipse"
id "jacoco"
id "java"
id "maven-publish"
id "org.ajoberstar.grgit" version "4.1.0"
id "org.openjfx.javafxplugin" version "0.0.13"
}
import org.apache.tools.ant.filters.ReplaceTokens
/**********************
* Main Configuration *
**********************/
group = "fr.cril"
version = "0.1.0"
def licenseName = "GNU Lesser General Public License, Version 3"
def licenseUrl = "https://www.gnu.org/licenses/lgpl-3.0.html"
def gitUrl = "https://github.com/crillab/remote-control"
def issueUrl = "https://github.com/crillab/remote-control/issues"
def outDir = "${rootDir}/dist"
def jarDir = "${outDir}/home"
sourceCompatibility = '17'
targetCompatibility = '17'
/****************
* Dependencies *
****************/
// Declaring the repositories to download the dependencies from.
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/crillab/*")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
// Declaring the dependencies of the project.
dependencies {
implementation group: "com.brunomnsilva", name: "smartgraph", version: "1.0.0"
implementation group: "fr.cril", name: "juniverse", version: "0.2.10"
}
// Declaring the dependencies on JavaFX components.
javafx {
version = "17.0.2"
modules = ["javafx.controls", "javafx.fxml"]
}
/*************************
* Eclipse Configuration *
*************************/
// Modularizing project dependencies.
eclipse.classpath.file.whenMerged {
entries.findAll{ isModule(it) }.each{ it.entryAttributes["module"] = "true" }
}
// 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"))
}
/*****************
* Property File *
*****************/
// Injects into the source code the information about the latest build.
task preprocessProperties(type: Copy) {
from "src/main/resources/fr/univartois/cril/rcl/util/"
into "src/main/java/fr/univartois/cril/rcl/util/"
include "RemoteControlProperties"
rename "RemoteControlProperties", "RemoteControlProperties.java"
filter(ReplaceTokens, beginToken: "##", endToken: "##", tokens: [
version: rootProject.version,
license_name: licenseName,
license_url: licenseUrl,
website: gitUrl,
support: issueUrl,
commit_sha: grgit.head().abbreviatedId
])
filter(ReplaceTokens, beginToken: "0x", endToken: "", tokens: [
DA7E: Long.toString(System.currentTimeMillis()) + "L"
])
}
// Properties are processed each time the code is compiled.
compileJava.dependsOn preprocessProperties
/***************
* Application *
***************/
// Configuring the module and class to run as main.
application {
mainModule = "fr.univartois.cril.rcl"
mainClass = "fr.univartois.cril.rcl.RemoteControl"
}
/*************
* Packaging *
*************/
// Putting the generated jars in the output directory.
tasks.withType(Jar) {
destinationDirectory = file("${jarDir}")
}
// Collects external dependencies of RCL into the output directory.
task collectExternalDependencies(type: Copy) {
from configurations.runtimeClasspath.collect {
it
}
into "${jarDir}"
}
// Creating a gzipped-tarball with RCL and its dependencies.
task rcl(type: Tar) {
dependsOn jar
dependsOn collectExternalDependencies
from file("${jarDir}")
destinationDirectory = file("${outDir}")
archiveBaseName = "rcl"
archiveExtension = "tgz"
compression = Compression.GZIP
}
// Removes the binary files of RCL when cleaning.
task removeBinaries(type: Delete) {
delete "dist"
}
clean.dependsOn removeBinaries
/****************
* 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 = "RCL"
description = "A universal remote control for solvers."
url = "https://github.com/crillab/remote-control"
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 = "falque@cril.fr"
}
developer {
id = "michaelvalet"
name = "Michael Valet"
email = "michael_valet@ens.univ-artois.fr"
}
developer {
id = "romainwallon"
name = "Romain Wallon"
email = "wallon@cril.fr"
}
}
scm {
connection = "scm:git:https://github.com/crillab/remote-control"
developerConnection = "scm:git:https://github.com/crillab/remote-control"
url = "https://github.com/crillab/remote-control"
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/crillab/remote-control")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
}