Changeset 162545 in webkit


Ignore:
Timestamp:
Jan 22, 2014 11:55:57 AM (10 years ago)
Author:
Martin Robinson
Message:

[GTK][CMake] build-webkit should try harder to avoid re-running cmake
https://bugs.webkit.org/show_bug.cgi?id=127073

Reviewed by Daniel Bates.

  • Scripts/build-webkit: Unify all the ports that call buildCMakeProjectOrExit with

the new isCMakeBuild conditional. This allows us to share more code between ports.
Pass the build arguments to the removeCMakeCache function.

  • Scripts/webkitdirs.pm:

(runAutogenForAutotoolsProjectIfNecessary): Renamed mustReRunAutogen to cachedArgumentFileOutOfDate
because it's now shared with the CMake build.
(cachedArgumentFileOutOfDate): Renamed.
(cmakeCachePath): Added this helper which gets the CMakeCache.txt path.
(shouldRemoveCMakeCache): Tries to preserve current behavior for all ports,
except GTK+ which examines the OptionsGTK.cmake and OptionsCommon.cmake file
as well as checking if build-webkit has been run with different arguments.
(removeCMakeCache): Call shouldRemoveCMakeCache now.
(generateBuildSystemFromCMakeProject): Exit early if CMakeCache.txt exists for GTK+.
(isCMakeBuild): Added.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r162538 r162545  
     12014-01-15  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK][CMake] build-webkit should try harder to avoid re-running cmake
     4        https://bugs.webkit.org/show_bug.cgi?id=127073
     5
     6        Reviewed by Daniel Bates.
     7
     8        * Scripts/build-webkit: Unify all the ports that call buildCMakeProjectOrExit with
     9        the new isCMakeBuild conditional. This allows us to share more code between ports.
     10        Pass the build arguments to the removeCMakeCache function.
     11        * Scripts/webkitdirs.pm:
     12        (runAutogenForAutotoolsProjectIfNecessary): Renamed mustReRunAutogen to cachedArgumentFileOutOfDate
     13        because it's now shared with the CMake build.
     14        (cachedArgumentFileOutOfDate): Renamed.
     15        (cmakeCachePath): Added this helper which gets the CMakeCache.txt path.
     16        (shouldRemoveCMakeCache): Tries to preserve current behavior for all ports,
     17        except GTK+ which examines the OptionsGTK.cmake and OptionsCommon.cmake file
     18        as well as checking if build-webkit has been run with different arguments.
     19        (removeCMakeCache): Call shouldRemoveCMakeCache now.
     20        (generateBuildSystemFromCMakeProject): Exit early if CMakeCache.txt exists for GTK+.
     21        (isCMakeBuild): Added.
     22
    1232014-01-22  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
    224
  • trunk/Tools/Scripts/build-webkit

    r162512 r162545  
    253253}
    254254
    255 if (isEfl() || isGtkCMake()) {
    256     # By default we build using all of the available CPUs.
    257     $makeArgs .= ($makeArgs ? " " : "") . "-j" . numberOfCPUs() if $makeArgs !~ /-j\s*\d+/;
     255if (isCMakeBuild()) {
    258256    $cmakeArgs = "-DENABLE_WEBKIT=OFF "  . $cmakeArgs if $noWebKit1;
    259257    $cmakeArgs = "-DENABLE_WEBKIT2=OFF " . $cmakeArgs if $noWebKit2;
    260258
     259    # By default we build using all of the available CPUs.
     260    if (!isWinCE()) {
     261        $makeArgs .= ($makeArgs ? " " : "") . "-j" . numberOfCPUs() if $makeArgs !~ /-j\s*\d+/;
     262    }
     263
    261264    # We remove CMakeCache to avoid the bots to reuse cached flags when
    262265    # we enable new features. This forces a reconfiguration.
    263     removeCMakeCache();
    264 
    265     my $portName = (isEfl() ? "Efl" : "GTK");
    266     buildCMakeProjectOrExit($clean, $portName, $prefixPath, $makeArgs, (cmakeBasedPortArguments(), cMakeArgsFromFeatures()), $cmakeArgs);
    267 }
    268 
    269 if (isWinCE()) {
    270     buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, (cmakeBasedPortArguments(), cMakeArgsFromFeatures()), $cmakeArgs);
     266    my @featureArgs = cMakeArgsFromFeatures();
     267    removeCMakeCache(@featureArgs);
     268
     269    buildCMakeProjectOrExit($clean, cmakeBasedPortName(), $prefixPath, $makeArgs, (cmakeBasedPortArguments(), @featureArgs), $cmakeArgs);
    271270}
    272271
  • trunk/Tools/Scripts/webkitdirs.pm

    r162512 r162545  
    16611661
    16621662        # Run autogen.sh again if either the features overrided by build-webkit or build arguments have changed.
    1663         if (!mustReRunAutogen($sourceDir, "WebKitFeatureOverrides.txt", $joinedOverridableFeatures)
    1664             && !mustReRunAutogen($sourceDir, "previous-autogen-arguments.txt", $joinedBuildArgs)) {
     1663        if (!isCachedArgumentfileOutOfDate("WebKitFeatureOverrides.txt", $joinedOverridableFeatures)
     1664            && !isCachedArgumentfileOutOfDate("previous-autogen-arguments.txt", $joinedBuildArgs)) {
    16651665            return;
    16661666        }
     
    17121712}
    17131713
    1714 sub mustReRunAutogen($@)
    1715 {
    1716     my ($sourceDir, $filename, $currentContents) = @_;
     1714sub isCachedArgumentfileOutOfDate($@)
     1715{
     1716    my ($filename, $currentContents) = @_;
    17171717
    17181718    if (! -e $filename) {
     
    17241724    close(CONTENTS_FILE);
    17251725
    1726     # We only care about the WebKit2 argument when we are building WebKit itself.
    1727     # build-jsc never passes --enable-webkit2, so if we didn't do this, autogen.sh
    1728     # would run for every single build on the bots, since it runs both build-webkit
    1729     # and build-jsc.
    17301726    if ($previousContents ne $currentContents) {
    17311727        print "Contents for file $filename have changed.\n";
     
    18741870}
    18751871
    1876 sub removeCMakeCache()
    1877 {
    1878     my $cacheFilePath = File::Spec->catdir(baseProductDir(), configuration(), "CMakeCache.txt");
    1879     unlink($cacheFilePath) if -e $cacheFilePath;
     1872sub cmakeCachePath()
     1873{
     1874    return File::Spec->catdir(baseProductDir(), configuration(), "CMakeCache.txt");
     1875}
     1876
     1877sub shouldRemoveCMakeCache(@)
     1878{
     1879    my ($cacheFilePath, @buildArgs) = @_;
     1880    if (isWinCE()) {
     1881        return 0;
     1882    }
     1883
     1884    if (!isGtk()) {
     1885        return 1;
     1886    }
     1887
     1888    # We check this first, because we always want to create this file for a fresh build.
     1889    my $optionsCache = File::Spec->catdir(baseProductDir(), configuration(), "build-webkit-options.txt");
     1890    my $joinedBuildArgs = join(" ", @buildArgs);
     1891    if (isCachedArgumentfileOutOfDate($optionsCache, $joinedBuildArgs)) {
     1892        open(CACHED_ARGUMENTS, ">", $optionsCache);
     1893        print CACHED_ARGUMENTS $joinedBuildArgs;
     1894        close(CACHED_ARGUMENTS);
     1895
     1896        return 1;
     1897    }
     1898
     1899    my $cmakeCache = cmakeCachePath();
     1900    unless (-e $cmakeCache) {
     1901        return 0;
     1902    }
     1903
     1904    my $cacheFileModifiedTime = stat($cmakeCache)->mtime;
     1905    my $platformConfiguration = File::Spec->catdir(sourceDir(), "Source", "cmake", "Options" . cmakeBasedPortName() . ".cmake");
     1906    if ($cacheFileModifiedTime < stat($platformConfiguration)->mtime) {
     1907        return 1;
     1908    }
     1909
     1910    my $globalConfiguration = File::Spec->catdir(sourceDir(), "Source", "cmake", "OptionsCommon.cmake");
     1911    if ($cacheFileModifiedTime < stat($globalConfiguration)->mtime) {
     1912        return 1;
     1913    }
     1914
     1915    return 0;
     1916}
     1917
     1918sub removeCMakeCache(@)
     1919{
     1920    my (@buildArgs) = @_;
     1921    if (shouldRemoveCMakeCache(@buildArgs)) {
     1922        my $cmakeCache = cmakeCachePath();
     1923        unlink($cmakeCache) if -e $cmakeCache;
     1924    }
    18801925}
    18811926
     
    18881933    my $originalWorkingDirectory = getcwd();
    18891934    chdir($buildPath) or die;
     1935
     1936    # For GTK+ we try to be smart about when to rerun cmake, so that we can have faster incremental builds.
     1937    if (isGtk() && -e cmakeCachePath()) {
     1938        return 0;
     1939    }
    18901940
    18911941    my @args;
     
    19792029    return "GTK" if isGtkCMake();
    19802030    return "";
     2031}
     2032
     2033sub isCMakeBuild()
     2034{
     2035    return isEfl() || isWinCE() || isGtkCMake();
    19812036}
    19822037
Note: See TracChangeset for help on using the changeset viewer.