Class: Autoproj::Ops::Build
- Inherits:
-
Object
- Object
- Autoproj::Ops::Build
- Defined in:
- lib/autoproj/ops/build.rb
Overview
Operations related to building packages
Note that these do not perform import or osdeps installation. It is assumed that the packages that should be built have been cleanly imported
Instance Attribute Summary collapse
-
#manifest ⇒ Manifest
readonly
The manifest on which we operate.
Instance Method Summary collapse
-
#build_packages(all_enabled_packages, options = Hash.new) ⇒ void
Builds the listed packages.
-
#force_build_all ⇒ Object
Triggers a force-build of all packages.
-
#force_build_packages(selected_packages, all_enabled_packages) ⇒ void
Triggers a force-build of a subset of all packages.
-
#initialize(manifest, report_path: nil) ⇒ Build
constructor
A new instance of Build.
- #package_metadata(autobuild_package) ⇒ Object
-
#rebuild_all ⇒ Object
Triggers a rebuild of all packages.
-
#rebuild_packages(selected_packages, all_enabled_packages) ⇒ void
Triggers a rebuild of a subset of all packages.
Constructor Details
#initialize(manifest, report_path: nil) ⇒ Build
Returns a new instance of Build.
16 17 18 19 |
# File 'lib/autoproj/ops/build.rb', line 16 def initialize(manifest, report_path: nil) @manifest = manifest @report_path = report_path end |
Instance Attribute Details
#manifest ⇒ Manifest (readonly)
The manifest on which we operate
12 13 14 |
# File 'lib/autoproj/ops/build.rb', line 12 def manifest @manifest end |
Instance Method Details
#build_packages(all_enabled_packages, options = Hash.new) ⇒ void
This method returns an undefined value.
Builds the listed packages
Only build steps that are actually needed will be performed. See #force_build_packages and #rebuild_packages to override this
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/autoproj/ops/build.rb', line 88 def build_packages(all_enabled_packages, = Hash.new) if @report_path reporting = Ops::PhaseReporting.new( "build", @report_path, method(:package_metadata) ) end Autobuild.do_rebuild = false Autobuild.do_forced_build = false reporting&.initialize_incremental_report begin Autobuild.apply( all_enabled_packages, "autoproj-build", ["build"], ) do |pkg, phase| reporting&.report_incremental(pkg) if phase == "build" end ensure packages = all_enabled_packages.map do |name| @manifest.find_autobuild_package(name) end reporting&.create_report(packages) end end |
#force_build_all ⇒ Object
Triggers a force-build of all packages
Unlike a rebuild, a force-build forces the package to go through all build steps (even if they are not needed) but does not clean the current build byproducts beforehand
53 54 55 56 |
# File 'lib/autoproj/ops/build.rb', line 53 def force_build_all packages = manifest.all_layout_packages rebuild_packages(packages, packages) end |
#force_build_packages(selected_packages, all_enabled_packages) ⇒ void
This method returns an undefined value.
Triggers a force-build of a subset of all packages
Unlike a rebuild, a force-build forces the package to go through all build steps (even if they are not needed) but does not clean the current build byproducts beforehand
This method force-builds of all packages declared in the manifest’s layout
73 74 75 76 77 78 |
# File 'lib/autoproj/ops/build.rb', line 73 def force_build_packages(selected_packages, all_enabled_packages) selected_packages.each do |pkg_name| Autobuild::Package[pkg_name].prepare_for_forced_build end build_packages(all_enabled_packages) end |
#package_metadata(autobuild_package) ⇒ Object
113 114 115 116 117 118 |
# File 'lib/autoproj/ops/build.rb', line 113 def (autobuild_package) { invoked: !!autobuild_package.install_invoked?, success: !!autobuild_package.installed? } end |
#rebuild_all ⇒ Object
Triggers a rebuild of all packages
It rebuilds (i.e. does a clean + build) of all packages declared in the manifest’s layout. It also performs a reinstall of all non-OS-specific managers that support it (e.g. RubyGems) if update_os_packages? is set to true (the default)
27 28 29 30 |
# File 'lib/autoproj/ops/build.rb', line 27 def rebuild_all packages = manifest.all_layout_packages rebuild_packages(packages, packages) end |
#rebuild_packages(selected_packages, all_enabled_packages) ⇒ void
This method returns an undefined value.
Triggers a rebuild of a subset of all packages
40 41 42 43 44 45 |
# File 'lib/autoproj/ops/build.rb', line 40 def rebuild_packages(selected_packages, all_enabled_packages) selected_packages.each do |pkg_name| Autobuild::Package[pkg_name].prepare_for_rebuild end build_packages(all_enabled_packages) end |