Module: OSGi::BundleCollector

Included in:
DependenciesTask, InstallTask
Defined in:
lib/buildr4osgi/osgi/project_extension.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bundlesObject

Returns the value of attribute bundles.



21
22
23
# File 'lib/buildr4osgi/osgi/project_extension.rb', line 21

def bundles
  @bundles
end

#project_dependenciesObject

Returns the value of attribute project_dependencies.



21
22
23
# File 'lib/buildr4osgi/osgi/project_extension.rb', line 21

def project_dependencies
  @project_dependencies
end

#projectsObject

Returns the value of attribute projects.



21
22
23
# File 'lib/buildr4osgi/osgi/project_extension.rb', line 21

def projects
  @projects
end

Instance Method Details

#_collect(bundle, project) ⇒ Object

Collects the bundles associated with the bundle



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/buildr4osgi/osgi/project_extension.rb', line 34

def _collect(bundle, project)
  if bundle.is_a?(Bundle)
    bundle = bundle.resolve(project)
    unless bundle.nil?
      if bundle.is_a?(Buildr::Project)
        @projects << bundle
      elsif !(@bundles.include? bundle)
        @bundles << bundle
        @bundles |= bundle.fragments(project)       
        (bundle.bundles + bundle.imports).each {|b|
          _collect(b, project)
        }
      end
    end
  elsif bundle.is_a?(BundlePackage)
    bundle.resolve(project).each {|b| 
      if b.is_a?(Buildr::Project)
        @projects << b
      elsif !(@bundles.include? b)
        @bundles << b
        (b.bundles + b.imports).each {|import|
          _collect(import, project)  
        }
      end
    }
  elsif bundle.is_a?(Buildr::Project)
    @projects << bundle
  end
end

#collect(project) ⇒ Object

Collects the bundles associated with a project. Returns them as a sorted array.



26
27
28
29
30
# File 'lib/buildr4osgi/osgi/project_extension.rb', line 26

def collect(project)
  @bundles = []
  @projects = []
  project.manifest_dependencies().each {|dep| _collect(dep, project)}
end