Author: donaldp
Date: Sun Sep 23 00:40:28 2012
New Revision: 1388931
URL: http://svn.apache.org/viewvc?rev=1388931&view=rev
Log:
BUILDR-654 Add the ability to configure the version of BND used by bnd addon.
(Niklaus Giger)
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/addon/buildr/bnd.rb
buildr/trunk/spec/addon/bnd_spec.rb
Modified: buildr/trunk/CHANGELOG
URL:
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1388931&r1=1388930&r2=1388931&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sun Sep 23 00:40:28 2012
@@ -1,4 +1,5 @@
1.4.8 (Pending)
+* Added: BUILDR-654 Add the ability to configure the version of BND used by
bnd addon. (Niklaus Giger)
* Added: Create the git_auto_version addon that automatically specifies a
version for a git project based
on git describe.
* Added: Integrate with Zinc (incremental compilation wrapper for scalac
2.9+)
Modified: buildr/trunk/addon/buildr/bnd.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/addon/buildr/bnd.rb?rev=1388931&r1=1388930&r2=1388931&view=diff
==============================================================================
--- buildr/trunk/addon/buildr/bnd.rb (original)
+++ buildr/trunk/addon/buildr/bnd.rb Sun Sep 23 00:40:28 2012
@@ -16,14 +16,23 @@
module Buildr
module Bnd
class << self
+ @@version = '1.50.0'
+ def version
+ @@version
+ end
+
+ def version=(newVersion)
+ @@version = newVersion
+ end
+
# The specs for requirements
def dependencies
- ["biz.aQute:bnd:jar:0.0.384"]
+ ["biz.aQute:bnd:jar:#{version}"]
end
# Repositories containing the requirements
def remote_repository
- "http://www.aQute.biz/repo"
+ "http://maven.apache.org"
end
def bnd_main(*args)
@@ -102,7 +111,7 @@ module Buildr
f.print params.collect { |k, v| "#{k}=#{v}" }.join("\n")
end
- Buildr::Bnd.bnd_main( "build", "-noeclipse", bnd_filename )
+ Buildr::Bnd.bnd_main( bnd_filename )
begin
Buildr::Bnd.bnd_main( "print", "-verify", filename )
rescue => e
Modified: buildr/trunk/spec/addon/bnd_spec.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/spec/addon/bnd_spec.rb?rev=1388931&r1=1388930&r2=1388931&view=diff
==============================================================================
--- buildr/trunk/spec/addon/bnd_spec.rb (original)
+++ buildr/trunk/spec/addon/bnd_spec.rb Sun Sep 23 00:40:28 2012
@@ -33,6 +33,56 @@ end
describe Buildr::Bnd do
+ describe "project.bnd version (assure backward compatibility)" do
+
+ after do
+ STDERR.puts("backward compatibility: used #{Buildr::Bnd.version}
restoring #{@savedVersion}")
+ Buildr::Bnd.version = @savedVersion
+ end
+
+ before do
+ @savedVersion = Buildr::Bnd.version
+ Buildr::Bnd.version = '0.0.384'
+ write "src/main/java/com/biz/Foo.java", <<SRC
+package com.biz;
+public class Foo {}
+SRC
+ write "bar/src/main/java/com/biz/bar/Bar.java", <<SRC
+package com.biz.bar;
+public class Bar {}
+SRC
+
+ @foo = define "foo" do
+ project.version = "2.1.3"
+ project.group = "mygroup"
+ manifest["Magic-Food"] = "Chocolate"
+ manifest["Magic-Drink"] = "Wine"
+ package(:bundle).tap do |bnd|
+ bnd["Export-Package"] = "com.*"
+ end
+
+ define "bar" do
+ project.version = "2.2"
+ package(:bundle).tap do |bnd|
+ bnd["Magic-Food"] = "Cheese"
+ bnd["Export-Package"] = "com.*"
+ end
+ end
+ end
+ task('package').invoke
+ end
+
+ it "version 0.0.384 does not export the version and wrong
import-package" do
+ open_main_manifest_section do |attribs|
+ attribs['Bundle-Name'].should eql('foo')
+ attribs['Bundle-Version'].should eql('2.1.3')
+ attribs['Bundle-SymbolicName'].should eql('mygroup.foo')
+ attribs['Export-Package'].should eql('com.biz')
+ attribs['Import-Package'].should eql('com.biz')
+ end
+ end
+ end
+
describe "package :bundle" do
describe "with a valid bundle" do
before do
@@ -92,8 +142,8 @@ SRC
attribs['Bundle-Name'].should eql('foo')
attribs['Bundle-Version'].should eql('2.1.3')
attribs['Bundle-SymbolicName'].should eql('mygroup.foo')
- attribs['Export-Package'].should eql('com.biz')
- attribs['Import-Package'].should eql('com.biz')
+ attribs['Export-Package'].should eql('com.biz;version="2.1.3"')
+ attribs['Import-Package'].should be_nil
end
end
@@ -123,8 +173,8 @@ SRC
attribs['Bundle-Name'].should eql('foo:bar')
attribs['Bundle-Version'].should eql('2.2')
attribs['Bundle-SymbolicName'].should eql('mygroup.foo.bar')
- attribs['Export-Package'].should eql('com.biz.bar')
- attribs['Import-Package'].should eql('com.biz.bar')
+ attribs['Export-Package'].should eql('com.biz.bar;version="2.2"')
+ attribs['Import-Package'].should be_nil
end
end
@@ -179,7 +229,7 @@ SRC
it "should generate package with files exported from dependency" do
task('package').invoke
open_main_manifest_section do |attribs|
- attribs['Export-Package'].should eql('org.apache.tools.zip')
+ attribs['Export-Package'].should
eql('org.apache.tools.zip;version="2.1.3"')
end
end
end
@@ -211,7 +261,7 @@ SRC
it "should generate package with files exported from dependency" do
task('package').invoke
open_main_manifest_section do |attribs|
- attribs['Export-Package'].should eql('org.apache.tools.zip')
+ attribs['Export-Package'].should
eql('org.apache.tools.zip;version="2.1.3"')
end
end
end
@@ -235,7 +285,7 @@ SRC
it "should generate package with files exported from dependency" do
task('package').invoke
open_main_manifest_section do |attribs|
- attribs['Export-Package'].should eql('org.apache.tools.zip')
+ attribs['Export-Package'].should
eql('org.apache.tools.zip;version="2.1.3"')
end
end
end
@@ -327,4 +377,5 @@ SRC
Rake::Task.tasks.detect { |task| task.to_s == "bnd:print"
}.comment.should_not be_nil
end
end
+
end
\ No newline at end of file