Title: [292687] trunk/Tools
Revision
292687
Author
commit-qu...@webkit.org
Date
2022-04-10 09:47:18 -0700 (Sun, 10 Apr 2022)

Log Message

[Flatpak] clangd wrapper improvements
https://bugs.webkit.org/show_bug.cgi?id=239032

Patch by Philippe Normand <pnorm...@igalia.com> on 2022-04-10
Reviewed by Adrian Perez de Castro.

The path of the compile_commands.json is now implied from the webkit-clangd command-line
arguments, defaulting to the GTK/Release configuration.

The path mappings were incorrect, the src part being /app/webkit/{Debug,Release}, which are
invalid paths in the sandbox. They should instead point to
/app/webkit/WebKitBuild/{Debug,Release}.

Finally, there should be no need to add a path mapping for /usr/include because clangd is
launched in the sandbox runtime, where /usr/include/ is already bind-mounded by
flatpak/bwrap.

* flatpak/webkit-clangd:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (292686 => 292687)


--- trunk/Tools/ChangeLog	2022-04-10 07:29:13 UTC (rev 292686)
+++ trunk/Tools/ChangeLog	2022-04-10 16:47:18 UTC (rev 292687)
@@ -1,3 +1,23 @@
+2022-04-10  Philippe Normand  <pnorm...@igalia.com>
+
+        [Flatpak] clangd wrapper improvements
+        https://bugs.webkit.org/show_bug.cgi?id=239032
+
+        Reviewed by Adrian Perez de Castro.
+
+        The path of the compile_commands.json is now implied from the webkit-clangd command-line
+        arguments, defaulting to the GTK/Release configuration.
+
+        The path mappings were incorrect, the src part being /app/webkit/{Debug,Release}, which are
+        invalid paths in the sandbox. They should instead point to
+        /app/webkit/WebKitBuild/{Debug,Release}.
+
+        Finally, there should be no need to add a path mapping for /usr/include because clangd is
+        launched in the sandbox runtime, where /usr/include/ is already bind-mounded by
+        flatpak/bwrap.
+
+        * flatpak/webkit-clangd:
+
 2022-04-09  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         [WKTR] Reset minimum font size WKPreference between tests

Modified: trunk/Tools/flatpak/webkit-clangd (292686 => 292687)


--- trunk/Tools/flatpak/webkit-clangd	2022-04-10 07:29:13 UTC (rev 292686)
+++ trunk/Tools/flatpak/webkit-clangd	2022-04-10 16:47:18 UTC (rev 292687)
@@ -22,6 +22,7 @@
 import sys
 
 platform = "GTK"
+build_type = "Release"
 if "--wpe" in sys.argv:
     platform = "WPE"
     sys.argv.remove("--wpe")
@@ -28,22 +29,29 @@
 if "--gtk" in sys.argv:
     sys.argv.remove("--gtk")
 
+if "--debug" in sys.argv:
+    build_type = "Debug"
+    sys.argv.remove("--debug")
+if "--release" in sys.argv:
+    sys.argv.remove("--release")
+
 build_path = os.environ['WEBKIT_OUTPUTDIR'] if 'WEBKIT_OUTPUTDIR' in os.environ \
     else flatpakutils.DEFAULT_BUILD_ROOT
 mappings = "--path-mappings=" + ",".join([
     "{}={}".format(
-        os.path.join(flatpakutils.SANDBOX_SOURCE_ROOT, "Debug"),
+        os.path.join(flatpakutils.SANDBOX_SOURCE_ROOT, flatpakutils.BUILD_ROOT_DIR_NAME, "Debug"),
         os.path.join(build_path, platform, "Debug")),
     "{}={}".format(
-        os.path.join(flatpakutils.SANDBOX_SOURCE_ROOT, "Release"),
+        os.path.join(flatpakutils.SANDBOX_SOURCE_ROOT, flatpakutils.BUILD_ROOT_DIR_NAME, "Release"),
         os.path.join(build_path, platform, "Release")),
     "{}={}".format(
         os.path.join(flatpakutils.WEBKIT_SOURCE_DIR, "Source"),
         os.path.join(flatpakutils.SANDBOX_SOURCE_ROOT, "Source")),
-    "/usr/include={}".format(
-        os.path.join(flatpakutils.FLATPAK_USER_DIR_PATH, "runtime", "org.webkit.Sdk",
-                     "x86_64", flatpakutils.SDK_BRANCH, "active", "files", "include")),
 ])
 
-print(f"Running clangd with arguments: {[mappings] + sys.argv[1:]}")
-flatpakutils.run_in_sandbox_if_available(["clangd", mappings] + sys.argv[1:])
+build_dir = os.path.join(flatpakutils.SANDBOX_SOURCE_ROOT, flatpakutils.BUILD_ROOT_DIR_NAME, build_type)
+extra_options = [f"--compile-commands-dir={build_dir}"]
+
+command = ["clangd", mappings] + extra_options + sys.argv[1:]
+print(f"Running clangd with arguments: {command}")
+flatpakutils.run_in_sandbox_if_available(command)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to