forked from bndtools/bnd
/
build.gradle
75 lines (67 loc) · 1.78 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
/*
*
*/
import aQute.bnd.gradle.Bundle
plugins {
id 'biz.aQute.bnd.builder'
}
ext.projectprop = 'prop.project'
group = 'test.bnd.gradle'
version = '1.0.0'
repositories {
mavenCentral()
}
dependencies {
implementation 'commons-codec:commons-codec:1.5'
implementation 'commons-lang:commons-lang:2.6'
testImplementation 'junit:junit:4.9'
}
jar {
ext.taskprop = 'prop.task'
manifest {
attributes('Implementation-Title': providers.provider({ -> project.archivesBaseName}),
'Implementation-Version': project.version,
'-includeresource': '{${.}/bar.txt}',
'-include': '${.}/other.bnd',
'Override': 'This should be overridden by the bnd file'
)
}
bundle.bnd = ['Override': 'This will be ignored since there is a bnd file for this task']
}
task bundle(type: Bundle) {
description = 'Bundle'
from sourceSets.test.output
archiveClassifier = 'bundle'
bundle {
bnd = '''
-exportcontents: doubler.impl
-sources: true
My-Header: my-value
text: TEXT
Bundle-Name: ${project.group}:${task.archiveBaseName}-${task.archiveClassifier}
Project-Name: ${project.name}
Project-Dir: ${project.dir}
Project-Output: ${project.output}
Project-Sourcepath: ${project.sourcepath}
Project-Buildpath: ${project.buildpath}
'''
bnd 'Here: ${.}'
bnd '-includeresource.lib': 'commons-lang-2.6.jar;lib:=true'
sourceSet = sourceSets.test
classpath = configurations.compileClasspath
classpath jar
}
archiveVersion = '1.1.0'
}
assemble {
dependsOn bundle
doLast {
// Test that we store the generated manifest back into the task
println "### jar Bundle-SymbolicName: ${jar.manifest.effectiveManifest.attributes['Bundle-SymbolicName']}"
println "### bundle Bundle-SymbolicName: ${bundle.manifest.effectiveManifest.attributes['Bundle-SymbolicName']}"
}
}
artifacts {
runtimeOnly bundle
archives bundle
}