Module: OSGi::ProjectExtension

Includes:
Extension
Included in:
Buildr::Project
Defined in:
lib/buildr4osgi/osgi/project_extension.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#dependencies(&block) ⇒ Object

Reads the dependencies from dependencies.yml and returns the direct dependencies of the project, as well as its project dependencies and their own dependencies. This method is used recursively, so beware of cyclic dependencies.



247
248
249
250
251
# File 'lib/buildr4osgi/osgi/project_extension.rb', line 247

def dependencies(&block)
  deps = ::OSGi::Dependencies.new(project)
  deps.read
  deps.dependencies + deps.projects
end

#execution_environmentsObject

Returns the EE defined in the manifest if present.



260
261
262
263
264
265
266
267
# File 'lib/buildr4osgi/osgi/project_extension.rb', line 260

def execution_environments()   
  # Code copied straight from Bundle.fromProject
  packaging = project.packages.select {|package| package.is_a?(BundlePackaging)}
  raise "More than one bundle packaging is defined over the project #{project.id}, see BOSGI-16." if packaging.size > 1
  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)
  m.main.merge!(packaging.first.manifest) unless packaging.empty? 
  (Manifest.read(m.to_s).first["Bundle-RequiredExecutionEnvironment"] || {}).keys.compact.flatten.collect {|ee| OSGi.options.available_ee[ee]}
end

#manifest_dependenciesObject

returns an array of the dependencies of the plugin, read from the manifest.



254
255
256
257
# File 'lib/buildr4osgi/osgi/project_extension.rb', line 254

def manifest_dependencies()
  as_bundle = Bundle.fromProject(self)
  as_bundle.nil? ? [] : as_bundle.bundles.collect{|b| b.resolve}.compact + as_bundle.imports.collect {|i| i.resolve}.flatten
end