buildr4osgi 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +176 -0
- data/NOTICE +6 -0
- data/README.rdoc +50 -0
- data/Rakefile +45 -0
- data/buildr4osgi.gemspec +40 -0
- data/lib/buildr4osgi/compile/compiler.rb +54 -0
- data/lib/buildr4osgi/compile/ecj-3.4.1.jar +0 -0
- data/lib/buildr4osgi/compile.rb +16 -0
- data/lib/buildr4osgi/eclipse/feature.rb +271 -0
- data/lib/buildr4osgi/eclipse/plugin.rb +22 -0
- data/lib/buildr4osgi/eclipse.rb +17 -0
- data/lib/buildr4osgi/nature/eclipse.rb +80 -0
- data/lib/buildr4osgi/nature/java.rb +32 -0
- data/lib/buildr4osgi/nature/nature.rb +156 -0
- data/lib/buildr4osgi/nature/osgi.rb +32 -0
- data/lib/buildr4osgi/nature/scala.rb +32 -0
- data/lib/buildr4osgi/nature.rb +23 -0
- data/lib/buildr4osgi/osgi/bundle.rb +275 -0
- data/lib/buildr4osgi/osgi/bundle_package.rb +80 -0
- data/lib/buildr4osgi/osgi/container.rb +140 -0
- data/lib/buildr4osgi/osgi/library_extension.rb +174 -0
- data/lib/buildr4osgi/osgi/packaging.rb +129 -0
- data/lib/buildr4osgi/osgi/project_extension.rb +324 -0
- data/lib/buildr4osgi/osgi/registry.rb +61 -0
- data/lib/buildr4osgi/osgi/resolving_strategies.rb +104 -0
- data/lib/buildr4osgi/osgi/version.rb +131 -0
- data/lib/buildr4osgi/osgi.rb +24 -0
- data/lib/buildr4osgi.rb +37 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +92 -0
- data/rakelib/jekylltask.rb +120 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +149 -0
- data/rakelib/rspec.rake +73 -0
- data/rakelib/setup.rake +54 -0
- data/rakelib/stage.rake +206 -0
- data/spec/compile/compiler_spec.rb +30 -0
- data/spec/eclipse/feature_spec.rb +295 -0
- data/spec/nature/eclipse_spec.rb +46 -0
- data/spec/nature/java_spec.rb +45 -0
- data/spec/nature/osgi_spec.rb +63 -0
- data/spec/nature/scala_spec.rb +45 -0
- data/spec/nature_spec.rb +144 -0
- data/spec/osgi/bundle_package_spec.rb +32 -0
- data/spec/osgi/bundle_spec.rb +202 -0
- data/spec/osgi/container_spec.rb +93 -0
- data/spec/osgi/library_extension_spec.rb +142 -0
- data/spec/osgi/packaging_spec.rb +340 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/META-INF/ECLIPSEF.RSA +0 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/META-INF/ECLIPSEF.SF +20 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/META-INF/MANIFEST.MF +28 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/META-INF/eclipse.inf +3 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/about.html +28 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/fragment.properties +12 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/runtime_registry_compatibility.jar +0 -0
- data/spec/osgi/project_extension_spec.rb +662 -0
- data/spec/osgi/registry_spec.rb +50 -0
- data/spec/osgi/version_spec.rb +127 -0
- data/spec/spec_helpers.rb +85 -0
- data/spec/tmp/remote/eclipse/org.eclipse.debug.ui/3.4.1.v20080811_r341/org.eclipse.debug.ui-3.4.1.v20080811_r341.jar +0 -0
- data/spec/tmp/remote/eclipse/org.eclipse.debug.ui/3.4.1.v20080811_r341/org.eclipse.debug.ui-3.4.1.v20080811_r341.pom +82 -0
- data/spec/tmp/remote/org/slf4j/jcl104-over-slf4j/1.5.8/jcl104-over-slf4j-1.5.8-sources.jar +0 -0
- data/spec/tmp/remote/org/slf4j/jcl104-over-slf4j/1.5.8/jcl104-over-slf4j-1.5.8.jar +0 -0
- data/spec/tmp/remote/org/slf4j/jcl104-over-slf4j/1.5.8/jcl104-over-slf4j-1.5.8.pom +30 -0
- data/spec/tmp/remote/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8-sources.jar +0 -0
- data/spec/tmp/remote/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar +0 -0
- data/spec/tmp/remote/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.pom +101 -0
- data/spec/tmp/remote/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8-sources.jar +0 -0
- data/spec/tmp/remote/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar +0 -0
- data/spec/tmp/remote/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.pom +56 -0
- metadata +142 -0
@@ -0,0 +1,662 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
17
|
+
|
18
|
+
Spec::Runner.configure do |config|
|
19
|
+
config.include Buildr4OSGi::SpecHelpers
|
20
|
+
end
|
21
|
+
|
22
|
+
describe OSGi::ProjectExtension do
|
23
|
+
|
24
|
+
it 'should give a way to take project dependencies' do
|
25
|
+
define('foo').dependencies.should be_instance_of(Array)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should add a new osgi method to projects' do
|
29
|
+
define('foo').osgi.should be_instance_of(OSGi::ProjectExtension::OSGi)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should give a handle over the OSGi containers registry' do
|
33
|
+
define('foo').osgi.registry.should be_instance_of(OSGi::Registry)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should give options to resolve bundle dependencies' do
|
37
|
+
pending
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
describe OSGi::DependenciesTask do
|
43
|
+
|
44
|
+
before :all do
|
45
|
+
e1 = createRepository("eclipse1")
|
46
|
+
@eclipse_instances = [e1]
|
47
|
+
|
48
|
+
Buildr::write e1 + "/plugins/com.ibm.icu-3.9.9.R_20081204/META-INF/MANIFEST.MF", <<-MANIFEST
|
49
|
+
Manifest-Version: 1.0
|
50
|
+
Bundle-ManifestVersion: 2
|
51
|
+
Bundle-SymbolicName: com.ibm.icu; singleton:=true
|
52
|
+
Bundle-Version: 3.9.9.R_20081204
|
53
|
+
Export-Package: my.package;version="1.0.0"
|
54
|
+
MANIFEST
|
55
|
+
Buildr::write e1 + "/plugins/org.eclipse.core.resources-3.5.0.R_20090512/META-INF/MANIFEST.MF", <<-MANIFEST
|
56
|
+
Manifest-Version: 1.0
|
57
|
+
Bundle-ManifestVersion: 2
|
58
|
+
Bundle-SymbolicName: org.eclipse.core.resources; singleton:=true
|
59
|
+
Bundle-Version: 3.5.0.R_20090512
|
60
|
+
MANIFEST
|
61
|
+
Buildr::write e1 + "/plugins/org.dude-3.5.0.R_20090512/META-INF/MANIFEST.MF", <<-MANIFEST
|
62
|
+
Manifest-Version: 1.0
|
63
|
+
Bundle-ManifestVersion: 2
|
64
|
+
Bundle-SymbolicName: org.dude; singleton:=true
|
65
|
+
Bundle-Version: 3.5.0.R_20090512
|
66
|
+
MANIFEST
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should resolve dependencies' do
|
70
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
71
|
+
Manifest-Version: 1.0
|
72
|
+
Bundle-ManifestVersion: 2
|
73
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
74
|
+
Bundle-Version: 3.9.9.R_20081204
|
75
|
+
Require-Bundle: com.ibm.icu,org.eclipse.core.resources
|
76
|
+
MANIFEST
|
77
|
+
foo = define('foo', :version=> "1.0", :group => "grp" ) {
|
78
|
+
package(:bundle)
|
79
|
+
}
|
80
|
+
foo.osgi.registry.containers = @eclipse_instances.dup
|
81
|
+
foo.manifest_dependencies.select {|b| b.name == "com.ibm.icu"}.should_not be_empty
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should use projects as dependencies" do
|
85
|
+
write "foo/META-INF/MANIFEST.MF", <<-MANIFEST
|
86
|
+
Manifest-Version: 1.0
|
87
|
+
Bundle-ManifestVersion: 2
|
88
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
89
|
+
Bundle-Version: 3.9.9.R_20081204
|
90
|
+
Require-Bundle: bar
|
91
|
+
MANIFEST
|
92
|
+
write "bar/META-INF/MANIFEST.MF", <<-MANIFEST
|
93
|
+
Manifest-Version: 1.0
|
94
|
+
Bundle-ManifestVersion: 2
|
95
|
+
Bundle-SymbolicName: bar
|
96
|
+
MANIFEST
|
97
|
+
define('container') do
|
98
|
+
project.version = "1.0"
|
99
|
+
project.group = "grp"
|
100
|
+
define('foo') do
|
101
|
+
package(:bundle)
|
102
|
+
end
|
103
|
+
define('bar') do
|
104
|
+
package(:bundle)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
project('container:foo').task('osgi:resolve:dependencies').invoke
|
108
|
+
project('container:foo').manifest_dependencies.should include(project('container:bar'))
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should use projects as dependencies, even if those are libraries projects" do
|
112
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
113
|
+
Manifest-Version: 1.0
|
114
|
+
Bundle-ManifestVersion: 2
|
115
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
116
|
+
Bundle-Version: 3.9.9.R_20081204
|
117
|
+
Require-Bundle: bar
|
118
|
+
MANIFEST
|
119
|
+
library_project(SLF4J, "grp", "bar", "1.1")
|
120
|
+
define('foo') do
|
121
|
+
project.version = "1.0"
|
122
|
+
project.group = "grp"
|
123
|
+
package(:bundle)
|
124
|
+
end
|
125
|
+
project('foo').manifest_dependencies.should include(project('bar'))
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should let library projects depend on each other" do
|
129
|
+
library_project(DEBUG_UI, "grp", "bar", "1.0")
|
130
|
+
library_project(SLF4J, "grp", "foo", "1.1", :manifest => {"Require-Bundle" => "bar"})
|
131
|
+
|
132
|
+
project('foo').manifest_dependencies.should include(project('bar'))
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'should resolve dependencies with version requirements' do
|
136
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
137
|
+
Manifest-Version: 1.0
|
138
|
+
Bundle-ManifestVersion: 2
|
139
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
140
|
+
Bundle-Version: 3.9.9.R_20081204
|
141
|
+
Require-Bundle: com.ibm.icu;bundle-version="[3.3.0,4.0.0)",org.eclipse.core.resources;bundle-version=3.5.0.R_20090512
|
142
|
+
MANIFEST
|
143
|
+
foo = define('foo', :version => "1.0", :group => "grp") {
|
144
|
+
package(:bundle)
|
145
|
+
}
|
146
|
+
foo.osgi.registry.containers = @eclipse_instances.dup
|
147
|
+
foo.manifest_dependencies.select {|b| b.name == "com.ibm.icu"}.should_not be_empty
|
148
|
+
foo.manifest_dependencies.select {|b| b.name == "com.ibm.icu" && b.version="[3.4.0,3.5.0)"}.should_not be_empty
|
149
|
+
foo.manifest_dependencies.select {|b| b.name == "org.eclipse.core.resources" && b.version="3.5.0.R_20090512"}.should_not be_empty
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should resolve projects as dependencies with version requirements" do
|
153
|
+
write "foo/META-INF/MANIFEST.MF", <<-MANIFEST
|
154
|
+
Manifest-Version: 1.0
|
155
|
+
Bundle-ManifestVersion: 2
|
156
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
157
|
+
Bundle-Version: 3.9.9.R_20081204
|
158
|
+
Require-Bundle: bar;bundle-version="[1.0,3.5)"
|
159
|
+
MANIFEST
|
160
|
+
write "bar/META-INF/MANIFEST.MF", <<-MANIFEST
|
161
|
+
Manifest-Version: 1.0
|
162
|
+
Bundle-ManifestVersion: 2
|
163
|
+
Bundle-SymbolicName: bar
|
164
|
+
MANIFEST
|
165
|
+
define('container') do
|
166
|
+
project.version = "1.1"
|
167
|
+
|
168
|
+
define('foo') do
|
169
|
+
package(:bundle)
|
170
|
+
end
|
171
|
+
define('bar') do
|
172
|
+
package(:bundle)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
project('container').osgi.registry.containers = @eclipse_instances.dup
|
176
|
+
project('container:foo').manifest_dependencies.should include(project('container:bar'))
|
177
|
+
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'should resolve dependencies with package imports' do
|
181
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
182
|
+
Manifest-Version: 1.0
|
183
|
+
Bundle-ManifestVersion: 2
|
184
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
185
|
+
Bundle-Version: 3.9.9.R_20081204
|
186
|
+
Import-Package: my.package
|
187
|
+
MANIFEST
|
188
|
+
foo = define('foo', :version => "1.0", :group => "grp") {
|
189
|
+
package(:bundle)
|
190
|
+
}
|
191
|
+
foo.osgi.registry.containers = @eclipse_instances.dup
|
192
|
+
foo.manifest_dependencies.select {|b| b.name == "com.ibm.icu"}.should_not be_empty
|
193
|
+
end
|
194
|
+
|
195
|
+
it "should resolve projects as dependencies with package imports" do
|
196
|
+
write "foo/META-INF/MANIFEST.MF", <<-MANIFEST
|
197
|
+
Manifest-Version: 1.0
|
198
|
+
Bundle-ManifestVersion: 2
|
199
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
200
|
+
Bundle-Version: 3.9.9.R_20081204
|
201
|
+
Import-Package: my.very.own.package
|
202
|
+
MANIFEST
|
203
|
+
write "bar/META-INF/MANIFEST.MF", <<-MANIFEST
|
204
|
+
Manifest-Version: 1.0
|
205
|
+
Bundle-ManifestVersion: 2
|
206
|
+
Bundle-SymbolicName: bar
|
207
|
+
Export-Package: my.very.own.package
|
208
|
+
MANIFEST
|
209
|
+
write "bar2/META-INF/MANIFEST.MF", <<-MANIFEST
|
210
|
+
Manifest-Version: 1.0
|
211
|
+
Bundle-ManifestVersion: 2
|
212
|
+
Bundle-SymbolicName: bar2
|
213
|
+
Export-Package: my.very.own.packageuh
|
214
|
+
MANIFEST
|
215
|
+
define('container') do
|
216
|
+
project.version = "1.1"
|
217
|
+
|
218
|
+
define('foo') do
|
219
|
+
package(:bundle)
|
220
|
+
end
|
221
|
+
define('bar') do
|
222
|
+
package(:bundle)
|
223
|
+
end
|
224
|
+
define('bar2') do
|
225
|
+
package(:bundle)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
project('container').osgi.registry.containers = @eclipse_instances.dup
|
229
|
+
project('container:foo').manifest_dependencies.should include(project('container:bar'))
|
230
|
+
project('container:foo').manifest_dependencies.should_not include(project('container:bar2'))
|
231
|
+
end
|
232
|
+
|
233
|
+
it 'should resolve dependencies with package imports with version requirements' do
|
234
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
235
|
+
Manifest-Version: 1.0
|
236
|
+
Bundle-ManifestVersion: 2
|
237
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
238
|
+
Bundle-Version: 3.9.9.R_20081204
|
239
|
+
Import-Package: my.package;version="0.9.0"
|
240
|
+
MANIFEST
|
241
|
+
foo = define('foo', :version => "1.0", :group => "grp") {
|
242
|
+
package(:bundle)
|
243
|
+
}
|
244
|
+
foo.osgi.registry.containers = @eclipse_instances.dup
|
245
|
+
foo.manifest_dependencies.select {|b| b.name == "com.ibm.icu"}.should_not be_empty
|
246
|
+
end
|
247
|
+
|
248
|
+
it "should resolve projects as dependencies with package imports" do
|
249
|
+
write "foo/META-INF/MANIFEST.MF", <<-MANIFEST
|
250
|
+
Manifest-Version: 1.0
|
251
|
+
Bundle-ManifestVersion: 2
|
252
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
253
|
+
Bundle-Version: 3.9.9.R_20081204
|
254
|
+
Import-Package: my.very.own.package;version="0.9.0"
|
255
|
+
MANIFEST
|
256
|
+
write "bar/META-INF/MANIFEST.MF", <<-MANIFEST
|
257
|
+
Manifest-Version: 1.0
|
258
|
+
Bundle-ManifestVersion: 2
|
259
|
+
Bundle-SymbolicName: bar
|
260
|
+
Export-Package: my.very.own.package;version="1.0.0"
|
261
|
+
MANIFEST
|
262
|
+
write "bar2/META-INF/MANIFEST.MF", <<-MANIFEST
|
263
|
+
Manifest-Version: 1.0
|
264
|
+
Bundle-ManifestVersion: 2
|
265
|
+
Bundle-SymbolicName: bar2
|
266
|
+
Export-Package: my.very.own.package;version="0.5.0"
|
267
|
+
MANIFEST
|
268
|
+
define('container') do
|
269
|
+
project.version = "1.1"
|
270
|
+
|
271
|
+
define('foo') do
|
272
|
+
package(:bundle)
|
273
|
+
end
|
274
|
+
define('bar') do
|
275
|
+
package(:bundle)
|
276
|
+
end
|
277
|
+
define('bar2') do
|
278
|
+
package(:bundle)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
project('container').osgi.registry.containers = @eclipse_instances.dup
|
282
|
+
project('container:foo').manifest_dependencies.should include(project('container:bar'))
|
283
|
+
project('container:foo').manifest_dependencies.should_not include(project('container:bar2'))
|
284
|
+
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'should write a file named dependencies.yml with the dependencies of the project' do
|
288
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
289
|
+
Manifest-Version: 1.0
|
290
|
+
Bundle-ManifestVersion: 2
|
291
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
292
|
+
Bundle-Version: 3.9.9.R_20081204
|
293
|
+
Require-Bundle: com.ibm.icu;bundle-version="[3.3.0,4.0.0)",org.dude;bundle-version=3.5.0.R_20090512
|
294
|
+
MANIFEST
|
295
|
+
foo = define('foo', :version => "1.0", :group => "grp") {
|
296
|
+
package(:bundle)
|
297
|
+
}
|
298
|
+
foo.osgi.registry.containers = @eclipse_instances.dup
|
299
|
+
foo.task('osgi:resolve:dependencies').invoke
|
300
|
+
File.exist?('dependencies.yml').should be_true
|
301
|
+
deps = YAML::load(File.read('dependencies.yml'))
|
302
|
+
deps["foo"]["dependencies"].size.should == 2
|
303
|
+
artifact(deps["foo"]["dependencies"][0]).to_hash[:id].should == "com.ibm.icu"
|
304
|
+
artifact(deps["foo"]["dependencies"][0]).to_hash[:version].should == "3.9.9.R_20081204"
|
305
|
+
end
|
306
|
+
|
307
|
+
it 'should write a file named dependencies.yml with the projects required for the project' do
|
308
|
+
write "foo/META-INF/MANIFEST.MF", <<-MANIFEST
|
309
|
+
Manifest-Version: 1.0
|
310
|
+
Bundle-ManifestVersion: 2
|
311
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
312
|
+
Bundle-Version: 3.9.9.R_20081204
|
313
|
+
Require-Bundle: bar
|
314
|
+
MANIFEST
|
315
|
+
write "bar/META-INF/MANIFEST.MF", <<-MANIFEST
|
316
|
+
Manifest-Version: 1.0
|
317
|
+
Bundle-ManifestVersion: 2
|
318
|
+
Bundle-SymbolicName: bar
|
319
|
+
Bundle-Version: 3.9.9.R_20081204
|
320
|
+
Require-Bundle: com.ibm.icu;bundle-version="[3.3.0,4.0.0)",org.dude;bundle-version=3.5.0.R_20090512
|
321
|
+
MANIFEST
|
322
|
+
define("container") do
|
323
|
+
project.version = "1.0"
|
324
|
+
project.group = "grp"
|
325
|
+
foo = define('foo') {
|
326
|
+
package(:bundle)
|
327
|
+
}
|
328
|
+
bar = define("bar") do
|
329
|
+
package(:bundle)
|
330
|
+
end
|
331
|
+
end
|
332
|
+
project('container').osgi.registry.containers = @eclipse_instances.dup
|
333
|
+
project('container').task('osgi:resolve:dependencies').invoke
|
334
|
+
File.exist?('dependencies.yml').should be_true
|
335
|
+
deps = YAML::load(File.read('dependencies.yml'))
|
336
|
+
deps["container:foo"]["projects"].size.should == 1
|
337
|
+
end
|
338
|
+
|
339
|
+
it 'should write a file named dependencies.yml with the projects required for the project' do
|
340
|
+
write "foo/META-INF/MANIFEST.MF", <<-MANIFEST
|
341
|
+
Manifest-Version: 1.0
|
342
|
+
Bundle-ManifestVersion: 2
|
343
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
344
|
+
Bundle-Version: 3.9.9.R_20081204
|
345
|
+
Require-Bundle: bar
|
346
|
+
MANIFEST
|
347
|
+
write "bar/META-INF/MANIFEST.MF", <<-MANIFEST
|
348
|
+
Manifest-Version: 1.0
|
349
|
+
Bundle-ManifestVersion: 2
|
350
|
+
Bundle-SymbolicName: bar
|
351
|
+
Bundle-Version: 3.9.9.R_20081204
|
352
|
+
Require-Bundle: com.ibm.icu;bundle-version="[3.3.0,4.0.0)",org.dude;bundle-version=3.5.0.R_20090512
|
353
|
+
MANIFEST
|
354
|
+
define("container") do
|
355
|
+
project.version = "1.0"
|
356
|
+
project.group = "grp"
|
357
|
+
foo = define('foo') {
|
358
|
+
package(:bundle)
|
359
|
+
}
|
360
|
+
bar = define("bar") do
|
361
|
+
package(:bundle)
|
362
|
+
end
|
363
|
+
end
|
364
|
+
project('container').osgi.registry.containers = @eclipse_instances.dup
|
365
|
+
project('container').task('osgi:resolve:dependencies').invoke
|
366
|
+
File.exist?('dependencies.yml').should be_true
|
367
|
+
deps = YAML::load(File.read('dependencies.yml'))
|
368
|
+
deps["container:foo"]["projects"].size.should == 1
|
369
|
+
end
|
370
|
+
|
371
|
+
it 'should write a file named dependencies.yml and merge it as needed' do
|
372
|
+
write "foo/META-INF/MANIFEST.MF", <<-MANIFEST
|
373
|
+
Manifest-Version: 1.0
|
374
|
+
Bundle-ManifestVersion: 2
|
375
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
376
|
+
Bundle-Version: 3.9.9.R_20081204
|
377
|
+
Require-Bundle: bar
|
378
|
+
MANIFEST
|
379
|
+
write "bar/META-INF/MANIFEST.MF", <<-MANIFEST
|
380
|
+
Manifest-Version: 1.0
|
381
|
+
Bundle-ManifestVersion: 2
|
382
|
+
Bundle-SymbolicName: bar
|
383
|
+
Bundle-Version: 3.9.9.R_20081204
|
384
|
+
Require-Bundle: com.ibm.icu;bundle-version="[3.3.0,4.0.0)",org.dude;bundle-version=3.5.0.R_20090512
|
385
|
+
MANIFEST
|
386
|
+
define("container") do
|
387
|
+
project.version = "1.0"
|
388
|
+
project.group = "grp"
|
389
|
+
foo = define('foo') {
|
390
|
+
package(:bundle)
|
391
|
+
}
|
392
|
+
bar = define("bar") do
|
393
|
+
package(:bundle)
|
394
|
+
end
|
395
|
+
end
|
396
|
+
project('container').osgi.registry.containers = @eclipse_instances.dup
|
397
|
+
project('container:foo').task('osgi:resolve:dependencies').invoke
|
398
|
+
project('container:bar').task('osgi:resolve:dependencies').invoke
|
399
|
+
File.exist?('dependencies.yml').should be_true
|
400
|
+
deps = YAML::load(File.read('dependencies.yml'))
|
401
|
+
deps["container:foo"]["projects"].size.should == 1
|
402
|
+
deps["container:bar"]["dependencies"].size.should == 2
|
403
|
+
end
|
404
|
+
|
405
|
+
it "should sort projects by name" do
|
406
|
+
define("container") do
|
407
|
+
project.version = "1"
|
408
|
+
project.group = "grp"
|
409
|
+
define('a'){
|
410
|
+
package(:bundle)
|
411
|
+
}
|
412
|
+
define('b'){
|
413
|
+
package(:bundle)
|
414
|
+
}
|
415
|
+
define('c'){
|
416
|
+
package(:bundle)
|
417
|
+
}
|
418
|
+
define('d'){
|
419
|
+
package(:bundle)
|
420
|
+
}
|
421
|
+
define('e'){
|
422
|
+
package(:bundle)
|
423
|
+
}
|
424
|
+
end
|
425
|
+
project('container').osgi.registry.containers = @eclipse_instances.dup
|
426
|
+
project('container').task('osgi:resolve:dependencies').invoke
|
427
|
+
File.exist?('dependencies.yml').should be_true
|
428
|
+
File.read('dependencies.yml').should == <<-CONTENTS
|
429
|
+
---
|
430
|
+
container:
|
431
|
+
dependencies: []
|
432
|
+
|
433
|
+
projects: []
|
434
|
+
|
435
|
+
container:a:
|
436
|
+
dependencies: []
|
437
|
+
|
438
|
+
projects: []
|
439
|
+
|
440
|
+
container:b:
|
441
|
+
dependencies: []
|
442
|
+
|
443
|
+
projects: []
|
444
|
+
|
445
|
+
container:c:
|
446
|
+
dependencies: []
|
447
|
+
|
448
|
+
projects: []
|
449
|
+
|
450
|
+
container:d:
|
451
|
+
dependencies: []
|
452
|
+
|
453
|
+
projects: []
|
454
|
+
|
455
|
+
container:e:
|
456
|
+
dependencies: []
|
457
|
+
|
458
|
+
projects: []
|
459
|
+
|
460
|
+
CONTENTS
|
461
|
+
end
|
462
|
+
|
463
|
+
it 'should give a version to the dependency even if none is specified' do
|
464
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
465
|
+
Manifest-Version: 1.0
|
466
|
+
Bundle-ManifestVersion: 2
|
467
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
468
|
+
Bundle-Version: 3.9.9.R_20081204
|
469
|
+
Require-Bundle: com.ibm.icu;bundle-version="[3.3.0,4.0.0)",org.dude
|
470
|
+
MANIFEST
|
471
|
+
foo = define('foo', :version => "1.0", :group => "grp") {
|
472
|
+
package(:bundle)
|
473
|
+
}
|
474
|
+
foo.osgi.registry.containers = @eclipse_instances.dup
|
475
|
+
foo.task('osgi:resolve:dependencies').invoke
|
476
|
+
File.exist?('dependencies.yml').should be_true
|
477
|
+
deps = YAML::load(File.read('dependencies.yml'))
|
478
|
+
deps["foo"]["dependencies"].size.should == 2 # there should be 2 dependencies
|
479
|
+
artifact(deps["foo"]["dependencies"][1]).to_hash[:id].should == "org.dude"
|
480
|
+
artifact(deps["foo"]["dependencies"][1]).to_hash[:version].should == "3.5.0.R_20090512"
|
481
|
+
end
|
482
|
+
|
483
|
+
it 'should pick a bundle when several match' do
|
484
|
+
e2 = createRepository("eclipse2")
|
485
|
+
Buildr::write e2 + "/plugins/org.eclipse.core.resources-3.5.0.R_20090512/META-INF/MANIFEST.MF", <<-MANIFEST
|
486
|
+
Manifest-Version: 1.0
|
487
|
+
Bundle-ManifestVersion: 2
|
488
|
+
Bundle-SymbolicName: org.eclipse.core.resources; singleton:=true
|
489
|
+
Bundle-Version: 3.5.0.R_20090512
|
490
|
+
MANIFEST
|
491
|
+
Buildr::write e2 + "/plugins/org.eclipse.core.resources-3.5.1.R_20090512/META-INF/MANIFEST.MF", <<-MANIFEST
|
492
|
+
Manifest-Version: 1.0
|
493
|
+
Bundle-ManifestVersion: 2
|
494
|
+
Bundle-SymbolicName: org.eclipse.core.resources; singleton:=true
|
495
|
+
Bundle-Version: 3.5.1.R_20090512
|
496
|
+
MANIFEST
|
497
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
498
|
+
Manifest-Version: 1.0
|
499
|
+
Bundle-ManifestVersion: 2
|
500
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
501
|
+
Bundle-Version: 3.9.9.R_20081204
|
502
|
+
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.3.0,3.5.2)"
|
503
|
+
MANIFEST
|
504
|
+
foo = define('foo', :version => "1.0", :group => "grp") {
|
505
|
+
package(:bundle)
|
506
|
+
}
|
507
|
+
foo.osgi.registry.containers = [e2]
|
508
|
+
foo.task('osgi:resolve:dependencies').invoke
|
509
|
+
File.exist?('dependencies.yml').should be_true
|
510
|
+
deps = YAML::load(File.read('dependencies.yml'))
|
511
|
+
deps["foo"]["dependencies"].size.should == 1
|
512
|
+
artifact(deps["foo"]["dependencies"][0].to_s).to_hash[:id].should == "org.eclipse.core.resources"
|
513
|
+
artifact(deps["foo"]["dependencies"][0]).to_hash[:version].should == "3.5.1.R_20090512"
|
514
|
+
end
|
515
|
+
|
516
|
+
it 'should resolve transitively all the jars needed' do
|
517
|
+
e2 = createRepository("eclipse2")
|
518
|
+
Buildr::write e2 + "/plugins/org.eclipse.core.resources-3.5.0.R_20090512/META-INF/MANIFEST.MF", <<-MANIFEST
|
519
|
+
Manifest-Version: 1.0
|
520
|
+
Bundle-ManifestVersion: 2
|
521
|
+
Bundle-SymbolicName: org.eclipse.core.resources2; singleton:=true
|
522
|
+
Bundle-Version: 3.5.0.R_20090512
|
523
|
+
MANIFEST
|
524
|
+
Buildr::write e2 + "/plugins/org.eclipse.core.resources-3.5.1.R_20090512/META-INF/MANIFEST.MF", <<-MANIFEST
|
525
|
+
Manifest-Version: 1.0
|
526
|
+
Bundle-ManifestVersion: 2
|
527
|
+
Require-Bundle: org.eclipse.core.resources2
|
528
|
+
Bundle-SymbolicName: org.eclipse.core.resources; singleton:=true
|
529
|
+
Bundle-Version: 3.5.1.R_20090512
|
530
|
+
MANIFEST
|
531
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
532
|
+
Manifest-Version: 1.0
|
533
|
+
Bundle-ManifestVersion: 2
|
534
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
535
|
+
Bundle-Version: 3.9.9.R_20081204
|
536
|
+
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.3.0,3.5.2)"
|
537
|
+
MANIFEST
|
538
|
+
foo = define('foo', :version => "1.0", :group => "grp") {
|
539
|
+
package(:bundle)
|
540
|
+
}
|
541
|
+
foo.osgi.registry.containers = [e2]
|
542
|
+
foo.task('osgi:resolve:dependencies').invoke
|
543
|
+
File.exist?('dependencies.yml').should be_true
|
544
|
+
deps = YAML::load(File.read('dependencies.yml'))
|
545
|
+
|
546
|
+
deps["foo"]["dependencies"].size.should == 2
|
547
|
+
end
|
548
|
+
|
549
|
+
end
|
550
|
+
|
551
|
+
describe OSGi::InstallTask do
|
552
|
+
before :all do
|
553
|
+
e1 = createRepository("eclipse1")
|
554
|
+
@eclipse_instances = [e1]
|
555
|
+
mkpath e1 + "/plugins"
|
556
|
+
debug_ui = artifact("eclipse:org.eclipse.debug.ui:jar:3.4.1.v20080811_r341")
|
557
|
+
debug_ui.invoke # download it from our fake remote repository
|
558
|
+
cp debug_ui.to_s, (e1 + "/plugins/org.eclipse.debug.ui-3.4.1.v20080811_r341.jar")
|
559
|
+
Buildr::write e1 + "/plugins/org.eclipse.core.resources-3.5.1.R_20090512/META-INF/MANIFEST.MF", <<-MANIFEST
|
560
|
+
Manifest-Version: 1.0
|
561
|
+
Bundle-ManifestVersion: 2
|
562
|
+
Require-Bundle: org.eclipse.core.resources2
|
563
|
+
Bundle-SymbolicName: org.eclipse.core.resources; singleton:=true
|
564
|
+
Bundle-Version: 3.5.1.R_20090512
|
565
|
+
MANIFEST
|
566
|
+
cp_r File.join(File.dirname(__FILE__), "plugins", "org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800"), e1 + "/plugins"
|
567
|
+
end
|
568
|
+
|
569
|
+
it 'should install the dependencies into the local Maven repository' do
|
570
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
571
|
+
Manifest-Version: 1.0
|
572
|
+
Bundle-ManifestVersion: 2
|
573
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
574
|
+
Bundle-Version: 3.9.9.R_20081204
|
575
|
+
Require-Bundle: org.eclipse.debug.ui
|
576
|
+
MANIFEST
|
577
|
+
foo = define('foo', :version => "1.0", :group => "grp") {
|
578
|
+
package(:bundle)
|
579
|
+
}
|
580
|
+
foo.osgi.registry.containers = @eclipse_instances.dup
|
581
|
+
foo.dependencies
|
582
|
+
foo.task('osgi:install:dependencies').invoke
|
583
|
+
File.exist?(artifact("osgi:org.eclipse.debug.ui:jar:3.4.1.v20080811_r341").to_s).should be_true
|
584
|
+
|
585
|
+
end
|
586
|
+
|
587
|
+
it 'should jar up OSGi bundles represented as directories' do
|
588
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
589
|
+
Manifest-Version: 1.0
|
590
|
+
Bundle-ManifestVersion: 2
|
591
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
592
|
+
Bundle-Version: 3.9.9.R_20081204
|
593
|
+
Require-Bundle: org.eclipse.debug.ui,
|
594
|
+
org.eclipse.core.resources;bundle-version=3.5.1.R_20090512,
|
595
|
+
org.eclipse.core.runtime.compatibility.registry
|
596
|
+
MANIFEST
|
597
|
+
foo = define('foo', :version => "1.0", :group => "grp") do package(:bundle) end
|
598
|
+
foo.osgi.registry.containers = @eclipse_instances.dup
|
599
|
+
|
600
|
+
foo.task('osgi:resolve:dependencies').invoke
|
601
|
+
foo.task('osgi:install:dependencies').invoke
|
602
|
+
File.exist?(artifact("osgi:org.eclipse.core.resources:jar:3.5.1.R_20090512").to_s).should be_true
|
603
|
+
Zip::ZipFile.open(artifact("osgi:org.eclipse.core.resources:jar:3.5.1.R_20090512").to_s) {|zip|
|
604
|
+
zip.entries.empty?.should_not be_true
|
605
|
+
}
|
606
|
+
File.exist?(artifact("osgi:org.eclipse.core.runtime.compatibility.registry:jar:3.2.200.v20090429-1800").to_s).should be_true
|
607
|
+
|
608
|
+
Zip::ZipFile.open(artifact("osgi:org.eclipse.core.runtime.compatibility.registry:jar:3.2.200.v20090429-1800").to_s) {|zip|
|
609
|
+
|
610
|
+
zip.entries.empty?.should_not be_true
|
611
|
+
}
|
612
|
+
end
|
613
|
+
|
614
|
+
it 'should upload dependencies to the releasing repository' do
|
615
|
+
write "META-INF/MANIFEST.MF", <<-MANIFEST
|
616
|
+
Manifest-Version: 1.0
|
617
|
+
Bundle-ManifestVersion: 2
|
618
|
+
Bundle-SymbolicName: org.osgi.something; singleton:=true
|
619
|
+
Bundle-Version: 3.9.9.R_20081204
|
620
|
+
Require-Bundle: org.eclipse.debug.ui,org.eclipse.core.resources
|
621
|
+
MANIFEST
|
622
|
+
foo = define('foo', :version => "1.0", :group => "grp") {
|
623
|
+
package(:bundle)
|
624
|
+
}
|
625
|
+
foo.osgi.registry.containers = @eclipse_instances.dup
|
626
|
+
repositories.release_to = 'sftp://example.com/base'
|
627
|
+
|
628
|
+
foo.task('osgi:resolve:dependencies').invoke
|
629
|
+
URI.should_receive(:upload).once.
|
630
|
+
with(URI.parse('sftp://example.com/base/osgi/org.eclipse.debug.ui/3.4.1.v20080811_r341/org.eclipse.debug.ui-3.4.1.v20080811_r341.jar'),
|
631
|
+
artifact("osgi:org.eclipse.debug.ui:jar:3.4.1.v20080811_r341").to_s, anything)
|
632
|
+
URI.should_receive(:upload).once.
|
633
|
+
with(URI.parse('sftp://example.com/base/osgi/org.eclipse.debug.ui/3.4.1.v20080811_r341/org.eclipse.debug.ui-3.4.1.v20080811_r341.pom'),
|
634
|
+
artifact("osgi:org.eclipse.debug.ui:jar:3.4.1.v20080811_r341").pom.to_s, anything)
|
635
|
+
URI.should_receive(:upload).once.
|
636
|
+
with(URI.parse('sftp://example.com/base/osgi/org.eclipse.core.resources/3.5.1.R_20090512/org.eclipse.core.resources-3.5.1.R_20090512.pom'),
|
637
|
+
artifact("osgi:org.eclipse.core.resources:jar:3.5.1.R_20090512").pom.to_s, anything)
|
638
|
+
URI.should_receive(:upload).once.
|
639
|
+
with(URI.parse('sftp://example.com/base/osgi/org.eclipse.core.resources/3.5.1.R_20090512/org.eclipse.core.resources-3.5.1.R_20090512.jar'),
|
640
|
+
artifact("osgi:org.eclipse.core.resources:jar:3.5.1.R_20090512").to_s, anything)
|
641
|
+
|
642
|
+
foo.task('osgi:upload:dependencies').invoke
|
643
|
+
|
644
|
+
|
645
|
+
end
|
646
|
+
|
647
|
+
end
|
648
|
+
|
649
|
+
describe 'osgi:clean:dependencies' do
|
650
|
+
it 'should install a nice and clean dependencies.yml for the project to depend on' do
|
651
|
+
foo = define('foo') {
|
652
|
+
define('bar')
|
653
|
+
define('foobar')
|
654
|
+
}
|
655
|
+
foo.task('osgi:clean:dependencies').invoke
|
656
|
+
File.exist?('dependencies.yml').should be_true
|
657
|
+
deps = YAML::load(File.read('dependencies.yml'))
|
658
|
+
deps["foo"].size.should == 0
|
659
|
+
deps.keys.should include("foo:foobar")
|
660
|
+
deps.keys.should include("foo:bar")
|
661
|
+
end
|
662
|
+
end
|