diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-01-16 15:13:59 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-01-17 15:36:49 +0000 |
commit | d6f577c2a5e72457ebb768239e6542ab934d5482 (patch) | |
tree | 456556548f9ee6def7b3a7913d423a8bfcc7db06 | |
parent | 4712e59d75bb95cb206aff4a6bc111c7c79b06a5 (diff) |
qt5_tool: Add an option to use incredibuild
Add option -i which performs a quick test on Linux or tries to
locate ibjom on Windows. Move the code checking for make
into a subroutine so that it can be called after the options
parsing.
Add elapsed time output.
Change-Id: Ie7b965b53d5e06521fb3eedee463c7178a96267c
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rwxr-xr-x | bin/qt5_tool | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/bin/qt5_tool b/bin/qt5_tool index b90aca6..b4c227b 100755 --- a/bin/qt5_tool +++ b/bin/qt5_tool @@ -40,6 +40,7 @@ my $STATUS=0; my $UPDATE=0; my $TEST=0; my $optGerritModule; +my $optIncredibuild; my $optGitHooks; my $optDesiredBranch; my $superRepositoryUrl = 'git://code.qt.io/qt/qt5.git'; @@ -68,6 +69,7 @@ Options: creates log file(s) in that directory as well as a summary log file. -q Quick bootstrap a new checkout under current folder. -g <module> Set up gerrit for the module. + -i Use incredibuild Example use cases: qt5_tool -c -u -b Clean, update and build for nightly builds @@ -146,27 +148,38 @@ my @makeArgs = ('-s'); my $makeForceArg = '-k'; my $minGW = 0; -if ($os == $OS_WINDOWS) { - if (which('g++')) { - $make = 'mingw32-make'; - } else { - @makeArgs = ('/s', '/l'); - $makeForceArg = '/k'; - my $jom = which('jom'); - if (defined $jom) { - $make = $jom; +sub checkMake +{ + if ($os == $OS_WINDOWS) { + if (which('g++')) { + $make = 'mingw32-make'; } else { - $make = 'nmake'; - # Switch cl compiler to multicore - my $oldCL = $ENV{'CL'}; - if (defined $oldCL) { - $ENV{'CL'} = $oldCL . ' /MP' + @makeArgs = ('/s', '/l'); + $makeForceArg = '/k'; + my $jom; + $jom = which('ibjom') if defined($optIncredibuild); + $jom = which('jom') unless defined($jom); + if (defined $jom) { + $make = $jom; } else { - $ENV{'CL'} = '/MP' - } - } # jom - } # !MinGW -} + $make = 'nmake'; + # Switch cl compiler to multicore + my $oldCL = $ENV{'CL'}; + if (defined $oldCL) { + $ENV{'CL'} = $oldCL . ' /MP' + } else { + $ENV{'CL'} = '/MP' + } + } # jom + } # !MinGW + } elsif (defined($optIncredibuild)) { + my $ib_console = '/opt/incredibuild/bin/ib_console'; + if (-x $ib_console && system($ib_console, 'echo', 'Testing') == 0) { + unshift(@makeArgs, $make, '-j', '40'); + $make = $ib_console; + } + } +} # sub checkMake my $git = which('git'); # TODO: Mac, Windows special cases? die ('Unable to locate git') unless defined $git; @@ -533,18 +546,23 @@ sub checkoutBranch # --------------- MAIN: Parse arguments +my $startTime = time(); + $Getopt::ignoreCase = 0; if (!GetOptions('clean' => \$CLEAN, 'pull' => \$PULL, 'Branch=s' => \$optDesiredBranch, 'update' => \$UPDATE, 'reset' => \$RESET, 'diff' => \$DIFF, 's' => \$STATUS, 'build' => \$BUILD, 'make' => \$MAKE, 'test' => \$TEST, 'gerrit=s' => \$optGerritModule, 'hooks' => \$optGitHooks, - 'quick-bootstrap' => \$BOOTSTRAP) + 'quick-bootstrap' => \$BOOTSTRAP, + 'incredibuild' => \$optIncredibuild) || ($CLEAN + $PULL + $UPDATE + $BUILD + $MAKE + $RESET + $DIFF + $BOOTSTRAP + $STATUS + $TEST == 0 && !defined $optGerritModule && !defined $optGitHooks)) { print $USAGE; exit (1); } +checkMake(); + sub defaultConfigureArguments { my ($developerBuild) = @_; @@ -891,4 +909,5 @@ if ( $BUILD && $makeInstallRequired ) { executeCheck($make, @installArgs); } +print '--- Done (', (time() - $startTime), "s) ---\n" if $exitCode == 0 && ($BUILD || $MAKE); exit($exitCode); |