bin/autoproj in autoproj-1.7.0.b3 vs bin/autoproj in autoproj-1.7.0.rc1

- old
+ new

@@ -16,11 +16,11 @@ def color(*args) Autoproj.console.color(*args) end -def report(debug) +def report Autobuild::Reporting.report do yield end Autobuild::Reporting.success @@ -32,25 +32,25 @@ e.backtrace.find_all { |path| path =~ root_dir }. each do |path| STDERR.puts color(" in #{path}", :red, :bold) end end - if debug then raise + if Autobuild.debug then raise else exit 1 end rescue Interrupt STDERR.puts STDERR.puts color("Interrupted by user", :red, :bold) - if debug then raise + if Autobuild.debug then raise else exit 1 end end Autoproj::OSDependencies.autodetect_ruby # Find the autoproj root dir -report(Autobuild.debug) do +report do selected_packages = begin Autoproj::CmdLine.parse_arguments(ARGV.dup) rescue RuntimeError => e if Autoproj::CmdLine.bootstrap? && !Autoproj.in_autoproj_installation?(Dir.pwd) STDERR.puts <<EOTEXT @@ -101,12 +101,18 @@ # to the value of Autoproj.auto_update if Autobuild.do_update.nil? Autobuild.do_update = Autoproj.auto_update? end - selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages) - Autoproj.manifest.explicit_selection = selected_packages + resolved_selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages) + if !selected_packages.empty? + command_line_selection = resolved_selected_packages.dup + else + command_line_selection = Array.new + end + Autoproj.manifest.explicit_selection = resolved_selected_packages + selected_packages = resolved_selected_packages Autoproj::CmdLine.initial_package_setup # If in verbose mode, or if we only update sources, list the sources if Autoproj.verbose || Autoproj::CmdLine.display_configuration? Autoproj::CmdLine.display_configuration(manifest, selected_packages) @@ -190,13 +196,13 @@ end if all_enabled_packages.empty? STDERR.puts color("autoproj: nothing to do", :bold) elsif Autoproj::CmdLine.doc? - Autoproj::CmdLine.build_packages(selected_packages, all_enabled_packages) + Autoproj::CmdLine.build_packages(command_line_selection, all_enabled_packages) elsif Autoproj::CmdLine.build? - Autoproj::CmdLine.build_packages(selected_packages, all_enabled_packages) + Autoproj::CmdLine.build_packages(command_line_selection, all_enabled_packages) # Now, do some sanity checks on the result prefixes = all_enabled_packages.inject(Set.new) do |set, pkg_name| set << Autobuild::Package[pkg_name].prefix end @@ -211,9 +217,54 @@ end end if Autoproj::CmdLine.update_envsh? Autoproj.export_env_sh - STDERR.puts color("autoproj: updated #{Autoproj.root_dir}/env.sh", :green) + Autoproj.progress "autoproj: updated #{Autoproj.root_dir}/env.sh", :green + end + + if Autoproj::CmdLine.show_statistics? + per_phase = Hash.new + per_type = Hash.new + + Autoproj.progress + Autoproj.progress "statistics about the build", :bold + + Autoproj.manifest.each_package.sort_by(&:name).each do |pkg| + next if pkg.statistics.empty? + + if per_phase.empty? + Autoproj.progress "detailed per package" + end + + puts " #{pkg.name}: %.1fs" % [pkg.statistics.values.inject(&:+)] + pkg.statistics.each_key.sort.each do |phase| + per_phase[phase] ||= 0 + per_phase[phase] += pkg.statistics[phase] + per_type[pkg.class] ||= Hash.new + per_type[pkg.class][phase] ||= 0 + per_type[pkg.class][phase] += pkg.statistics[phase] + puts " #{phase}: %.1fs" % [pkg.statistics[phase]] + end + end + + if !per_type.empty? + Autoproj.progress + Autoproj.progress "detailed per package type" + per_type.each do |pkg_type, phases| + Autoproj.progress " #{pkg_type.name}: %.1fs" % [phases.values.inject(&:+)] + phases.each_key.sort.each do |phase_name| + Autoproj.progress " #{phase_name}: %.1fs" % [phases[phase_name]] + end + end + end + + if !per_phase.empty? + Autoproj.progress + Autoproj.progress "summary per phase" + per_phase.keys.sort.each do |phase_name| + Autoproj.progress " #{phase_name}: %.1fs" % [per_phase[phase_name]] + end + end end end