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
data/buildr4osgi.gemspec CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  Gem::Specification.new do |spec|
18
18
  spec.name = 'buildr4osgi'
19
- spec.version = '0.9.3'
19
+ spec.version = '0.9.4'
20
20
  spec.author = 'Antoine Toulme'
21
21
  spec.email = "atoulme@intalio.com"
22
22
  spec.homepage = "http://buildr.apache.org/"
@@ -32,12 +32,14 @@ module Buildr4OSGi
32
32
  cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty?
33
33
  cmd_args << '-d' << File.expand_path(target)
34
34
  cmd_args += externalc_args
35
- cmd_args += files_from_sources(sources)
35
+ Tempfile.open("external") {|tmp|
36
+ tmp.write files_from_sources(sources).join(' ')
37
+ cmd_args << "@#{tmp.path}"
38
+ }
36
39
  unless Buildr.application.options.dryrun
37
40
  fail "ENV['EXTERNAL_COMPILER'] is not defined" if ENV['EXTERNAL_COMPILER'].nil?
38
- javac_path = "#{ENV['EXTERNAL_COMPILER']}#{File::SEPARATOR}bin#{File::SEPARATOR}java"
39
- ecj_path = File.expand_path(File.join(File.dirname(__FILE__), "ecj-#{Buildr4OSGi::CompilerSupport::OSGiC::CURRENT_JDT_COMPILER}.jar"))
40
- final_args = ([javac_path,"-classpath", ecj_path, "org.eclipse.jdt.internal.compiler.batch.Main"] + cmd_args).join(' ')
41
+ javac_path = File.join(ENV['EXTERNAL_COMPILER'], "bin", "javac")
42
+ final_args = cmd_args.insert(0, javac_path).push('2>&1').join(' ')
41
43
  trace(final_args)
42
44
  info %x[#{final_args}]
43
45
  fail 'Failed to compile, see errors above' unless $?.success?
@@ -49,7 +51,7 @@ module Buildr4OSGi
49
51
  # See arg list here: http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm
50
52
  def externalc_args #:nodoc:
51
53
  args = []
52
- args << '-warn:none' unless options[:warnings]
54
+ args << '-nowarn' unless options[:warnings]
53
55
  args << '-verbose' if Buildr.application.options.trace
54
56
  args << '-g' if options[:debug]
55
57
  args << '-deprecation' if options[:deprecation]
@@ -189,14 +189,18 @@ PROPERTIES
189
189
 
190
190
  artifact = case
191
191
  when plugin.is_a?(String)
192
- Buildr::artifact(plugin)
192
+ if plugin.match /.*:.*:.*/ # is it an artifact string representation ?
193
+ Buildr::artifact(plugin)
194
+ else # treat it as a .jar
195
+ file(plugin)
196
+ end
193
197
  when plugin.is_a?(Buildr::Project)
194
198
  Buildr::artifact(plugin.package(:plugin))
195
199
  else
196
200
  plugin
197
201
  end
198
- info = adapt_plugin(artifact)
199
- info[:unjarred] = @unjarred[plugin][:unjarred] unless @unjarred[plugin].nil?
202
+ info, as_dir = adapt_plugin(artifact)
203
+ info[:unjarred] = as_dir || @unjarred[plugin][:unjarred] unless @unjarred[plugin].nil?
200
204
  resolved_plugins[info] = artifact
201
205
  end
202
206
  end
@@ -211,14 +215,19 @@ PROPERTIES
211
215
  repackage = nil
212
216
  sourceBundle = nil
213
217
  if plugin.is_a? Buildr::Project
218
+ manifest = plugin.package(:plugin).manifest.main
219
+ if File.exists? plugin.path_to("META-INF/MANIFEST.MF")
220
+ manifest = ::Buildr::Packaging::Java::Manifest.parse(File.read(plugin.path_to("META-INF/MANIFEST.MF"))).main.merge(manifest)
221
+ end
214
222
  size = File.size(plugin.package(:plugin).to_s)
215
- name = plugin.package(:plugin).manifest.main["Bundle-SymbolicName"]
216
- version = plugin.package(:plugin).manifest.main["Bundle-Version"]
223
+ name = manifest["Bundle-SymbolicName"]
224
+ version = manifest["Bundle-Version"]
217
225
  group = plugin.group
218
- sourceBundle = plugin.package(:plugin).manifest.main["Eclipse-SourceBundle"]
226
+ sourceBundle = manifest["Eclipse-SourceBundle"]
227
+ as_dir = "dir" == manifest["Eclipse-BundleShape"].strip
219
228
  else
220
229
  plugin.invoke
221
- if !File.exist?(plugin.to_s) and plugin.classifier.to_s == 'sources'
230
+ if !File.exist?(plugin.to_s) && plugin.classifier.to_s == 'sources'
222
231
  #make sure the artifact was downloaded.
223
232
  #if the artifact is for the sources feature and it could not be located,
224
233
  #don't crash. should we put something in the manifest?
@@ -229,6 +238,7 @@ PROPERTIES
229
238
  unless entry.nil?
230
239
  manifest = Manifest.read(zip.read("META-INF/MANIFEST.MF"))
231
240
  sourceBundle = manifest.first["Eclipse-SourceBundle"].keys.first.strip unless manifest.first["Eclipse-SourceBundle"].nil?
241
+ as_dir = "dir" == manifest.first["Eclipse-BundleShape"].keys.first.strip unless manifest.first["Eclipse-BundleShape"].nil?
232
242
  if !manifest.first["Bundle-SymbolicName"].nil?
233
243
  bundle = ::OSGi::Bundle.fromManifest(manifest, plugin.to_s)
234
244
  unless bundle.nil?
@@ -238,10 +248,10 @@ PROPERTIES
238
248
  end
239
249
  end
240
250
  end
241
- group = plugin.to_hash[:group]
251
+ #group = plugin.to_hash[:group]
242
252
  size = File.size(plugin.to_s)
243
253
  end
244
- if plugin.classifier.to_s == 'sources' and (sourceBundle.nil? || name.nil? || version.nil?)
254
+ if plugin.is_a?(Artifact) && plugin.classifier.to_s == 'sources' && (sourceBundle.nil? || name.nil? || version.nil?)
245
255
  # Try, if possible, to get the name and the version from the original binaries then.
246
256
  runtimeArtifact = Buildr::artifact(plugin.to_hash.merge(:classifier => nil, :type => :jar))
247
257
  runtimeManifest = extraPackagedManifest(runtimeArtifact)
@@ -259,8 +269,8 @@ PROPERTIES
259
269
  warn "Could not determine the size of #{plugin}"
260
270
  size ||= 0
261
271
  end
262
- return {:id => name, :group => group, :version => version,
263
- :"download-size" => size, :"install-size" => size, :unpack => false, :manifest => repackage}
272
+ return {:id => name, :version => version,
273
+ :"download-size" => size, :"install-size" => size, :unpack => false, :manifest => repackage}, as_dir
264
274
  end
265
275
 
266
276
  #returns the META-INF/MANIFEST.MF file for something that
@@ -318,16 +328,20 @@ PROPERTIES
318
328
 
319
329
  artifact = case
320
330
  when plugin.is_a?(String)
321
- Buildr::artifact(plugin)
331
+ if plugin.match /.*:.*:.*/ # is it an artifact string representation ?
332
+ Buildr::artifact(plugin)
333
+ else # treat it as a .jar
334
+ file(plugin)
335
+ end
322
336
  when plugin.is_a?(Buildr::Project)
323
337
  Buildr::artifact(plugin.package(:sources))
324
338
  else
325
339
  plugin
326
340
  end
327
341
  artifact = Buildr::artifact(artifact.to_hash.merge(:classifier => "sources")) if artifact.is_a?(Buildr::Artifact)
328
- info = adapt_plugin(artifact)
342
+ info, as_dir = adapt_plugin(artifact)
329
343
  if !info.nil?
330
- info[:unjarred] = @unjarred[plugin][:unjarred] unless @unjarred[plugin].nil?
344
+ info[:unjarred] = as_dir || (!@unjarred[plugin].nil? && @unjarred[plugin][:unjarred])
331
345
  resolved_plugins[info] = artifact
332
346
  end
333
347
  end
@@ -22,7 +22,7 @@ module Buildr4OSGi
22
22
  def package_as_p2_from_site(file_name)
23
23
  task = UpdateSitePublisherTask.define_task(file_name)
24
24
  task.send :associate_with, self
25
- return task
25
+ task
26
26
  end
27
27
 
28
28
  def package_as_p2_from_site_spec(spec)
@@ -32,76 +32,41 @@ module Buildr4OSGi
32
32
  class UpdateSitePublisherTask < ::Buildr::Packaging::Java::JarTask
33
33
 
34
34
  attr_accessor :site
35
- attr_reader :project
36
-
35
+
37
36
  def initialize(*args) #:nodoc:
38
37
  super
39
- enhance do
40
- # Buildr.ant('org.eclipse.equinox.p2.publisher.UpdateSitePublisher') do |ant|
41
- # work_dir = File.join(project.base_dir, "target", "generated", "update-site")
42
- # ant.java :fork => true, :failonerror => true, :classname=>'org.eclipse.equinox.p2.publisher.UpdateSitePublisher' do
43
- # ant.arg :value => "metadataRepository"
44
- # ant.arg :value => work_dir
45
- # ant.arg :value => "artifactRepository"
46
- # ant.arg :value => work_dir
47
- # ant.arg :value => "compress"
48
- # ant.arg :value => "publishArtifacts"
49
- # end
50
- # end
51
- # http://wiki.eclipse.org/Equinox/p2/Publisher
52
- #the p2.installer and the p2.agent don't work. currently debugging with a local eclipse sdk.
53
- # download the app here: "org.eclipse.equinox.p2:installer:3.6M2-linux.gtk.x86:tgz"
54
- # unzip it wherever it is.
55
- # then invoke it on the cmd line `java -jar #{launcherLocation} -application ... -source #{siteLocation}`
56
- #we need to give the ability to define an eclipse home that could be invoked as a replacement to this.
57
- # p2installer = Buildr::artifact("org.eclipse.platform:eclipse-platform:tgz:3.6M3-linux-gtk")
58
- # p2installer.invoke
59
- # p2installerHome = File.join(project.base_dir, "target", "p2installer")
60
- # Buildr::unzip(p2installerHome => p2installer).extract
61
- # p2installerHome = File.join(p2installerHome, "eclipse")
62
-
63
- #add the missing publisher plugin:
64
- # p2publisher = Buildr::artifact("org.eclipse.equinox.p2:org.eclipse.equinox.p2.publisher:jar:1.1.0.v20090831")
65
- # p2publisher.invoke
66
- # cp p2publisher.to_s, File.join(p2installerHome, "plugins/#{p2publisher.id}_#{p2publisher.version}.jar")
38
+
39
+ enhance do |p2_task|
40
+ fail "The p2 task needs to be associated with a site " unless site
41
+ p2_task.enhance [site]
42
+ #add a prerequisite to the list of prerequisites, gives a chance
43
+ #for other prerequisites to be placed before this block is executed.
44
+ p2_task.enhance do
45
+ targetP2Repo = File.join(project.base_dir, "target", "p2repository")
46
+ mkpath targetP2Repo
47
+ Buildr::unzip(targetP2Repo=>project.package(:site).to_s).extract
48
+ eclipseSDK = Buildr::artifact("org.eclipse:eclipse-SDK:zip:3.6M3-win32")
49
+ eclipseSDK.invoke
50
+ Buildr::unzip(File.dirname(eclipseSDK.to_s) => eclipseSDK.to_s).extract
51
+
52
+ launcherPlugin = Dir.glob("#{File.dirname(eclipseSDK.to_s)}/eclipse/plugins/org.eclipse.equinox.launcher_*")[0]
67
53
 
68
- siteWithoutP2 = project.package(:site)
69
- siteWithoutP2.invoke
54
+ cmdline <<-CMD
55
+ java -jar #{launcherPlugin} -application org.eclipse.equinox.p2.publisher.UpdateSitePublisher
56
+ -metadataRepository file:#{targetP2Repo}
57
+ -artifactRepository file:#{targetP2Repo}
58
+ -metadataRepositoryName #{project.name}_#{project.version}
59
+ -artifactRepositoryName #{project.name}_#{project.version}
60
+ -source #{targetP2Repo}
61
+ -configs gtk.linux.x86
62
+ -publishArtifacts
63
+ -clean -consoleLog
64
+ CMD
65
+ info "Invoking P2's metadata generation: #{cmdline}"
66
+ system cmdline
70
67
 
71
- targetDir = File.join(project.base_dir, "target")
72
- targetP2Repo = File.join(project.base_dir, "target", "p2repository");
73
- mkpath targetP2Repo
74
- Buildr::unzip(targetP2Repo=>siteWithoutP2.to_s).extract
75
- eclipseSDK = Buildr::artifact("org.eclipse:eclipse-SDK:zip:3.6M3-win32")
76
- eclipseSDK.invoke
77
- p2installerHome = File.dirname eclipseSDK.to_s#"~/proj/eclipses/eclipse-SDK-3.6M3"
78
- Buildr::unzip( p2installerHome => eclipseSDK.to_s ).extract
79
- p2installerHome += "/eclipse"
80
- launcherPlugin = Dir.glob("#{p2installerHome}/plugins/org.eclipse.equinox.launcher_*")[0]
81
-
82
- application = "org.eclipse.equinox.p2.publisher.UpdateSitePublisher"
83
- #this is where the artifacts are published.
84
- metadataRepository_url = "file:#{targetP2Repo}"
85
- artifactRepository_url = metadataRepository_url
86
- metadataRepository_name = project.id + "_" + project.version
87
- artifactRepository_name = project.id + "_" + project.version
88
- source_absolutePath = targetP2Repo
89
-
90
- cmdline = "java -jar #{launcherPlugin} -application #{application} \
91
- -metadataRepository #{metadataRepository_url} \
92
- -artifactRepository #{artifactRepository_url} \
93
- -metadataRepositoryName #{metadataRepository_name} \
94
- -artifactRepositoryName #{artifactRepository_name} \
95
- -source #{source_absolutePath} \
96
- -configs gtk.linux.x86 \
97
- -publishArtifacts \
98
- -clean -consoleLog"
99
- puts "Invoking P2's metadata generation: #{cmdline}"
100
- result = `#{cmdline}`
101
- puts result
102
-
103
- include targetP2Repo, :as=>"."
104
-
68
+ include targetP2Repo, :as => "."
69
+ end
105
70
  end
106
71
  end
107
72
 
@@ -123,6 +88,8 @@ module Buildr4OSGi
123
88
 
124
89
  private
125
90
 
91
+ attr_reader :project
92
+
126
93
  def associate_with(project)
127
94
  @project = project
128
95
  end
@@ -103,6 +103,23 @@ module OSGi
103
103
  # Artifacts to include under /lib.
104
104
  attr_accessor :libs
105
105
 
106
+ # Calls to this method will make the bundle use
107
+ # the bundle manifest version if defined.
108
+ # An exception will be raised if no manifest file is present or no Bundle-Version is present in it.
109
+ #
110
+ #
111
+ def use_bundle_version
112
+ manifest_location = File.join(@project.base_dir, "META-INF", "MANIFEST.MF")
113
+ if File.exists?(manifest_location)
114
+ read_m = ::Buildr::Packaging::Java::Manifest.parse(File.read(manifest_location)).main
115
+ raise "Cannot use use_bundle_version if no Bundle-Version header is specified in the manifest" if read_m["Bundle-Version"].nil?
116
+ manifest["Bundle-Version"] = read_m["Bundle-Version"]
117
+ else
118
+ raise "Cannot use use_bundle_version if no manifest is present in the project"
119
+ end
120
+ process_qualifier
121
+ end
122
+
106
123
  def initialize(*args) #:nodoc:
107
124
  super
108
125
  @libs = []
@@ -116,6 +133,89 @@ module OSGi
116
133
  end
117
134
  end
118
135
 
136
+ def process_qualifier
137
+ if manifest["Bundle-Version"].match /\.qualifier$/
138
+ manifest["Bundle-Version"] = "#{$~.pre_match}.#{Time.now.strftime("%y%m%d%H%M%S")}"
139
+ end
140
+ end
141
+
142
+ private
143
+
144
+ def associate_with(project)
145
+ @project = project
146
+ end
147
+
148
+ end
149
+
150
+ class RootFilter < Buildr::Filter
151
+
152
+ def pattern_match(file, pattern)
153
+ case
154
+ when pattern.is_a?(Regexp)
155
+ return file.match(pattern)
156
+ when pattern.is_a?(String)
157
+ return File.fnmatch(pattern, file)
158
+ when pattern.is_a?(Proc)
159
+ return pattern.call(file)
160
+ else
161
+ raise "Cannot interpret pattern #{pattern}"
162
+ end
163
+ end
164
+ # :call-seq:
165
+ # run => boolean
166
+ #
167
+ # Runs the filter.
168
+ def run
169
+ sources.each { |source| raise "Source directory #{source} doesn't exist" unless File.exist?(source.to_s) }
170
+ raise 'No target directory specified, where am I going to copy the files to?' if target.nil?
171
+
172
+ copy_map = sources.flatten.map(&:to_s).inject({}) do |map, source|
173
+ files = Util.recursive_with_dot_files(source).
174
+ map { |file| Util.relative_path(file, source) }.
175
+ select { |file| @include.empty? || @include.any? { |pattern| pattern_match(file, pattern) } }.
176
+ reject { |file| @exclude.any? { |pattern| pattern_match(file, pattern) } }
177
+ files.each do |file|
178
+ src, dest = File.expand_path(file, source), File.expand_path(file, target.to_s)
179
+ map[file] = src if !File.exist?(dest) || File.stat(src).mtime >= File.stat(dest).mtime
180
+ end
181
+ map
182
+ end
183
+
184
+ mkpath target.to_s
185
+ return false if copy_map.empty?
186
+
187
+ copy_map.each do |path, source|
188
+ dest = File.expand_path(path, target.to_s)
189
+ if File.directory?(source)
190
+ mkpath dest
191
+ else
192
+ mkpath File.dirname(dest)
193
+ if @mapper.mapper_type
194
+ mapped = @mapper.transform(File.open(source, 'rb') { |file| file.read }, path)
195
+ File.open(dest, 'wb') { |file| file.write mapped }
196
+ else # no mapping
197
+ cp source, dest
198
+ File.chmod(0664, dest)
199
+ end
200
+ end
201
+ end
202
+ touch target.to_s
203
+ true
204
+ end
205
+
206
+ end
207
+
208
+ # A copy/paste of the ResourcesTask specifically modified for the job
209
+ # of including resources located at the root of the project.
210
+ #
211
+ class RootResourcesTask < Buildr::ResourcesTask
212
+
213
+ def initialize(*args) #:nodoc:
214
+ super
215
+ @filter = RootFilter.new
216
+ @filter.using Buildr.settings.profile['filter'] if Hash === Buildr.settings.profile['filter']
217
+ end
218
+
119
219
  end
120
220
 
121
221
  module ActAsOSGiBundle
@@ -131,6 +231,7 @@ module OSGi
131
231
  end
132
232
 
133
233
  def package_as_bundle(file_name)
234
+
134
235
  task = BundleTask.define_task(file_name).tap do |plugin|
135
236
  # Custom resource task to grab everything located at the root of the project
136
237
  # while leaving the user also specify a resources directory, in case we are in face
@@ -138,30 +239,55 @@ module OSGi
138
239
  # This is a bit hacky and not fully respecting the project layout, so we might find some alternative later
139
240
  # to do the job by extending the layout object, and maybe making this resource task available as a subclass
140
241
  # of ResourcesTask.
141
- p_r = ResourcesTask.define_task
142
- p_r.send :associate_with, project, :main
143
- p_r.from("#{project.base_dir}").exclude("**/.*").exclude("**/*.jar").exclude("**/*.java")
144
- p_r.exclude("src/**").exclude("*src").exclude("*src/**").exclude("build.properties")
145
- p_r.exclude("bin").exclude("bin/**")
146
- p_r.exclude("target/**").exclude("target")
242
+ p_r = RootResourcesTask.define_task(:resources_root)
243
+ p_r.send :associate_with, self, :root
244
+ p_r.filter.from(base_dir).exclude(/^\..*/).exclude("*.jar").exclude("*.java").exclude("build.properties")
245
+ p_r.exclude(lambda {|file|
246
+ binaries_base_folder = project.compile.target.to_s.match(Regexp.escape(project.base_dir + File::SEPARATOR)) ? $~.post_match : project.compile.target.to_s
247
+ file.match(Regexp.new(Regexp.escape binaries_base_folder)) || project.compile.sources.detect {|src_folder|
248
+ relative_folder = src_folder.match(Regexp.escape(project.base_dir)) ? $~.post_match : src_folder
249
+ true if file.match(Regexp.new(Regexp.escape(relative_folder.scan(/\w+/).first)))
250
+ }
251
+ })
252
+ p_r.filter.exclude(/target/)
253
+ p_r.filter.exclude(/report/)
147
254
 
255
+ properties = ResourcesTask.define_task(:resources_src)
256
+ properties.send :associate_with, self, :resources_src
148
257
 
149
- properties = ResourcesTask.define_task
150
- properties.send :associate_with, project, :main
151
- properties.from(File.join(project.base_dir, project.layout[:source, :main, :java])).
152
- exclude("**/.*").exclude("**/*.java") if File.exists? File.join(project.base_dir, project.layout[:source, :main, :java])
258
+ unless compile.nil?
259
+ compile.sources.each {|src_folder|
260
+ properties.from(src_folder).exclude(".*").exclude("*.java")
261
+ }
262
+ end
153
263
 
154
264
  manifest_location = File.join(project.base_dir, "META-INF", "MANIFEST.MF")
155
- manifest = project.manifest
265
+ manifest = self.manifest
156
266
  if File.exists?(manifest_location)
157
267
  read_m = ::Buildr::Packaging::Java::Manifest.parse(File.read(manifest_location)).main
158
- manifest = project.manifest.merge(read_m)
268
+ manifest = self.manifest.merge(read_m)
159
269
  end
160
- manifest["Bundle-Version"] = project.version # the version of the bundle packaged is ALWAYS the version of the project.
161
- manifest["Bundle-SymbolicName"] ||= project.name.split(":").last # if it was resetted to nil, we force the id to be added back.
270
+
271
+ manifest["Bundle-Version"] = self.version # the version of the bundle packaged is ALWAYS the version of the project.
272
+ # You can override it later with use_bundle_version
273
+
274
+
275
+ manifest["Bundle-SymbolicName"] ||= self.name.split(":").last # if it was resetted to nil, we force the id to be added back.
276
+
162
277
  plugin.with :manifest=> manifest, :meta_inf=>meta_inf
163
- plugin.with [compile.target, resources.target, p_r.target, properties.target].compact
278
+ unless manifest["Bundle-Classpath"].nil? || compile.target.nil?
279
+ entry = manifest["Bundle-Classpath"].split(",").first
280
+ plugin.path(entry).include compile.target, :as=>'.'
281
+ plugin.path(entry).include properties.target, :as=>'.' unless properties.target.nil?
282
+ plugin.with [resources.target, p_r.target].compact
283
+ else
284
+ plugin.with [compile.target, resources.target, p_r.target, properties.target].compact
285
+ end
286
+
287
+ plugin.process_qualifier
164
288
  end
289
+ task.send :associate_with, self
290
+ task
165
291
  end
166
292
 
167
293
  def package_as_bundle_spec(spec) #:nodoc: