-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.gradle
44 lines (40 loc) · 1.22 KB
/
tasks.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
// allprojects {
// plugins.withType(JavaPlugin) {
// }
// }
// build jar
void jarTask(String name, String classifier, boolean withJar, boolean includeDependencies) {
tasks.create(name: name, type: Jar) {
group 'build'
archiveClassifier.set classifier
// leave the file/entry that was first copied/created in place
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest.from jar.manifest
if (includeDependencies) {
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('.jar') }.collect { zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
}
if (withJar) {
with jar // from sourceSets.main.output
}
}
}
if (plugins.hasPlugin('java')) {
jarTask('depJar', 'dependencies', false, true)
jarTask('fatJar', 'all', true, true)
task allJar {
group 'build'
dependsOn jar, depJar, fatJar
}
task testJar(type: Jar) {
group 'build'
archiveClassifier.set 'test'
from sourceSets.test.output
}
}