lib/autoproj/autobuild.rb in autoproj-1.6.0.rc6 vs lib/autoproj/autobuild.rb in autoproj-1.6.0
- old
+ new
@@ -107,10 +107,14 @@
else
spec.to_str
end
end
+ # Returns the information about the file that is currently being loaded
+ #
+ # The return value is [source, path], where +source+ is the Source instance
+ # and +path+ is the path of the file w.r.t. the autoproj root directory
def self.current_file
@file_stack.last
end
def self.define(package_type, spec, &block)
@@ -139,11 +143,11 @@
end
def self.import_autobuild_file(source, path)
return if @loaded_autobuild_files.include?(path)
- @file_stack.push([source, File.basename(path)])
+ @file_stack.push([source, File.expand_path(path).gsub(/^#{Regexp.quote(Autoproj.root_dir)}\//, '')])
begin
Kernel.load path
rescue ConfigError => e
raise
rescue Exception => e
@@ -164,14 +168,14 @@
# Common setup for packages
def package_common(package_type, spec, &block) # :nodoc:
package_name = Autoproj.package_name_from_options(spec)
- begin
- Rake::Task[package_name]
- Autoproj.warn "#{package_name} from #{Autoproj.current_file[0]} is overriden by the definition in #{Autoproj.definition_source(package_name)}"
+ if Autobuild::Package[package_name]
+ current_file = Autoproj.current_file[1]
+ old_file = Autoproj.manifest.definition_file(package_name)
+ Autoproj.warn "#{package_name} from #{current_file} is overriden by the definition in #{old_file}"
return
- rescue
end
# Check if this package is ignored
if Autoproj.manifest.ignored?(package_name)
return Autoproj.define(:dummy, spec)