WebKit Bugzilla
Attachment 339382 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]
Patch
bug-182689-20180503010425.patch (text/plain), 6.47 KB, created by
Carlos Bentzen
on 2018-05-02 21:03:22 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Bentzen
Created:
2018-05-02 21:03:22 PDT
Size:
6.47 KB
patch
obsolete
>Subversion Revision: 231292 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index f0f705544e654e89acc8635ea392675f720c1c1b..65b62536d6009e2ddce507336046f18c811e8726 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,17 @@ >+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 CSV files mapping >+ original sources to UnifiedSources. YouCompleteMe will use it to get >+ compilation flags. >+ >+ * Scripts/generate-unified-source-bundles.rb: write to CSV files the >+ original source files used to generate UnifiedSources. >+ > 2018-05-02 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r231251. >diff --git a/Source/WTF/Scripts/generate-unified-source-bundles.rb b/Source/WTF/Scripts/generate-unified-source-bundles.rb >index 8db785671589bb443184bf6910ed935dad0568ff..62d4bc56916d569138ad477c1c9fe352400fd176 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 = {} >@@ -79,6 +80,10 @@ GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT], > $derivedSourcesPath = Pathname.new(arg) > $unifiedSourceOutputPath = $derivedSourcesPath + Pathname.new("unified-sources") > FileUtils.mkpath($unifiedSourceOutputPath) if !$unifiedSourceOutputPath.exist? >+ frameworkName = File.basename($derivedSourcesPath) >+ mapPath = $derivedSourcesPath + Pathname.new("../../unified_sources_mapping") >+ FileUtils.mkpath(mapPath) if !mapPath.exist? >+ $mapFile = (mapPath + Pathname.new("map_#{frameworkName}.csv")).to_s > when '--source-tree-path' > $sourceTreePath = Pathname.new(arg) > usage if !$sourceTreePath.exist? >@@ -102,6 +107,7 @@ usage if ARGV.length == 0 > sourceListFiles = ARGV.to_a.map { | sourceFileList | sourceFileList.split(";") }.flatten > log("source files: #{sourceListFiles}") > $generatedSources = [] >+$mapText = "" > > class SourceFile > attr_reader :unifiable, :fileIndex, :path >@@ -156,6 +162,7 @@ class BundleManager > @fileCount = 0 > @bundleCount = 0 > @currentBundleText = "" >+ @currentSourcesToBundle = [] > @maxCount = max > end > >@@ -167,6 +174,15 @@ class BundleManager > end > end > >+ def writeToMapText(bundlePath) >+ @currentSourcesToBundle.each { >+ | source | >+ sourceBaseName = File.basename(source); >+ $mapText += "#{sourceBaseName},#{bundlePath}\n" >+ } >+ @currentSourcesToBundle = [] >+ end >+ > def bundleFileName(number) > @extension == "cpp" ? "UnifiedSource#{number}.#{extension}" : "UnifiedSource#{number}-#{extension}.#{extension}" > end >@@ -180,6 +196,7 @@ class BundleManager > $generatedSources << $unifiedSourceOutputPath + bundleFile > > writeFile(bundleFile, @currentBundleText) >+ writeToMapText($unifiedSourceOutputPath + bundleFile) > @currentBundleText = "" > @fileCount = 0 > end >@@ -200,6 +217,7 @@ class BundleManager > flush > end > @currentBundleText += "#include \"#{sourceFile}\"\n" >+ @currentSourcesToBundle << sourceFile.path > @fileCount += 1 > end > end >@@ -299,3 +317,6 @@ $bundleManagers.each_value { > > log($generatedSources.join(";") + ";") > print($generatedSources.join(";") + ";") >+if !$mapText.empty? >+ IO::write($mapFile, $mapText) >+end >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index aad886f792ef25cd41302a4149dee7d38b4df21e..efc95a67920f181f7857ffe6158ba42620656d70 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,20 @@ >+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 key,value >+ files mapping original sources to UnifiedSources. We read those >+ files to check if the file was compiled through a UnifiedSource and >+ return the UnifiedSource compilation flags if so. >+ >+ * gtk/ycm_extra_conf.py: >+ (find_unified_source_path): Added. >+ (FlagsForFile): Return UnifiedSources compilation flags if the source >+ file was bundle-compiled. >+ > 2018-05-02 Aditya Keerthi <akeerthi@apple.com> > > Can't copy and paste URLs that have no title into Mail (macOS) >diff --git a/Tools/gtk/ycm_extra_conf.py b/Tools/gtk/ycm_extra_conf.py >index c1309bca39f17d7937570fd9ff7ffc1f95a0bd9c..f58895a52b2e66b85ac2868492502f5b704a8c2f 100644 >--- a/Tools/gtk/ycm_extra_conf.py >+++ b/Tools/gtk/ycm_extra_conf.py >@@ -16,6 +16,7 @@ > # License along with this library; if not, write to the Free Software > # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > >+import csv > import os > import sys > import ycm_core >@@ -81,6 +82,19 @@ 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): >+ frameworks = ['JavaScriptCore', 'WebCore', 'WebKit'] >+ >+ for framework in frameworks: >+ with open(os.path.join(build_path, 'unified_sources_mapping', 'map_' + framework + '.csv'), 'rb') as f: >+ reader = csv.reader(f) >+ for row in reader: >+ if row[0] == filename: >+ return row[1] >+ >+ return '' >+ >+ > def FlagsForFile(filename, **kwargs): > """This is the main entry point for YCM. Its interface is fixed. > >@@ -118,6 +132,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