-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle
158 lines (124 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
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
apply plugin: 'base'
description = "JBotSim : a simulation library for distributed algorithms in dynamic networks."
def currentVersion = project.findProperty('jBotSimVersion')
println("Current version: " + currentVersion)
def currentJvm = org.gradle.internal.jvm.Jvm.current()
println "Current Jvm: " + currentJvm
println "Current java version: " + JavaVersion.current()
version = currentVersion
ext.depVersion = currentVersion
subprojects {
apply plugin: "java"
apply plugin: "idea"
sourceCompatibility = 1.8 // java 8
targetCompatibility = 1.8
group = "io.jbotsim"
version = currentVersion
ext.depVersion = currentVersion
repositories {
mavenLocal()
jcenter()
}
repositories {
maven {
name = 'NexusDockerRelease'
url = "http://localhost:8081/nexus/content/repositories/releases/"
}
maven {
name = 'NexusDockerSnapshot'
url = "http://localhost:8081/nexus/content/repositories/snapshots/"
}
}
repositories {
maven {
name = 'LocalRepo'
url = "file://${rootDir}/repo"
}
}
dependencies{
testCompile(
'org.mockito:mockito-core:+'
)
testImplementation(
'org.junit.jupiter:junit-jupiter-api:5.1.0',
'org.junit.jupiter:junit-jupiter-params:5.1.0',
"junit:junit:4+"
)
testRuntimeOnly(
'org.junit.jupiter:junit-jupiter-engine:5.1.0',
'org.junit.vintage:junit-vintage-engine:5.1.0'
)
}
test {
useJUnitPlatform()
}
compileJava {
options.encoding = 'UTF-8'
}
}
task publishToInternalRepository {
group = 'publishing'
description = 'Publishes all Maven publications to the internal Maven repository.'
dependsOn tasks.withType(PublishToMavenLocal)
dependsOn subprojects.collect { it.tasks.withType(PublishToMavenLocal) }
}
task checkAll {
group = 'verification'
description = 'Checks that the project is in a good shape (everythings builds properly)'
dependsOn ':lib:jars'
dependsOn ':lib:tests'
dependsOn ':apps:buildAllSubprojects'
}
/**
* Copies the content of the monolithic jars which we later want to merge into a common directory.
*/
task copyMonolithicJarsContent {
dependsOn 'lib:monolithicSourcesJar'
dependsOn 'fats:fat-jbotsim-full:shadowJar'
String copyDir = "${buildDir}/jarMerges"
outputs.files(copyDir)
doLast {
FileTree sourcesJar = zipTree(project("lib").tasks["monolithicSourcesJar"].outputs.files[0])
FileTree classesJar = zipTree(project("fats").project("fat-jbotsim-full").tasks["shadowJar"].outputs.files[0])
copy {
from sourcesJar
from classesJar
into copyDir
}
}
}
/**
* Merges the content of the required monolithic jars into one jar.
*/
task mergeRequiredMonolithicJars(type:Jar) {
dependsOn 'copyMonolithicJarsContent'
from copyMonolithicJarsContent
archiveName = "jbotsim-standalone-${version}-classes-sources.${extension}"
}
/**
* This task builds and gathers the jars generated for the standalone versions of JBotSim.
* The jars are put in the "/dist" directory.
*/
task distStandalone (type:Copy) {
group = 'build'
description = 'Retrieve all standalone artifacts'
from rootProject.project("fats").tasks.matching {it.name == "jars"}
from rootProject.project("lib").tasks.matching {it.name == "monolithicJavadocJar"}
from rootProject.project("lib").tasks.matching {it.name == "monolithicSourcesJar"}
from rootProject.tasks.matching {it.name == "mergeRequiredMonolithicJars"}
into "${buildDir}/dist"
include '*.jar'
}
task cleans {
group = 'build'
description = 'Deletes the build directory for all sub projects.'
dependsOn clean
dependsOn subprojects.collect {it.tasks.matching {it.name.equals("cleans")}}
}