Top Level Namespace
Defined Under Namespace
Modules: Autoproj
Instance Method Summary collapse
-
#autotools_package(name, workspace: Autoproj.workspace) ⇒ Object
Define an autotools package.
-
#catkin_package(name, workspace: Autoproj.workspace) ⇒ Object
Define a package that was originall designed for Catkin.
-
#clear_metapackage(name) ⇒ Object
Removes all the packages currently added from the given metapackage.
-
#cmake_package(name, workspace: Autoproj.workspace) ⇒ Object
Define a cmake package.
- #common_make_based_package_setup(pkg) ⇒ Object
- #common_make_default_test_task(pkg) ⇒ Object
-
#configuration_option(*opts, **kw, &block) ⇒ Object
deprecated
Deprecated.
use Autoproj.config.declare instead
-
#default_packages(*names) ⇒ Object
This can be used only during the load of a package set.
-
#disable_imports_from(_name) ⇒ Object
If used in init.rb, allows to disable automatic imports from specific package sets.
-
#env_add(name, value) ⇒ Object
deprecated
Deprecated.
use Autoproj.env.add instead
-
#env_set(name, value) ⇒ Object
deprecated
Deprecated.
use Autoproj.env.set instead
- #ignore(*paths) ⇒ Object
- #import_package(name, workspace: Autoproj.workspace, &block) ⇒ Object
-
#metapackage(name, *packages) ⇒ Object
Declares a new metapackage, or adds packages to an existing one.
-
#move_package(name, new_dir) ⇒ Object
Moves the given package to a new subdirectory.
-
#not_on(*architectures) ⇒ Object
Declare that the packages declared in the block should not be built in the given operating system.
-
#only_on(*architectures) ⇒ Object
Declare that the packages declared in the block should be built only on the given operating system.
-
#orogen_package(name, workspace: Autoproj.workspace) ⇒ Object
Defines an oroGen package.
- #package(name) ⇒ Object
-
#package_common(package_type, spec, workspace: Autoproj.workspace, &block) ⇒ Object
Common setup for packages.
-
#package_enabled?(name) ⇒ Boolean
Returns true if
name
is a valid package and is included in the build. -
#package_selected?(name) ⇒ Boolean
Returns true if
name
is a valid package and is neither excluded nor ignored from the build. - #python_package(name, workspace: Autoproj.workspace) ⇒ Object
-
#remove_from_default(*names) ⇒ Object
This can be used only during the load of a package set.
- #renamed_package(current_name, old_name, options) ⇒ Object
-
#ruby_package(name, workspace: Autoproj.workspace) ⇒ Object
Defines a Ruby package.
- #ruby_package_default_test_task(pkg) ⇒ Object
-
#setup_package(package_name, workspace: Autoproj.workspace, &block) ⇒ Object
Adds a new setup block to an existing package.
-
#source_package(options, workspace: Autoproj.workspace) ⇒ Object
Defines an import-only package, i.e.
-
#user_config(key) ⇒ Object
deprecated
Deprecated.
use Autoproj.config.get instead
Instance Method Details
#autotools_package(name, workspace: Autoproj.workspace) ⇒ Object
Define an autotools package
Example:
autotools_package 'package_name' do |pkg|
pkg.configureflags << "--enable-llvm"
end
pkg
is an Autobuild::Autotools instance. See the Autobuild API for more information.
298 299 300 301 302 303 304 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 298 def autotools_package(name, workspace: Autoproj.workspace) package_common(:autotools, name, workspace: workspace) do |pkg| pkg.depends_on "autotools" common_make_based_package_setup(pkg) yield(pkg) if block_given? end end |
#catkin_package(name, workspace: Autoproj.workspace) ⇒ Object
Define a package that was originall designed for Catkin
282 283 284 285 286 287 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 282 def catkin_package(name, workspace: Autoproj.workspace) cmake_package(name, workspace: workspace) do |pkg| pkg.use_package_xml = true yield(pkg) if block_given? end end |
#clear_metapackage(name) ⇒ Object
Removes all the packages currently added from the given metapackage
Calling this function will make sure that the given metapackage is now empty.
494 495 496 497 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 494 def (name) = Autoproj.workspace.manifest.(name) .clear end |
#cmake_package(name, workspace: Autoproj.workspace) ⇒ Object
Define a cmake package
Example:
cmake_package 'package_name' do |pkg|
pkg.define "CMAKE_BUILD_TYPE", "Release"
end
pkg
is an Autobuild::CMake instance. See the Autobuild API for more information.
273 274 275 276 277 278 279 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 273 def cmake_package(name, workspace: Autoproj.workspace) package_common(:cmake, name, workspace: workspace) do |pkg| pkg.depends_on "cmake" common_make_based_package_setup(pkg) yield(pkg) if block_given? end end |
#common_make_based_package_setup(pkg) ⇒ Object
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 246 def common_make_based_package_setup(pkg) unless pkg.has_doc? && pkg.doc_dir pkg.with_doc do doc_html = File.join(pkg.builddir, "doc", "html") pkg.doc_dir = doc_html if File.directory?(doc_html) end end unless pkg.test_utility.has_task? pkg.post_import do common_make_default_test_task(pkg) end # BACKWARD COMPATIBILITY ONLY. REMOVE FOR AUTOPROJ 3.0 common_make_default_test_task(pkg) end end |
#common_make_default_test_task(pkg) ⇒ Object
235 236 237 238 239 240 241 242 243 244 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 235 def common_make_default_test_task(pkg) unless pkg.test_utility.source_dir test_dir = File.join(pkg.srcdir, "test") if File.directory?(test_dir) pkg.test_utility.source_dir = File.join(pkg.builddir, "test", "results") end end pkg.with_tests if pkg.test_utility.source_dir end |
#configuration_option(*opts, **kw, &block) ⇒ Object
use Autoproj.config.declare instead
454 455 456 457 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 454 def configuration_option(*opts, **kw, &block) Autoproj.warn_deprecated __method__, "use Autoproj.config.declare instead" Autoproj.config.declare(*opts, **kw, &block) end |
#default_packages(*names) ⇒ Object
This can be used only during the load of a package set
It defines the set of packages that will be built if ‘package_set_name’ is used. By default, all of the package set’s packages are included. After a call to default_packages, only the packages listed (and their dependencies) are.
509 510 511 512 513 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 509 def default_packages(*names) pkg_set = Autoproj.current_package_set (pkg_set.name) (pkg_set.name, *names) end |
#disable_imports_from(_name) ⇒ Object
If used in init.rb, allows to disable automatic imports from specific package sets
482 483 484 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 482 def disable_imports_from(_name) raise NotImplementedError, "not implemented in autoproj v2" end |
#env_add(name, value) ⇒ Object
use Autoproj.env.add instead
313 314 315 316 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 313 def env_add(name, value) Autoproj.warn_deprecated __method__, "use Autoproj.env.add instead" Autoproj.env.add(name, value) end |
#env_set(name, value) ⇒ Object
use Autoproj.env.set instead
307 308 309 310 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 307 def env_set(name, value) Autoproj.warn_deprecated __method__, "use Autoproj.env.set instead" Autoproj.env.set(name, value) end |
#ignore(*paths) ⇒ Object
182 183 184 185 186 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 182 def ignore(*paths) paths.each do |p| Autobuild.ignore(p) end end |
#import_package(name, workspace: Autoproj.workspace, &block) ⇒ Object
221 222 223 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 221 def import_package(name, workspace: Autoproj.workspace, &block) package_common(:import, name, workspace: workspace, &block) end |
#metapackage(name, *packages) ⇒ Object
Declares a new metapackage, or adds packages to an existing one
500 501 502 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 500 def (name, *packages) Autoproj.workspace.manifest.(name, *packages) end |
#move_package(name, new_dir) ⇒ Object
Moves the given package to a new subdirectory
487 488 489 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 487 def move_package(name, new_dir) Autoproj.workspace.manifest.move_package(name, new_dir) end |
#not_on(*architectures) ⇒ Object
Declare that the packages declared in the block should not be built in the given operating system. OS descriptions are space-separated strings containing OS name and version.
An error will occur if the user tries to build it on one of those architectures
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 410 def not_on(*architectures) architectures = architectures.map do |name| if name.respond_to?(:to_str) [name] else name end end os_names, os_versions = Autoproj.workspace. matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) } return yield if matching_archs.empty? matches_arch = matching_archs.all? do |arch| arch[1] && !os_versions.include?(arch[1].downcase) end return yield if matches_arch # Simply get the current list of packages, yield the block, and exclude all # packages that have been added manifest = Autoproj.workspace.manifest current_packages = manifest.each_autobuild_package.map(&:name).to_set yield new_packages = manifest.each_autobuild_package.map(&:name).to_set - current_packages new_packages.each do |pkg_name| manifest.exclude_package( pkg_name, "#{pkg_name} is disabled on this operating system" ) end end |
#only_on(*architectures) ⇒ Object
Declare that the packages declared in the block should be built only on the given operating system. OS descriptions are space-separated strings containing OS name and version.
The block will simply be ignored if run on another architecture
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 384 def only_on(*architectures) architectures = architectures.map do |name| if name.respond_to?(:to_str) [name] else name end end os_names, os_versions = Autoproj.workspace. matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) } return if matching_archs.empty? has_matching_arch = matching_archs.any? do |arch| !arch[1] || os_versions.include?(arch[1].downcase) end yield if has_matching_arch end |
#orogen_package(name, workspace: Autoproj.workspace) ⇒ Object
Defines an oroGen package. By default, autoproj will look for an orogen file called package_basename.orogen if the package is called dir/package_basename
Example:
orogen_package 'package_name' do |pkg|
pkg.orogen_file = "my.orogen"
pkg.corba = false
end
pkg
is an Autobuild::Orogen instance. See the Autobuild API for more information.
372 373 374 375 376 377 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 372 def orogen_package(name, workspace: Autoproj.workspace) package_common(:orogen, name, workspace: workspace) do |pkg| common_make_based_package_setup(pkg) yield(pkg) if block_given? end end |
#package(name) ⇒ Object
465 466 467 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 465 def package(name) Autoproj.workspace.manifest.find_autobuild_package(name) end |
#package_common(package_type, spec, workspace: Autoproj.workspace, &block) ⇒ Object
Common setup for packages
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 205 def package_common(package_type, spec, workspace: Autoproj.workspace, &block) package_name = Autoproj.(spec) if (existing_package = workspace.manifest.find_package_definition(package_name)) current_file = workspace.current_file[1] old_file = existing_package.file Autoproj.warn "#{package_name} from #{current_file} is overridden "\ "by the definition in #{old_file}" return existing_package.autobuild end pkg = workspace.define_package(package_type, spec, block, *workspace.current_file) pkg.autobuild.srcdir = pkg.name pkg end |
#package_enabled?(name) ⇒ Boolean
Returns true if name
is a valid package and is included in the build
476 477 478 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 476 def package_enabled?(name) Autoproj.workspace.manifest.package_enabled?(name, false) end |
#package_selected?(name) ⇒ Boolean
Returns true if name
is a valid package and is neither excluded nor ignored from the build
471 472 473 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 471 def package_selected?(name) Autoproj.workspace.manifest.package_selected?(name, false) end |
#python_package(name, workspace: Autoproj.workspace) ⇒ Object
225 226 227 228 229 230 231 232 233 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 225 def python_package(name, workspace: Autoproj.workspace) package_common(:python, name, workspace: workspace) do |pkg| pkg.internal_dependency "python" pkg.post_import do pkg.depends_on "python-setuptools" if pkg.install_mode? end yield(pkg) if block_given? end end |
#remove_from_default(*names) ⇒ Object
This can be used only during the load of a package set
It removes the given packages from the set of packages that will be built if ‘package_set_name’ is used. By default, all of the package set’s packages are included. After a call to default_packages, only the packages listed (and their dependencies) are.
521 522 523 524 525 526 527 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 521 def remove_from_default(*names) pkg_set = Autoproj.current_package_set = Autoproj.workspace.manifest.(pkg_set.name) names.each do |pkg_name| .remove(pkg_name) end end |
#renamed_package(current_name, old_name, options) ⇒ Object
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 529 def renamed_package(current_name, old_name, ) explicit_selection = Autoproj.workspace.manifest .explicitely_selected_in_layout?(old_name) if [:obsolete] && !explicit_selection import_package old_name Autoproj.workspace.manifest.exclude_package( old_name, "#{old_name} has been renamed to #{current_name}, you still have "\ "the option of using the old name by adding '- #{old_name}' explicitely "\ "in the layout in autoproj/manifest, but be warned that the name will "\ "stop being usable at all in the near future" ) else old_name, current_name end end |
#ruby_package(name, workspace: Autoproj.workspace) ⇒ Object
Defines a Ruby package
Example:
ruby_package 'package_name' do |pkg|
pkg.doc_target = 'doc'
end
pkg
is an Autobuild::Importer instance. See the Autobuild API for more information.
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 340 def ruby_package(name, workspace: Autoproj.workspace) package_common(:ruby, name, workspace: workspace) do |pkg| pkg.prefix = pkg.srcdir # Documentation code. Ignore if the user provided its own documentation # task, or disabled the documentation generation altogether by setting # rake_doc_task to nil pkg.with_doc if !pkg.has_doc? && pkg.rake_doc_task unless pkg.test_utility.has_task? pkg.post_import do ruby_package_default_test_task(pkg) end # BACKWARD COMPATIBILITY ONLY. REMOVE FOR AUTOPROJ 3.0 ruby_package_default_test_task(pkg) end yield(pkg) if block_given? end end |
#ruby_package_default_test_task(pkg) ⇒ Object
318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 318 def ruby_package_default_test_task(pkg) unless pkg.test_utility.source_dir test_dir = File.join(pkg.srcdir, "test") if File.directory?(test_dir) pkg.test_utility.source_dir = File.join(pkg.srcdir, ".test-results") FileUtils.mkdir_p pkg.test_utility.source_dir end end pkg.with_tests if pkg.test_utility.source_dir end |
#setup_package(package_name, workspace: Autoproj.workspace, &block) ⇒ Object
Adds a new setup block to an existing package
189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 189 def setup_package(package_name, workspace: Autoproj.workspace, &block) unless block raise Autoproj::ConfigError.new, "you must give a block to #setup_package" end package_definition = workspace.manifest.find_package_definition(package_name) if !package_definition raise Autoproj::ConfigError.new, "#{package_name} is not a known package" elsif package_definition.autobuild.kind_of?(Autobuild::DummyPackage) # Nothing to do! else package_definition.add_setup_block(block) end end |
#source_package(options, workspace: Autoproj.workspace) ⇒ Object
Defines an import-only package, i.e. a package that is simply checked out but not built in any way
446 447 448 449 450 451 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 446 def source_package(, workspace: Autoproj.workspace) package_common(, workspace: workspace) do |pkg| pkg.srcdir = pkg.name yield(pkg) if block_given? end end |
#user_config(key) ⇒ Object
use Autoproj.config.get instead
460 461 462 463 |
# File 'lib/autoproj/autobuild_extensions/dsl.rb', line 460 def user_config(key) Autoproj.warn_deprecated __method__, "use Autoproj.config.get instead" Autoproj.config.get(key) end |