lib/autoproj/autobuild.rb in autoproj-1.10.2 vs lib/autoproj/autobuild.rb in autoproj-1.11.0.b1
- old
+ new
@@ -240,57 +240,36 @@
else
spec.to_str
end
end
- # Returns the information about the file that is currently being loaded
- #
- # The return value is [package_set, path], where +package_set+ is the
- # PackageSet instance and +path+ is the path of the file w.r.t. the autoproj
- # root directory
+ # @deprecated use Ops.loader.in_package_set or add a proper Loader object to your
+ # class
+ def self.in_package_set(package_set, path, &block)
+ Ops.loader.in_package_set(package_set, path, &block)
+ end
+
+ # @deprecated use Ops.loader.current_file or add a proper Loader object to your
+ # class
def self.current_file
- @file_stack.last
+ Ops.loader.current_file
end
- # The PackageSet object representing the package set that is currently being
- # loaded
+ # @deprecated use Ops.loader.current_package_set or add a proper Loader object to your
+ # class
def self.current_package_set
- current_file.first
+ Ops.loader.current_package_set
end
def self.define(package_type, spec, &block)
package = Autobuild.send(package_type, spec)
Autoproj.manifest.register_package(package, block, *current_file)
package
end
@loaded_autobuild_files = Set.new
- def self.filter_load_exception(error, package_set, path)
- raise error if Autoproj.verbose
- rx_path = Regexp.quote(path)
- if error_line = error.backtrace.find { |l| l =~ /#{rx_path}/ }
- if line_number = Integer(/#{rx_path}:(\d+)/.match(error_line)[1])
- line_number = "#{line_number}:"
- end
- if package_set.local?
- raise ConfigError.new(path), "#{path}:#{line_number} #{error.message}", error.backtrace
- else
- raise ConfigError.new(path), "#{File.basename(path)}(package_set=#{package_set.name}):#{line_number} #{error.message}", error.backtrace
- end
- else
- raise error
- end
- end
-
- def self.in_package_set(package_set, path)
- @file_stack.push([package_set, File.expand_path(path).gsub(/^#{Regexp.quote(Autoproj.root_dir)}\//, '')])
- yield
- ensure
- @file_stack.pop
- end
-
class << self
attr_reader :loaded_autobuild_files
end
def self.import_autobuild_file(package_set, path)
@@ -419,11 +398,11 @@
#
# +pkg+ is an Autobuild::CMake instance. See the Autobuild API for more
# information.
def cmake_package(options, &block)
package_common(:cmake, options) do |pkg|
- Autoproj.add_build_system_dependency 'cmake'
+ pkg.depends_on 'cmake'
yield(pkg) if block_given?
common_make_based_package_setup(pkg)
end
end
@@ -436,10 +415,10 @@
#
# +pkg+ is an Autobuild::Autotools instance. See the Autobuild API for more
# information.
def autotools_package(options, &block)
package_common(:autotools, options) do |pkg|
- Autoproj.add_build_system_dependency 'autotools'
+ pkg.depends_on 'autotools'
yield(pkg) if block_given?
common_make_based_package_setup(pkg)
end
end