WebKit Bugzilla
Attachment 339238 Details for
Bug 182689
: Unified builds broke ycm autocompletion using compilation databases
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[WIP] Patch
bug-182689-20180501202043.patch (text/plain), 6.75 KB, created by
Carlos Bentzen
on 2018-05-01 16:19:43 PDT
(
hide
)
Description:
[WIP] Patch
Filename:
MIME Type:
Creator:
Carlos Bentzen
Created:
2018-05-01 16:19:43 PDT
Size:
6.75 KB
patch
obsolete
>Subversion Revision: 231215 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 881b164c933eb2ad221e365a7e5aac9cf346a5f7..cef148aa1b0fad9be72cf1b280305573bcc22e6a 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,16 @@ >+2018-05-01 Carlos Eduardo Ramalho <cadubentzen@gmail.com> >+ >+ Unified builds broke ycm autocompletion using compilation databases >+ https://bugs.webkit.org/show_bug.cgi?id=182689 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ During generation of UnifiedSources, write to YAML file mapping >+ original source to UnifiedSource. YouCompleteMe will use it to get the compilation flags. >+ >+ * Scripts/generate-unified-source-bundles.rb: write to YAML file the >+ files used to generate UnifiedSources. >+ > 2018-05-01 Robin Morisset <rmorisset@apple.com> > > Correctly detect string overflow when using the 'Function' constructor >diff --git a/Source/WTF/Scripts/generate-unified-source-bundles.rb b/Source/WTF/Scripts/generate-unified-source-bundles.rb >index 8db785671589bb443184bf6910ed935dad0568ff..5fd26e41ad4f94e16a83210d2bb1a658787324c3 100644 >--- a/Source/WTF/Scripts/generate-unified-source-bundles.rb >+++ b/Source/WTF/Scripts/generate-unified-source-bundles.rb >@@ -49,6 +49,7 @@ end > > MAX_BUNDLE_SIZE = 8 > $derivedSourcesPath = nil >+$mapFile = nil > $unifiedSourceOutputPath = nil > $sourceTreePath = nil > $featureFlags = {} >@@ -77,6 +78,7 @@ GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT], > $verbose = true > when '--derived-sources-path' > $derivedSourcesPath = Pathname.new(arg) >+ $mapFile = File.expand_path("../../unified_sources_map.yaml", $derivedSourcesPath) > $unifiedSourceOutputPath = $derivedSourcesPath + Pathname.new("unified-sources") > FileUtils.mkpath($unifiedSourceOutputPath) if !$unifiedSourceOutputPath.exist? > when '--source-tree-path' >@@ -156,6 +158,7 @@ class BundleManager > @fileCount = 0 > @bundleCount = 0 > @currentBundleText = "" >+ @currentSourcesToBundle = [] > @maxCount = max > end > >@@ -167,6 +170,17 @@ class BundleManager > end > end > >+ def writeToMapFile(bundlePath) >+ text = "" >+ @currentSourcesToBundle.each { >+ | source | >+ sourceBaseName = File.basename(source); >+ text += "#{sourceBaseName}: #{bundlePath}\n" >+ } >+ IO::write($mapFile, text, mode: 'a') >+ @currentSourcesToBundle = [] >+ end >+ > def bundleFileName(number) > @extension == "cpp" ? "UnifiedSource#{number}.#{extension}" : "UnifiedSource#{number}-#{extension}.#{extension}" > end >@@ -180,6 +194,7 @@ class BundleManager > $generatedSources << $unifiedSourceOutputPath + bundleFile > > writeFile(bundleFile, @currentBundleText) >+ writeToMapFile($unifiedSourceOutputPath + bundleFile) > @currentBundleText = "" > @fileCount = 0 > end >@@ -200,6 +215,7 @@ class BundleManager > flush > end > @currentBundleText += "#include \"#{sourceFile}\"\n" >+ @currentSourcesToBundle.push(sourceFile.path) > @fileCount += 1 > end > end >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index daa2379b1f2905f1ea021e32212eda29ed73af3f..ff2204635ee4b91eea6b0aa0e2b4c9cb681942ee 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,21 @@ >+2018-05-01 Carlos Eduardo Ramalho <cadubentzen@gmail.com> >+ >+ Unified builds broke ycm autocompletion using compilation databases >+ https://bugs.webkit.org/show_bug.cgi?id=182689 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The strategy used to get the compilation flags was to write a map file >+ corresponding original sources to UnifiedSources. We read this YAML >+ file to check if the file was compiled through a UnifiedSource and >+ return the UnifiedSource compilation flags if so. >+ >+ * gtk/install-dependencies: Add python yaml module to dependencies. >+ * gtk/ycm_extra_conf.py: >+ (find_unified_source_path): Added. >+ (FlagsForFile): Return UnifiedSources compilation flags if the source >+ file was bundle-compiled. >+ > 2018-05-01 Jonathan Bedard <jbedard@apple.com> > > webkitpy: SIGKILL right after SIGTERM causes orphaned processes with 'xcrun simctl spawn' >diff --git a/Tools/gtk/install-dependencies b/Tools/gtk/install-dependencies >index 933d3fbef47258e9e1ee72037fdc3f0c39757bfd..0f67229da55b18a637fcab9b80860f0a6cf8278a 100755 >--- a/Tools/gtk/install-dependencies >+++ b/Tools/gtk/install-dependencies >@@ -149,6 +149,7 @@ function installDependenciesWithApt { > libwayland-dev \ > ninja-build \ > patch \ >+ python-yaml \ > ruby \ > xfonts-utils" > >@@ -286,6 +287,7 @@ function installDependenciesWithPacman { > opus \ > pango \ > perl-file-copy-recursive \ >+ python2-yaml \ > libgcrypt \ > libnotify \ > libpng \ >@@ -465,6 +467,7 @@ function installDependenciesWithDnf { > perl-version \ > pulseaudio-libs-devel \ > python-devel \ >+ python2-pyyaml \ > redhat-rpm-config \ > ruby \ > sqlite-devel \ >diff --git a/Tools/gtk/ycm_extra_conf.py b/Tools/gtk/ycm_extra_conf.py >index c1309bca39f17d7937570fd9ff7ffc1f95a0bd9c..9fce3a15c87d26a6cdd52aed1c4965d0e7404cd0 100644 >--- a/Tools/gtk/ycm_extra_conf.py >+++ b/Tools/gtk/ycm_extra_conf.py >@@ -18,6 +18,7 @@ > > import os > import sys >+import yaml > import ycm_core > > # It's very likely that this script is a symlink somewhere in the WebKit directory, >@@ -81,6 +82,22 @@ def get_build_path(): > return release_build_path if release_mtime >= debug_mtime else debug_build_path > > >+def find_unified_source_path(filename, build_path): >+ unified_sources = {} >+ >+ with open(os.path.join(build_path, "unified_sources_map.yaml"), "r") as f: >+ try: >+ unified_sources = yaml.load(f) >+ except yaml.YAMLError as e: >+ print(e) >+ return "" >+ >+ try: >+ return unified_sources[filename] >+ except KeyError: >+ return "" >+ >+ > def FlagsForFile(filename, **kwargs): > """This is the main entry point for YCM. Its interface is fixed. > >@@ -118,6 +135,10 @@ def FlagsForFile(filename, **kwargs): > print("Could not find compile_commands.json in %s, You might forget to add CMAKE_EXPORT_COMPILE_COMMANDS=ON to cmakeargs" % build_path) > return result > >+ # If the source is contained in a unified source, we search for the unified source flags instead >+ unified_source_filename = find_unified_source_path(os.path.basename(filename), build_path) >+ filename = unified_source_filename if unified_source_filename else filename >+ > compilation_info = database.GetCompilationInfoForFile(filename) > if not compilation_info: > print("No compilation info.")
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 182689
:
339238
|
339252
|
339382