Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/autobuild.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ module Autobuild
require 'autobuild/import/svn'
require 'autobuild/import/archive'
require 'autobuild/import/tar'
require 'autobuild/import/subpackage'

require 'autobuild/package'
require 'autobuild/configurable'
Expand Down
40 changes: 40 additions & 0 deletions lib/autobuild/import/subpackage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module Autobuild
class Subpackage < Importer
def initialize(source, options = {})
@source = source

parent_name = options[:parent]
unless parent_name
raise PackageException,
"Subpackage must provide a parent package."
end

@parent = Autoproj.workspace.manifest.package_definition_by_name(parent_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Autobuild cannot depend on autoproj

unless @parent
raise PackageException,
"Parent package #{parent_name} does not exist."
end

super(options.merge(repository_id: source))
end

# Does nothing, parent will do update
def update(_package, _options = Hash.new)
false
end

# Does nothing, parent will be checked out
def checkout(package, _options = Hash.new)
package.depends_on(@parent.autobuild)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is going to behave as expected, especially with --no-deps...

end

# Does nothing, parent will do snapshot
def snapshot(*)
true
end
end

def self.subpackage(source, options = {})
Subpackage.new(source, options)
end
end