require 'build-tool/application' require 'build-tool/commands' module BuildTool; module Commands; # # BuildCommand # class Build < ModuleBasedCommand name "build" description "Build a module." def initialize_options @clean = false @configure = false @from_scratch = false @build = true @install = true @reconfigure = false @update = false options.on( "--[no-]clean", "Make clean before building." ) { |t| @clean = t } options.on( "--[no-]install", "Do not install" ) { |t| @install = t } options.on( "--[no-]update", "Do not update from the repository" ) { |t| @update = t } options.on( "-c", "--configure", "Run the configuration step again" ) { |t| @configure = true } options.on( "--reconfigure", "Remove old configuration then run configuration again" ) { |t| @reconfigure = true } options.on( nil, "--from-scratch", "Rebuild from scratch" ) { |t| @from_scratch = true } super end def applicable? BuildTool::Application.instance.name != "build-tool" end def do_execute( args ) rc = super(args) MJ::Tools::SSH::cleanup() return rc end def is_module_ready?( mod ) isready = true @update && isready &= mod.prepare_for_vcs_access if !@update and (@build or @install or @configure) if !mod.checkedout? logger.warn "#{mod.name}: is not checked out. Skipping (add -u for checkout)" end end @install && isready &= mod.prepare_for_installation return isready end # is_module_ready def do_execute_module( mod ) if @from_scratch or @clean mod.clean( @log_directory, @from_scratch ) end if @update if mod.checkedout? mod.fetch( @log_directory ) mod.rebase( @log_directory ) else mod.clone( @log_directory ) end end if $noop or mod.checkedout? if @configure or @reconfigure or !mod.configured? if @reconfigure mod.reconfigure( @log_directory ) else # See outer if. @configure or !mod.configured? mod.configure( @log_directory ) end end if @build mod.make( @log_directory ) end if @install mod.install( @log_directory ) end else logger.warn "Module is not checked out! Use -u to check it out." logger.warn "skipped!" end end # do_execute_module end # class Build end; end # module BuildTool::Commands