forked from mwsobol/SORCER-multiFi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
243 lines (216 loc) · 7.11 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
234
235
236
237
238
239
240
/*
* Copyright to the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Grab the current branch from git and append to version */
String ref = new File(rootProject.projectDir, ".git/HEAD").text
int ndx = ref.lastIndexOf("/")
String branch = ref.substring(ndx+1).trim()
String branchRef = branch.equals("master")?"":"-$branch"
version = "8.7.14$branchRef"
apply plugin: 'idea'
idea {
project {
jdkName = '1.8'
languageLevel = '1.8'
}
}
task printVersion {
description = 'Prints the current SORCER version.'
doLast {
logger.quiet "Version: $version"
}
}
task printClasspath() {
description = 'Prints the current Java classpath.'
doLast {
println "${project.name}"
configurations.testRuntime.each {
println "--> $it"
}
}
}
//task wrapper(type: Wrapper) {
// description = 'Prints the Gradle wrapper version.'
// gradleVersion = '2.12'
//}
ext {
enclaveRepo = "10.131.7.138:7001"
//enclaveRepo = "10.0.1.9:50001"
enclave = InetAddress.getLocalHost().getHostAddress().startsWith("10.131")
}
apply from: file('gradle/libraries.gradle')
apply from: file("gradle/testProperties.gradle")
apply from: file("gradle/utils.gradle")
allprojects {
apply plugin: 'idea'
group = 'org.sorcer'
String user = System.properties['user.name']
String tmpDir = System.getenv("TMPDIR")==null?System.properties['java.io.tmpdir']:System.getenv("TMPDIR")
ext {
sorcerData = file("${tmpDir}/sorcer-${user}/data").path
}
File sorcerDataDir = file(sorcerData)
if(sorcerDataDir.mkdirs()) {
println "Created ${sorcerDataDir.path}"
}
}
subprojects {
if (project.name != "examples" && project.name != "sorcer-int-tests") {
apply plugin: "maven"
apply plugin: "maven-publish"
if (project.name != "distribution") {
apply plugin: "java"
idea {
module {
downloadSources = true
downloadJavadoc = false
}
}
/* Always run tests */
test.outputs.upToDateWhen { false }
/*
* Inject an allTest task for projects with a Test class that has a name of "test"
*/
Test tester = tasks.getByName("test")
if (tester != null) {
task "allTest" {
description = "Runs all tests in a project"
dependsOn(test)
}
}
compileJava.options.encoding = 'UTF-8'
apply from: file("${rootProject.projectDir.path}/gradle/bootme.gradle")
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
}
publishing {
repositories {
maven {
url "http://$enclaveRepo"
}
}
}
repositories {
mavenLocal()
if (!enclave) {
maven { url "http://www.rio-project.org/maven2" }
maven { url"http://pol.sytes.net/repository/public/" }
mavenCentral()
} else {
maven { url "http://$enclaveRepo" }
}
}
}
}
def isAnAggregateTest(graph) {
return (graph.hasTask(":tests") || graph.hasTask(":allTests"))
}
def isAnAllTest(graph, name) {
return (graph.hasTask(":allTests") || graph.hasTask("${name}:allTest"))
}
gradle.taskGraph.whenReady { graph ->
boolean runningTests = false
graph.getAllTasks().each { t ->
if(t.path.endsWith("test")) {
runningTests = true
}
}
if (runningTests) {
project.subprojects { project ->
tasks.withType(Test) {
if(isAnAggregateTest(graph))
reports.html.enabled = false
// to debug Rio tests with InteliJ comment 159-163
if(!isAnAllTest(graph, project.path)) {
useJUnit {
excludeCategories 'org.sorcer.test.TestsRequiringRio'
}
}
}
}
}
}
task tests(type: TestReport, dependsOn: "bootSorcer") {
description = "Aggregate test runner, runs tests that don't require RIO in the project."
destinationDir = file("$buildDir/reports/tests")
project.subprojects { project ->
tasks.withType(Test) {
//ignoreFailures true
reportOn it
}
}
doLast {
println "\nThe tests task is complete. See the results at: file://${destinationDir.path}/index.html"
}
finalizedBy("terminateSorcer")
}
task allTests(type: TestReport, dependsOn: "bootSorcerRio") {
description = "Aggregate test runner, runs all tests in the project."
destinationDir = file("$buildDir/reports/allTests")
project.subprojects { project ->
tasks.withType(Test) {
//ignoreFailures true
reportOn it
}
}
doLast {
println "\nThe allTests task is complete. See the results at: file://${destinationDir.path}/index.html"
}
finalizedBy("terminateSorcerRio")
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
//noinspection SpellCheckingInspection
tasks.withType(Javadoc) {
// disable the crazy super-strict doclint tool in Java 8
//noinspection SpellCheckingInspection
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
/*
* Generate all javadocs
*/
task allJavadoc(type: Javadoc) {
options.links = ['http://docs.oracle.com/javase/8/docs/api/',
'https://river.apache.org/doc/api/',
'http://www.rio-project.org/apidocs']
exclude '**/*Test.java'
exclude '**/edu/*'
description = 'Creates SORCER API Specification, view them in build/javadoc/index.html'
destinationDir = new File(project.projectDir, 'build/javadoc')
title = "SORCER ${version}"
}
subprojects {
afterEvaluate {
def skip = ["deploy-tests", "sorcer-tester", "eol", "worker", "pml", "service", "ssb"]
if (plugins.hasPlugin(JavaPlugin) && !skip.contains(project.name)) {
// configuration here
rootProject.tasks.allJavadoc {
source += files(sourceSets.collect { srcSet -> srcSet.allJava })
classpath += files(sourceSets*.compileClasspath)
}
}
}
}
task javaDocZip(type: Zip, dependsOn: allJavadoc) {
classifier = 'javadoc'
from allJavadoc.destinationDir
}