buildr4osgi 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/buildr4osgi.gemspec +1 -1
  2. data/lib/buildr4osgi/compile/external.rb +7 -5
  3. data/lib/buildr4osgi/eclipse/feature.rb +28 -14
  4. data/lib/buildr4osgi/eclipse/p2.rb +34 -67
  5. data/lib/buildr4osgi/osgi/packaging.rb +141 -15
  6. data/lib/buildr4osgi/osgi/project_extension.rb +27 -7
  7. data/lib/buildr4osgi/osgi/registry.rb +14 -1
  8. data/lib/buildr4osgi/osgi/resolving_strategies.rb +2 -2
  9. data/rakelib/all-in-one.rake +9 -2
  10. data/rakelib/checks.rake +1 -1
  11. data/rakelib/doc.rake +7 -0
  12. data/rakelib/package.rake +1 -1
  13. data/rakelib/release.rake +6 -6
  14. data/rakelib/rspec.rake +6 -3
  15. data/rakelib/setup.rake +14 -2
  16. data/rakelib/stage.rake +11 -5
  17. data/spec/compile/external_spec.rb +1 -1
  18. data/spec/eclipse/feature_spec.rb +64 -6
  19. data/spec/osgi/packaging_spec.rb +75 -1
  20. 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
  21. 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
  22. data/spec/tmp/remote/log4j/log4j/1.2.15/log4j-1.2.15.jar +0 -0
  23. data/spec/tmp/remote/log4j/log4j/1.2.15/log4j-1.2.15.pom +478 -0
  24. data/spec/tmp/remote/org/slf4j/jcl104-over-slf4j/1.5.8/jcl104-over-slf4j-1.5.8-sources.jar +0 -0
  25. data/spec/tmp/remote/org/slf4j/jcl104-over-slf4j/1.5.8/jcl104-over-slf4j-1.5.8.jar +0 -0
  26. data/spec/tmp/remote/org/slf4j/jcl104-over-slf4j/1.5.8/jcl104-over-slf4j-1.5.8.pom +30 -0
  27. data/spec/tmp/remote/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8-sources.jar +0 -0
  28. data/spec/tmp/remote/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar +0 -0
  29. data/spec/tmp/remote/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.pom +101 -0
  30. data/spec/tmp/remote/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8-sources.jar +0 -0
  31. data/spec/tmp/remote/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar +0 -0
  32. data/spec/tmp/remote/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.pom +56 -0
  33. metadata +15 -2
@@ -118,6 +118,23 @@ module OSGi
118
118
  end
119
119
  end
120
120
  end
121
+
122
+ class InstallBundlesTask < Rake::Task #:nodoc:
123
+ attr_accessor :project
124
+ def initialize(*args) #:nodoc:
125
+ super
126
+ enhance do |task|
127
+ puts "Deploy directory: #{OSGi.registry.release_to}/plugins"
128
+ mkpath "#{OSGi.registry.release_to}/plugins"
129
+ project.projects.each do |subp|
130
+ subp.packages.select {|package| package.is_a?(::OSGi::BundlePackaging)}.each do |package|
131
+ puts "Deploying #{subp.artifact(package)} to #{OSGi.registry.release_to}"
132
+ cp(subp.artifact(package).to_s, "#{OSGi.registry.release_to}/plugins")
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
121
138
 
122
139
  class InstallTask < Rake::Task #:nodoc:
123
140
  include BundleCollector
@@ -168,6 +185,7 @@ module OSGi
168
185
  if local
169
186
  artifact = Buildr::artifact(bundle.to_s)
170
187
  installed = Buildr.repositories.locate(artifact)
188
+ rm_r installed
171
189
  mkpath File.dirname(installed)
172
190
  Buildr::artifact(bundle.to_s).from(bundle.file).install
173
191
  info "Installed #{installed}"
@@ -197,6 +215,8 @@ module OSGi
197
215
  Project.local_task('osgi:upload:dependencies') { |name| "Upload dependencies for #{name}" }
198
216
  desc 'Cleans the dependencies.yml file'
199
217
  Project.local_task('osgi:clean:dependencies') {|name| "Clean dependencies for #{name}"}
218
+ desc 'Installs the bundle projects into an OSGi repository'
219
+ Project.local_task('osgi:install:bundles') {|name| "Install bundles for #{name}"}
200
220
  end
201
221
 
202
222
  before_define do |project|
@@ -211,9 +231,11 @@ module OSGi
211
231
 
212
232
  clean = Rake::Task.define_task('osgi:clean:dependencies').enhance do
213
233
  Buildr::write File.join(project.base_dir, "dependencies.yml"),
214
- project.projects.inject({}) {|hash, p| hash.merge({p.name => []})}.merge({project.name => []}).to_yaml
234
+ project.projects.inject({}) {|hash, p| hash.merge({p.name => {}})}.merge({project.name => {}}).to_yaml
215
235
  end
216
- install.project = project
236
+
237
+ install_bundles = InstallBundlesTask.define_task('osgi:install:bundles')
238
+ install_bundles.project = project
217
239
  end
218
240
 
219
241
  #
@@ -239,10 +261,8 @@ module OSGi
239
261
  # Code copied straight from Bundle.fromProject
240
262
  packaging = project.packages.select {|package| package.is_a?(BundlePackaging)}
241
263
  raise "More than one bundle packaging is defined over the project #{project.id}, see BOSGI-16." if packaging.size > 1
242
- return nil if packaging.empty?
243
- m = ::Buildr::Packaging::Java::Manifest.new(File.exists?("META-INF/MANIFEST.MF") ? File.read("META-INF/MANIFEST.MF") : nil)
244
- m.main.merge!(manifest)
245
- m.main.merge!(packaging.first.manifest)
264
+ m = ::Buildr::Packaging::Java::Manifest.new(File.exists?(project.path_to("META-INF/MANIFEST.MF")) ? File.read(project.path_to("META-INF/MANIFEST.MF")) : nil)
265
+ m.main.merge!(packaging.first.manifest) unless packaging.empty?
246
266
  (Manifest.read(m.to_s).first["Bundle-RequiredExecutionEnvironment"] || {}).keys.compact.flatten.collect {|ee| OSGi.options.available_ee[ee]}
247
267
  end
248
268
 
@@ -254,4 +274,4 @@ module Buildr #:nodoc:
254
274
  class Project #:nodoc:
255
275
  include OSGi::ProjectExtension
256
276
  end
257
- end
277
+ end
@@ -45,6 +45,19 @@ module OSGi
45
45
  #
46
46
  class Registry
47
47
 
48
+ def release_to
49
+ unless @release_to
50
+ prefs = Buildr.settings.build
51
+ @release_to = prefs['osgi']['release_to'].strip unless prefs['osgi'].nil? || prefs['osgi']['release_to'].nil?
52
+ @release_to ||= "#{ENV['HOME']}/.m2/osgi"
53
+ end
54
+ @release_to
55
+ end
56
+
57
+ def release_to=(release_to)
58
+ @release_to = release_to
59
+ end
60
+
48
61
  #
49
62
  # Sets the containers of the registry
50
63
  # Raises an exception if containers have been resolved already.
@@ -122,4 +135,4 @@ module OSGi
122
135
  @registry ||= ::OSGi::Registry.new
123
136
  end
124
137
 
125
- end
138
+ end
@@ -32,7 +32,7 @@ module OSGi #:nodoc:
32
32
  puts "This package #{package} is exported by all the bundles present.\n" +
33
33
  "Choose a bundle amongst those presented or press A to select them all:\n" + bundles.sort! {|a, b| a.version <=> b.version }.
34
34
  collect {|b| "\t#{bundles.index(b) +1}. #{b.name} #{b.version}"}.join("\n")
35
- number = gets.chomp
35
+ number = $stdin.gets.chomp
36
36
  begin
37
37
  return bundles if (number == 'A')
38
38
  number = number.to_i
@@ -104,4 +104,4 @@ module OSGi #:nodoc:
104
104
 
105
105
  module_function :latest, :oldest, :prompt
106
106
  end
107
- end
107
+ end
@@ -55,7 +55,7 @@ task "all-in-one" => :gem do
55
55
  # Install Buildr gem and dependencies
56
56
  lambda do
57
57
  puts "Install Buildr gem ..."
58
- sh "bin/jruby", '-S', 'gem', 'install', FileList['../../pkg/*-java.gem'].first, FileList['../../../buildr4osgi*.gem'].first,
58
+ sh "bin/jruby", '-S', 'gem', 'install', FileList['../../pkg/*-java.gem'].first,
59
59
  '--no-rdoc', '--no-ri'
60
60
  puts "[X] Install Buildr gem"
61
61
  end.call
@@ -70,12 +70,19 @@ task "all-in-one" => :gem do
70
70
  lambda do
71
71
  puts "Zipping distribution ..."
72
72
  cd '..'
73
- new_dir = "#{spec.name}-#{spec.version}-#{dir}"
73
+ new_dir = "#{spec.name}-#{spec.version}"
74
74
  mv dir, new_dir
75
75
  zip = "#{new_dir}.zip"
76
76
  rm zip if File.exist? zip
77
77
  sh 'zip', '-q', '-r', zip, new_dir
78
78
  puts "[X] Zipped distribution"
79
+
80
+ puts "Tarring distribution ..."
81
+ tar = "#{new_dir}.tar.gz"
82
+ rm tar if File.exist? tar
83
+ sh 'tar', 'czf', tar, new_dir
84
+ puts "[X] Tarred distribution"
85
+
79
86
  rm_rf new_dir
80
87
  end.call
81
88
 
data/rakelib/checks.rake CHANGED
@@ -18,7 +18,7 @@ desc "Check that source files contain the Apache license"
18
18
  task :license=>FileList["**/*.{rb,rake,java,gemspec,buildfile}", 'Rakefile'] do |task|
19
19
  puts "Checking that files contain the Apache license ... "
20
20
  required = task.prerequisites.select { |fn| File.file?(fn) }
21
- missing = required.reject { |fn|
21
+ missing = required.reject { |fn|
22
22
  comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
23
23
  map { |match| match.compact }.flatten.join("\n")
24
24
  comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
data/rakelib/doc.rake CHANGED
@@ -71,6 +71,13 @@ task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr
71
71
  cp_r '_reports/coverage', '_site'
72
72
  fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
73
73
  cp 'CHANGELOG', '_site'
74
+ open("_site/.htaccess", "w") do |htaccess|
75
+ htaccess << %Q{
76
+ <FilesMatch "CHANGELOG">
77
+ ForceType 'text/plain; charset=UTF-8'
78
+ </FilesMatch>
79
+ }
80
+ end
74
81
  cp 'buildr.pdf', '_site'
75
82
  fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
76
83
  puts 'OK'
data/rakelib/package.rake CHANGED
@@ -67,7 +67,7 @@ task :snapshot=>[:package] do
67
67
  cp FileList['pkg/{*.gem,*.tgz,*.zip}'], '_snapshot/gems'
68
68
  puts "Generating gem index ..."
69
69
  sh 'gem', 'generate_index', '--directory', '_snapshot'
70
- puts "Copying gem and index back to Apache"
70
+ puts "Copying gem and index back to Apache"
71
71
  sh 'rsync', '--progress', '--recursive', '_snapshot/', 'people.apache.org:public_html/buildr/snapshot/'
72
72
  end
73
73
  task(:clobber) { rm_rf '_snapshot' }
data/rakelib/release.rake CHANGED
@@ -66,7 +66,7 @@ task :release do
66
66
  # Create an SVN tag for this release.
67
67
  lambda do
68
68
  info = `svn info` + `git svn info` # Using either svn or git-svn
69
- if url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
69
+ if url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
70
70
  new_url = url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{spec.version}")
71
71
  unless url == new_url
72
72
  sh 'svn', 'copy', url, new_url, '-m', "Release #{spec.version}" do |ok, res|
@@ -83,7 +83,7 @@ task :release do
83
83
 
84
84
 
85
85
  # Update CHANGELOG to next release number.
86
- lambda do
86
+ lambda do
87
87
  next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
88
88
  zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
89
89
  modified = "#{next_version} (Pending)\n\n" + File.read('CHANGELOG')
@@ -92,7 +92,7 @@ task :release do
92
92
  end
93
93
  puts "[X] Updated CHANGELOG and added entry for next release"
94
94
  end.call
95
-
95
+
96
96
 
97
97
  # Update source files to next release number.
98
98
  lambda do
@@ -101,7 +101,7 @@ task :release do
101
101
 
102
102
  ver_file = "lib/#{spec.name}.rb"
103
103
  if File.exist?(ver_file)
104
- modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
104
+ modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
105
105
  File.open ver_file, 'w' do |file|
106
106
  file.write modified
107
107
  end
@@ -110,7 +110,7 @@ task :release do
110
110
 
111
111
  spec_file = "#{spec.name}.gemspec"
112
112
  if File.exist?(spec_file)
113
- modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
113
+ modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
114
114
  File.open spec_file, 'w' do |file|
115
115
  file.write modified
116
116
  end
@@ -118,7 +118,7 @@ task :release do
118
118
  end
119
119
  end.call
120
120
 
121
-
121
+
122
122
  # Prepare release announcement email.
123
123
  lambda do
124
124
  changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
data/rakelib/rspec.rake CHANGED
@@ -20,24 +20,27 @@ begin
20
20
 
21
21
  desc "Run all specs"
22
22
  Spec::Rake::SpecTask.new :spec=>['_reports', :compile] do |task|
23
+ ENV['USE_FSC'] = 'no'
23
24
  task.spec_files = FileList['spec/**/*_spec.rb']
24
25
  task.spec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
25
- task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:_reports/specs.html --backtrace}
26
+ task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:_reports/specs.html --backtrace}
26
27
  task.spec_opts << '--colour' if $stdout.isatty
27
28
  end
28
29
  file('_reports/specs.html') { task(:spec).invoke }
29
30
 
30
31
  desc 'Run all failed examples from previous run'
31
32
  Spec::Rake::SpecTask.new :failed do |task|
33
+ ENV['USE_FSC'] = 'no'
32
34
  task.spec_files = FileList['spec/**/*_spec.rb']
33
- task.spec_opts = %w{--format specdoc --format failing_examples:failed --example failed --backtrace}
35
+ task.spec_opts = %w{--format specdoc --format failing_examples:failed --example failed --backtrace}
34
36
  task.spec_opts << '--colour' if $stdout.isatty
35
37
  end
36
38
 
37
39
  desc 'Run RSpec and generate Spec and coverage reports (slow)'
38
40
  Spec::Rake::SpecTask.new :coverage=>['_reports', :compile] do |task|
41
+ ENV['USE_FSC'] = 'no'
39
42
  task.spec_files = FileList['spec/**/*_spec.rb']
40
- task.spec_opts = %W{--format progress --format failing_examples:failed --format html:_reports/specs.html --backtrace}
43
+ task.spec_opts = %W{--format progress --format failing_examples:failed --format html:_reports/specs.html --backtrace}
41
44
  task.spec_opts << '--colour' if $stdout.isatty
42
45
  task.rcov = true
43
46
  task.rcov_dir = '_reports/coverage'
data/rakelib/setup.rake CHANGED
@@ -35,7 +35,14 @@ def install_gem(name, options = {})
35
35
  args = []
36
36
  args << 'sudo' << 'env' << "JAVA_HOME=#{ENV['JAVA_HOME']}" if sudo_needed? and RAKE_SUDO
37
37
  args << rb_bin << '-S' << 'gem' << 'install' << name
38
- args << '--version' << dep.version_requirements.to_s
38
+
39
+ if (spec.respond_to? :requirement)
40
+ args << '--version' << dep.requirement.to_s
41
+ else
42
+ # Dependency.version_requirements deprecated in rubygems 1.3.6
43
+ args << '--version' << dep.version_requirements.to_s
44
+ end
45
+
39
46
  args << '--source' << options[:source] if options[:source]
40
47
  args << '--source' << 'http://gems.rubyforge.org'
41
48
  args << '--install-dir' << ENV['GEM_HOME'] if ENV['GEM_HOME']
@@ -49,6 +56,11 @@ desc "If you're building from sources, run this task first to setup the necessar
49
56
  task :setup do
50
57
  missing = spec.dependencies.select { |dep| Gem::SourceIndex.from_installed_gems.search(dep).empty? }
51
58
  missing.each do |dep|
52
- install_gem dep.name, :version=>dep.version_requirements
59
+ if (spec.respond_to? :requirement)
60
+ install_gem dep.name, :version=>dep.requirement
61
+ else
62
+ # Dependency.version_requirements deprecated in rubygems 1.3.6
63
+ install_gem dep.name, :version=>dep.version_requirements
64
+ end
53
65
  end
54
66
  end
data/rakelib/stage.rake CHANGED
@@ -23,6 +23,7 @@ rescue LoadError
23
23
  task(:setup) { install_gem 'rubyforge' }
24
24
  end
25
25
 
26
+ gpg_cmd = 'gpg2'
26
27
 
27
28
  task :prepare do |task, args|
28
29
  # Make sure we're doing a release from checked code.
@@ -47,7 +48,12 @@ task :prepare do |task, args|
47
48
  # Need GPG to sign the packages.
48
49
  lambda do
49
50
  args.gpg or fail "Please run with gpg=<argument for gpg --local-user>"
50
- fail "No GPG user #{args.gpg}" if `gpg2 --list-keys #{args.gpg}`.empty?
51
+ gpg_ok = `gpg2 --list-keys #{args.gpg}`
52
+ if !$?.success?
53
+ gpg_ok = `gpg --list-keys #{args.gpg}`
54
+ gpg_cmd = 'gpg'
55
+ end
56
+ fail "No GPG user #{args.gpg}" if gpg_ok.empty?
51
57
  end.call
52
58
 
53
59
  task(:license).invoke
@@ -73,7 +79,7 @@ task :prepare do |task, args|
73
79
  lambda do
74
80
  puts "[!] Make sure you have admin privileges to make a release on RubyForge"
75
81
  rubyforge = RubyForge.new.configure
76
- rubyforge.login
82
+ rubyforge.login
77
83
  rubyforge.scrape_project(spec.name)
78
84
  end.call
79
85
 
@@ -106,12 +112,12 @@ task :stage=>['setup', 'doc:setup', :clobber, :prepare] do |task, args|
106
112
  task(:package).invoke
107
113
  mkpath '_staged/dist'
108
114
  FileList['pkg/*.{gem,zip,tgz}'].each do |source|
109
- pkg = source.pathmap('_staged/dist/%n%x')
115
+ pkg = source.pathmap('_staged/dist/%n%x')
110
116
  cp source, pkg
111
117
  bytes = File.open(pkg, 'rb') { |file| file.read }
112
118
  File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) << ' ' << File.basename(pkg) }
113
119
  File.open(pkg + '.sha1', 'w') { |file| file.write Digest::SHA1.hexdigest(bytes) << ' ' << File.basename(pkg) }
114
- sh 'gpg2', '--local-user', args.gpg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
120
+ sh gpg_cmd, '--local-user', args.gpg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
115
121
  end
116
122
  cp 'etc/KEYS', '_staged/dist'
117
123
  puts "[X] Created and signed release packages in _staged/dist"
@@ -162,7 +168,7 @@ p>. ("Release signing keys":#{official}/KEYS)
162
168
  sh 'rsync', '--progress', '--recursive', '_staged/', url
163
169
  puts "[X] Uploaded _staged directory to #{url}"
164
170
  end.call
165
-
171
+
166
172
 
167
173
  # Prepare a release vote email. In the distant future this will also send the
168
174
  # email for you and vote on it.
@@ -21,13 +21,13 @@ describe Buildr4OSGi::CompilerSupport::ExternalC do
21
21
  before :all do
22
22
  Buildr::Compiler.compilers.delete Buildr::Compiler::Javac
23
23
  Buildr::Compiler.compilers.delete Buildr4OSGi::CompilerSupport::OSGiC
24
+ raise "ENV['EXTERNAL_COMPILER'] is not defined !" unless ENV['EXTERNAL_COMPILER']
24
25
  end
25
26
 
26
27
  describe "should compile a Java project just in the same way javac does" do
27
28
  javac_spec = File.read(File.join(File.dirname(__FILE__), "..", "..", "buildr", "spec", "java", "compiler_spec.rb"))
28
29
  javac_spec = javac_spec.match(Regexp.escape("require File.join(File.dirname(__FILE__), '../spec_helpers')\n")).post_match
29
30
  javac_spec.gsub!("javac", "externalc")
30
- javac_spec.gsub!("nowarn", "warn:none")
31
31
  eval(javac_spec)
32
32
  end
33
33
 
@@ -241,10 +241,10 @@ describe Buildr4OSGi::FeatureTask, " when running" do
241
241
  f = @foo.package(:feature)
242
242
  f.plugins.clear
243
243
  @bar = define("bar", :version => "1.0.0") do
244
- package(:jar).with :manifest => {"Bundle-SymbolicName" => "bar", "Bundle-Version" => "1.0.0"}
244
+ package(:jar).with :manifest => {"Bundle-SymbolicName" => "bar", "Bundle-Version" => "1.0.0", "Eclipse-BundleShape" => "dir"}
245
245
  end
246
246
  f.plugins.<< DEBUG_UI, :unjarred => true
247
- f.plugins.<< @bar, :unjarred => true
247
+ f.plugins.<< @bar
248
248
  @foo.package(:feature).invoke
249
249
  feature_file = @foo.package(:feature).to_s
250
250
  File.exists?(feature_file).should be_true
@@ -254,6 +254,29 @@ describe Buildr4OSGi::FeatureTask, " when running" do
254
254
  end
255
255
  end
256
256
 
257
+ it "should let the user tell which plugins should be unjarred from the plugin manifests" do
258
+ Buildr::write "bar/META-INF/MANIFEST.MF", <<-MANIFEST
259
+ Bundle-SymbolicName: bar
260
+ Bundle-Version: 1.0.0
261
+ Eclipse-BundleShape: dir
262
+
263
+ MANIFEST
264
+ f = @foo.package(:feature)
265
+ f.plugins.clear
266
+ @bar = define("bar", :version => "1.0.0", :base_dir => "bar") do
267
+ package(:bundle)
268
+ end
269
+ #f.plugins.<< DEBUG_UI, :unjarred => true
270
+ f.plugins.<< @bar
271
+ @foo.package(:feature).invoke
272
+ feature_file = @foo.package(:feature).to_s
273
+ File.exists?(feature_file).should be_true
274
+ Zip::ZipFile.open(feature_file) do |zip|
275
+ #zip.find_entry("eclipse/plugins/org.eclipse.debug.ui_3.4.1.v20080811_r341/META-INF/MANIFEST.MF").should_not be_nil
276
+ zip.find_entry("eclipse/plugins/bar_1.0.0/META-INF/MANIFEST.MF").should_not be_nil
277
+ end
278
+ end
279
+
257
280
  end
258
281
 
259
282
  describe Buildr4OSGi::FeatureTask, " package subprojects" do
@@ -300,7 +323,7 @@ end
300
323
 
301
324
  describe Buildr4OSGi::FeatureTask, "packaged as SDK" do
302
325
 
303
- before do
326
+ it "should create a jar file with the subproject packaged as a folder inside it when unjarred option is set" do
304
327
  Buildr::write "bar/src/main/java/Hello.java", "public class Hello {}"
305
328
  @container = define("container") do
306
329
  project.group = "grp"
@@ -325,9 +348,44 @@ describe Buildr4OSGi::FeatureTask, "packaged as SDK" do
325
348
  {:url => "http://example.com/upup", :name => "My update site in case"}]
326
349
  package(:sources)
327
350
  end
351
+ @foo.package(:sources).invoke
352
+ feature_file = @foo.package(:sources).to_s
353
+ File.exists?(feature_file).should be_true
354
+ Zip::ZipFile.open(feature_file) do |zip|
355
+ zip.find_entry("eclipse/features/foo.sources_1.0.0/feature.xml").should_not be_nil
356
+ zip.find_entry("eclipse/features/foo.sources_1.0.0/feature.properties").should_not be_nil
357
+ zip.find_entry("eclipse/plugins/bar.sources_1.0.0.jar").should be_nil
358
+ zip.find_entry("eclipse/plugins/bar.sources_1.0.0").directory?.should be_true
359
+ zip.find_entry("eclipse/plugins/bar.sources_1.0.0/Hello.java").should_not be_nil
360
+
361
+ end
328
362
  end
329
363
 
330
- it "should create a jar file with the subproject packaged as a jar inside it" do
364
+ 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
365
+ Buildr::write "bar/src/main/java/Hello.java", "public class Hello {}"
366
+ @container = define("container") do
367
+ project.group = "grp"
368
+ @bar = define("bar", :version => "1.0.0") do
369
+ package(:bundle).manifest.merge!({"Eclipse-BundleShape" => "dir"})
370
+ package(:sources)
371
+ end
372
+ end
373
+ @foo = define("foo", :version => "1.0.0") do
374
+
375
+ f = package(:feature)
376
+ f.plugins.<< project("container:bar")
377
+ f.label = "My feature"
378
+ f.provider = "Acme Inc"
379
+ f.description = "The best feature ever"
380
+ f.changesURL = "http://example.com/changes"
381
+ f.license = "The license is too long to explain"
382
+ f.licenseURL = "http://example.com/license"
383
+ f.branding_plugin = "com.musal.ui"
384
+ f.update_sites << {:url => "http://example.com/update", :name => "My update site"}
385
+ f.discovery_sites = [{:url => "http://example.com/update2", :name => "My update site2"},
386
+ {:url => "http://example.com/upup", :name => "My update site in case"}]
387
+ package(:sources)
388
+ end
331
389
  @foo.package(:sources).invoke
332
390
  feature_file = @foo.package(:sources).to_s
333
391
  File.exists?(feature_file).should be_true
@@ -340,14 +398,13 @@ describe Buildr4OSGi::FeatureTask, "packaged as SDK" do
340
398
 
341
399
  end
342
400
  end
343
-
344
-
345
401
  end
346
402
 
347
403
  describe Buildr4OSGi::FeatureTask, "packaged as SDK, detecting the OSGi headers from the original build" do
348
404
 
349
405
  before do
350
406
  Buildr::write "bar/src/main/java/Hello.java", "public class Hello {}"
407
+
351
408
  @container = define("container") do
352
409
  project.group = "grp"
353
410
  @bar = define("bar", :version => "1.0.0") do
@@ -374,6 +431,7 @@ describe Buildr4OSGi::FeatureTask, "packaged as SDK, detecting the OSGi headers
374
431
  end
375
432
 
376
433
  it "should create a jar file with the subproject packaged as a jar inside it" do
434
+ project("container:bar").package(:jar).invoke
377
435
  @foo.package(:sources).invoke
378
436
  feature_file = @foo.package(:sources).to_s
379
437
  File.exists?(feature_file).should be_true