spec/eclipse/feature_spec.rb in buildr4osgi-0.9.3 vs spec/eclipse/feature_spec.rb in buildr4osgi-0.9.4
- old
+ new
@@ -239,23 +239,46 @@
it "should let the user tell which plugins should be unjarred" do
f = @foo.package(:feature)
f.plugins.clear
@bar = define("bar", :version => "1.0.0") do
- package(:jar).with :manifest => {"Bundle-SymbolicName" => "bar", "Bundle-Version" => "1.0.0"}
+ package(:jar).with :manifest => {"Bundle-SymbolicName" => "bar", "Bundle-Version" => "1.0.0", "Eclipse-BundleShape" => "dir"}
end
f.plugins.<< DEBUG_UI, :unjarred => true
- f.plugins.<< @bar, :unjarred => true
+ f.plugins.<< @bar
@foo.package(:feature).invoke
feature_file = @foo.package(:feature).to_s
File.exists?(feature_file).should be_true
Zip::ZipFile.open(feature_file) do |zip|
zip.find_entry("eclipse/plugins/org.eclipse.debug.ui_3.4.1.v20080811_r341/META-INF/MANIFEST.MF").should_not be_nil
zip.find_entry("eclipse/plugins/bar_1.0.0/META-INF/MANIFEST.MF").should_not be_nil
end
end
+ it "should let the user tell which plugins should be unjarred from the plugin manifests" do
+ Buildr::write "bar/META-INF/MANIFEST.MF", <<-MANIFEST
+Bundle-SymbolicName: bar
+Bundle-Version: 1.0.0
+Eclipse-BundleShape: dir
+
+MANIFEST
+ f = @foo.package(:feature)
+ f.plugins.clear
+ @bar = define("bar", :version => "1.0.0", :base_dir => "bar") do
+ package(:bundle)
+ end
+ #f.plugins.<< DEBUG_UI, :unjarred => true
+ f.plugins.<< @bar
+ @foo.package(:feature).invoke
+ feature_file = @foo.package(:feature).to_s
+ File.exists?(feature_file).should be_true
+ Zip::ZipFile.open(feature_file) do |zip|
+ #zip.find_entry("eclipse/plugins/org.eclipse.debug.ui_3.4.1.v20080811_r341/META-INF/MANIFEST.MF").should_not be_nil
+ zip.find_entry("eclipse/plugins/bar_1.0.0/META-INF/MANIFEST.MF").should_not be_nil
+ end
+ end
+
end
describe Buildr4OSGi::FeatureTask, " package subprojects" do
before do
@@ -298,11 +321,11 @@
end
describe Buildr4OSGi::FeatureTask, "packaged as SDK" do
- before do
+ it "should create a jar file with the subproject packaged as a folder inside it when unjarred option is set" do
Buildr::write "bar/src/main/java/Hello.java", "public class Hello {}"
@container = define("container") do
project.group = "grp"
@bar = define("bar", :version => "1.0.0") do
package(:bundle)
@@ -323,13 +346,48 @@
f.update_sites << {:url => "http://example.com/update", :name => "My update site"}
f.discovery_sites = [{:url => "http://example.com/update2", :name => "My update site2"},
{:url => "http://example.com/upup", :name => "My update site in case"}]
package(:sources)
end
+ @foo.package(:sources).invoke
+ feature_file = @foo.package(:sources).to_s
+ File.exists?(feature_file).should be_true
+ Zip::ZipFile.open(feature_file) do |zip|
+ zip.find_entry("eclipse/features/foo.sources_1.0.0/feature.xml").should_not be_nil
+ zip.find_entry("eclipse/features/foo.sources_1.0.0/feature.properties").should_not be_nil
+ zip.find_entry("eclipse/plugins/bar.sources_1.0.0.jar").should be_nil
+ zip.find_entry("eclipse/plugins/bar.sources_1.0.0").directory?.should be_true
+ zip.find_entry("eclipse/plugins/bar.sources_1.0.0/Hello.java").should_not be_nil
+
+ end
end
- it "should create a jar file with the subproject packaged as a jar inside it" do
+ it "should create a jar file with the subproject packaged as a folder inside it when the Eclipse-BundleShape entry is set to dir" do
+ Buildr::write "bar/src/main/java/Hello.java", "public class Hello {}"
+ @container = define("container") do
+ project.group = "grp"
+ @bar = define("bar", :version => "1.0.0") do
+ package(:bundle).manifest.merge!({"Eclipse-BundleShape" => "dir"})
+ package(:sources)
+ end
+ end
+ @foo = define("foo", :version => "1.0.0") do
+
+ f = package(:feature)
+ f.plugins.<< project("container:bar")
+ f.label = "My feature"
+ f.provider = "Acme Inc"
+ f.description = "The best feature ever"
+ f.changesURL = "http://example.com/changes"
+ f.license = "The license is too long to explain"
+ f.licenseURL = "http://example.com/license"
+ f.branding_plugin = "com.musal.ui"
+ f.update_sites << {:url => "http://example.com/update", :name => "My update site"}
+ f.discovery_sites = [{:url => "http://example.com/update2", :name => "My update site2"},
+ {:url => "http://example.com/upup", :name => "My update site in case"}]
+ package(:sources)
+ end
@foo.package(:sources).invoke
feature_file = @foo.package(:sources).to_s
File.exists?(feature_file).should be_true
Zip::ZipFile.open(feature_file) do |zip|
zip.find_entry("eclipse/features/foo.sources_1.0.0/feature.xml").should_not be_nil
@@ -338,18 +396,17 @@
zip.find_entry("eclipse/plugins/bar.sources_1.0.0").directory?.should be_true
zip.find_entry("eclipse/plugins/bar.sources_1.0.0/Hello.java").should_not be_nil
end
end
-
-
end
describe Buildr4OSGi::FeatureTask, "packaged as SDK, detecting the OSGi headers from the original build" do
before do
Buildr::write "bar/src/main/java/Hello.java", "public class Hello {}"
+
@container = define("container") do
project.group = "grp"
@bar = define("bar", :version => "1.0.0") do
package(:jar).with :manifest => {"Bundle-SymbolicName" => "myName", "Bundle-Version" => "3.2.1"}
package(:sources)
@@ -372,9 +429,10 @@
package(:sources)
end
end
it "should create a jar file with the subproject packaged as a jar inside it" do
+ project("container:bar").package(:jar).invoke
@foo.package(:sources).invoke
feature_file = @foo.package(:sources).to_s
File.exists?(feature_file).should be_true
Zip::ZipFile.open(feature_file) do |zip|
zip.find_entry("eclipse/features/foo.sources_1.0.0/feature.xml").should_not be_nil
\ No newline at end of file