-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathdist.gradle
100 lines (92 loc) · 3.34 KB
/
dist.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
def distSubProjects = subprojects - project(':programming-build-utils') - project(':programming-test')
task ProActiveLibs(type: Copy) {
distSubProjects.each {
from it.configurations.runtime.files { it instanceof ExternalDependency }
}
into "dist/lib"
}
task ProActiveUtilsLibs(type: Jar) {
from project(':programming-build-utils').jar.outputs.files.collect { zipTree(it) }
destinationDir file('dist/lib')
archiveName 'ProActive_utils.jar'
}
task ProActiveJar(type: Jar, group: 'ProActive', dependsOn: ['ProActiveLibs', 'MergeMetaInfServices']) {
from "$buildDir/jar"
distSubProjects.each {
from it.jar.outputs.files.collect {
zipTree(it).matching {
exclude 'processbuilder/**'
}
}
}
destinationDir file('dist/lib')
archiveName 'ProActive.jar'
duplicatesStrategy DuplicatesStrategy.EXCLUDE // services are merged
manifest {
attributes("Main-Class": "org.objectweb.proactive.Main",
"Implementation-Title": "ProActive",
"Implementation-Version": rootProject.version,
"Implementation-Vendor": "OASIS - INRIA Sophia Antipolis",
"Implementation-URL": "http://proactive.inria.fr")
}
outputs.file file('dist/lib')
doLast {
// generate INDEX.list
ant.jar(update: true, index: true, destfile: file('dist/lib/ProActive.jar')) {
indexjars {
fileset(dir: 'dist/lib/') {
include(name: '*.jar')
exclude(name: 'ProActive.jar')
}
}
}
}
}
task MergeMetaInfServices {
inputs.file distSubProjects.jar.outputs
outputs.file "$buildDir/jar/META-INF/services/"
doLast {
def serviceFile = distSubProjects.collect {
it.jar.outputs.files.collect {
zipTree(it).matching {
include 'META-INF/services/**'
}.files
}
}.flatten()
serviceFile.groupBy { it.name }.each { k, v ->
new File("$buildDir/jar/META-INF/services/$k").with {
getParentFile().mkdirs();
write(v*.text.join('\n'))
}
}
}
}
task ProcessBuilderScripts(type: Copy) {
from project('programming-extensions:programming-extension-processbuilder').jar.outputs.files.collect {
zipTree(it).matching {
include 'processbuilder/linux/*.sh'
}
}
into file('dist/scripts')
}
task ProActiveScripts(type: Copy) {
from file("${projectDir}/scripts/")
into file('dist/scripts')
}
task('build').dependsOn(ProActiveJar, ProActiveUtilsLibs, ProcessBuilderScripts, ProActiveScripts, subprojects.build)
ProActiveJar.dependsOn(distSubProjects.jar)
MergeMetaInfServices.dependsOn(distSubProjects.jar)
defaultTasks 'build'
if (hasGcc) {
task ProcessBuilderExec(type: Copy) {
if (isLinux) {
from project('programming-extensions:programming-extension-processbuilder').suer32.outputs
from project('programming-extensions:programming-extension-processbuilder').suer64.outputs
}
if (isMac) {
from project('programming-extensions:programming-extension-processbuilder').suermac64.outputs
}
into file('dist/scripts/processbuilder/linux')
}
build.dependsOn(ProcessBuilderExec)
}