[webkit-changes] [WebKit/WebKit] 18c724: [cmake] Fix recompilation on rebuild without changes

Alicia Boya García noreply at github.com
Thu Apr 4 09:33:06 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 18c724980da23899f80a0271c0cbb70c0769e662
      https://github.com/WebKit/WebKit/commit/18c724980da23899f80a0271c0cbb70c0769e662
  Author: Alicia Boya Garcia <aboya at igalia.com>
  Date:   2024-04-04 (Thu, 04 Apr 2024)

  Changed paths:
    M CMakeLists.txt
    M Source/WebKit/InspectorGResources.cmake
    M Source/WebKit/ModernMediaControlsGResources.cmake
    M Source/WebKit/PdfJSGResources.cmake
    M Source/WebKit/PlatformGTK.cmake
    M Source/WebKit/PlatformWPE.cmake
    A Source/cmake/FindGLibCompileResources.cmake
    M Source/cmake/OptionsGTK.cmake
    M Source/cmake/OptionsWPE.cmake
    M Tools/TestWebKitAPI/glib/CMakeLists.txt
    M Tools/glib/apply-build-revision-to-files.py
    A Tools/glib/fix-glib-resources-depfile.pl

  Log Message:
  -----------
  [cmake] Fix recompilation on rebuild without changes
https://bugs.webkit.org/show_bug.cgi?id=257516

Reviewed by Adrian Perez de Castro.

Running build-webkit twice in a row made the second run still take
somewhere in the order of a minute to complete, despite there being no
changes in any code.

This patch fixes the bugs in the build system causing that deficiency,
at least for users of CMake >=3.20.

Namely:

* Amends 250761 at main, which added a cmake_policy() command for CMP0116
  without any effect. This patch sets it to NEW, which tells CMake to
  rewrite depfiles to use paths relative to the sub-build directory if
  the user CMake version is recent enough (>=3.20). Previous versions of
  CMake will remain affected.

* Refactors all usages of glib-compile-commands into a new CMake
  function, GLIB_COMPILE_COMMANDS(), provided by a new
  FindGLibCompileResources.cmake file.

* Detects versions of the glib-compile-commands older than 2.77 as
  potentially affected by this bug in depfile generation:
  https://gitlab.gnome.org/GNOME/glib/-/issues/2829
  If building with an affected version, a Perl post processing script is
  added automatically that corrects the depfiles. The Perl script is
  meant to be harmless in the case of false positives (older but patched
  versions).

* Modifies apply-build-revision-to-files.py, which is responsible for
  generating BuildRevision.h, to not write to the file if the resulting
  contents would remain unchanged. This avoids touching the modification
  time of the file which build systems like Ninja use to test whether
  files are dirty and therefore need to be recompiled along with all
  their dependents. A similar check already exists for many other
  generators that run on every build.

* CMakeLists.txt:
* Source/WebKit/InspectorGResources.cmake:
* Source/WebKit/ModernMediaControlsGResources.cmake:
* Source/WebKit/PdfJSGResources.cmake:
* Source/WebKit/PlatformGTK.cmake:
* Source/WebKit/PlatformWPE.cmake:
* Source/cmake/FindGLibCompileResources.cmake: Added.
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:
* Tools/TestWebKitAPI/glib/CMakeLists.txt:
* Tools/glib/apply-build-revision-to-files.py:
(main):
* Tools/glib/fix-glib-resources-depfile.pl: Added.

Canonical link: https://commits.webkit.org/277059@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list