1
1
configurations {
2
2
osgiRuntime
3
+ osgiRuntimeBnd
3
4
}
4
5
5
6
sourceSets {
@@ -33,28 +34,24 @@ dependencies {
33
34
testRuntime( " org.apache.felix:org.apache.felix.main:4.0.3" )
34
35
testRuntime( " org.jboss.logmanager:jboss-logmanager:1.4.1.Final" )
35
36
36
- // Local copies of all jars needed fur the OSGi runtime.
37
- osgiRuntime( " org.jboss.arquillian.osgi:arquillian-osgi-bundle:1.0.3.Final" )
38
- osgiRuntime( libraries. jpa )
39
- osgiRuntime( " javax.enterprise:cdi-api:1.1-PFD" )
40
- osgiRuntime( " org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.2_spec:1.0.0.Alpha1" )
41
- osgiRuntime( libraries. jta )
42
- osgiRuntime( " commons-collections:commons-collections:3.2.1" )
43
- osgiRuntime( " commons-pool:commons-pool:1.6" )
44
- osgiRuntime( " commons-dbcp:commons-dbcp:1.4" )
45
- osgiRuntime( " commons-lang:commons-lang:2.6" )
46
- osgiRuntime( " net.sourceforge.serp:serp:1.14.1" )
47
- osgiRuntime( " com.h2database:h2:1.3.170" )
48
- osgiRuntime( " org.apache.servicemix.bundles:org.apache.servicemix.bundles.antlr:2.7.7_5" )
49
- osgiRuntime( libraries. javassist )
50
- osgiRuntime( " org.apache.servicemix.specs:org.apache.servicemix.specs.jsr303-api-1.0.0:2.2.0" )
51
- osgiRuntime( " org.apache.servicemix.bundles:org.apache.servicemix.bundles.ant:1.8.2_2" )
52
- osgiRuntime( " org.apache.servicemix.specs:org.apache.servicemix.specs.stax-api-1.2:2.2.0" )
53
- osgiRuntime( " org.apache.servicemix.bundles:org.apache.servicemix.bundles.dom4j:1.6.1_5" )
54
- osgiRuntime( libraries. commons_annotations )
55
- osgiRuntime( libraries. jandex )
56
- osgiRuntime( libraries. classmate )
57
- osgiRuntime( libraries. logging )
37
+ // Local copies of all jars needed fur the OSGi runtime. Ignore the transitive dependencies.
38
+ // ORDER DEPENDENT!!!
39
+ osgiRuntime( " org.jboss.arquillian.osgi:arquillian-osgi-bundle:1.0.3.Final" ) { transitive = false }
40
+ osgiRuntime( libraries. jpa ) { transitive = false }
41
+ osgiRuntime( " org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.2_spec:1.0.0.Alpha1" ) { transitive = false }
42
+ osgiRuntime( libraries. jta ) { transitive = false }
43
+ osgiRuntime( " com.h2database:h2:1.3.170" ) { transitive = false }
44
+ osgiRuntime( " org.apache.servicemix.bundles:org.apache.servicemix.bundles.antlr:2.7.7_5" ) { transitive = false }
45
+ osgiRuntime( libraries. javassist ) { transitive = false }
46
+ osgiRuntime( " org.apache.servicemix.specs:org.apache.servicemix.specs.stax-api-1.2:2.2.0" ) { transitive = false }
47
+ osgiRuntime( " org.apache.servicemix.bundles:org.apache.servicemix.bundles.dom4j:1.6.1_5" ) { transitive = false }
48
+ osgiRuntime( libraries. commons_annotations ) { transitive = false }
49
+ osgiRuntime( libraries. classmate ) { transitive = false }
50
+ osgiRuntime( libraries. logging ) { transitive = false }
51
+ // needed for BND
52
+ osgiRuntimeBnd( libraries. jandex ) { transitive = false }
53
+ osgiRuntimeBnd( " javax.enterprise:cdi-api:1.1" ) { transitive = false }
54
+ osgiRuntimeBnd( " javax.el:el-api:2.2" ) { transitive = false }
58
55
59
56
testClientBundleCompile( project( ' :hibernate-core' ) )
60
57
testClientBundleCompile( project( ' :hibernate-entitymanager' ) )
@@ -85,18 +82,49 @@ jar {
85
82
}
86
83
87
84
task copyBnd (type : Copy ) {
88
- into " $buildDir /osgi-lib/bnd"
89
85
from " src/test/resources/bnd"
86
+ into " $buildDir /osgi-lib/bnd"
90
87
}
91
88
92
89
task runBnd (type : JavaExec ){
93
90
main = " -jar"
94
- args " $buildDir /osgi-lib/bnd/bnd-2.1.0.jar" , " $buildDir /osgi-lib/bnd/cdi-api.bnd" , " $buildDir /osgi-lib/bnd/el-api.bnd" , " $buildDir /osgi-lib/bnd/jandex.bnd" , " $b uildDir /osgi-lib/bnd/serp.bnd "
91
+ args " $buildDir /osgi-lib/bnd/bnd-2.1.0.jar" , " $buildDir /osgi-lib/bnd/cdi-api.bnd" , " $buildDir /osgi-lib/bnd/el-api.bnd" , " $buildDir /osgi-lib/bnd/jandex.bnd"
95
92
}
96
93
97
94
task copyToLib (type : Copy ) {
98
- into " $buildDir /osgi-lib"
99
95
from configurations. osgiRuntime
96
+ from configurations. osgiRuntimeBnd
97
+ into " $buildDir /osgi-lib"
98
+ }
99
+
100
+ task felixProperties << {
101
+ copy {
102
+ from " src/test/resources/felix-framework.properties-ORIGINAL"
103
+ into " $buildDir /osgi-lib"
104
+ rename { String fileName ->
105
+ fileName. replace(" -ORIGINAL" , " " )
106
+ }
107
+ }
108
+
109
+ propertiesFile = file(" $buildDir /osgi-lib/felix-framework.properties" )
110
+
111
+ // append jars wrapped using BND
112
+ FileTree tree = fileTree(dir : " $buildDir /osgi-lib/bnd" )
113
+ tree. exclude " *bnd*"
114
+ tree. each {File file ->
115
+ propertiesFile << " \\\n file:target/osgi-lib/bnd/" + file. name
116
+ }
117
+
118
+ // append all jars in osgiRuntime configuration
119
+ configurations. osgiRuntime. each { File file ->
120
+ propertiesFile << " \\\n file:target/osgi-lib/" + file. name
121
+ }
122
+
123
+ // append ORM jars
124
+ // TODO: Is there a better, dynamic way of doing this?
125
+ propertiesFile << " \\\n file:../hibernate-core/target/libs/hibernate-core-" + hibernateTargetVersion + " .jar"
126
+ propertiesFile << " \\\n file:../hibernate-entitymanager/target/libs/hibernate-entitymanager-" + hibernateTargetVersion + " .jar"
127
+ propertiesFile << " \\\n file:target/libs/hibernate-osgi-" + hibernateTargetVersion + " .jar"
100
128
}
101
129
102
130
task testClientBundleJar (type : Jar ) {
@@ -117,6 +145,7 @@ task testClientBundleJar(type: Jar) {
117
145
118
146
runBnd. dependsOn copyToLib
119
147
runBnd. dependsOn copyBnd
120
- test. dependsOn runBnd
148
+ felixProperties. dependsOn runBnd
149
+ test. dependsOn felixProperties
121
150
test. dependsOn testClientBundleJar
122
151
test. dependsOn jar
0 commit comments