Title: [167667] trunk/Tools
Revision
167667
Author
changseok...@collabora.com
Date
2014-04-22 10:38:15 -0700 (Tue, 22 Apr 2014)

Log Message

[GTK] YCM choose a newer compile_commands.json in between Release or Debug
https://bugs.webkit.org/show_bug.cgi?id=131911

Reviewed by Martin Robinson.

common.get_build_path returns release path even though Debug configuration
is newer than Release. So YouCompleteMe is used to refer old build setup inadvertently.

* gtk/ycm_extra_conf.py:
(get_build_path): Compare modified time of Release and Debug. And return a recent modified path.
(FlagsForFile):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (167666 => 167667)


--- trunk/Tools/ChangeLog	2014-04-22 17:30:56 UTC (rev 167666)
+++ trunk/Tools/ChangeLog	2014-04-22 17:38:15 UTC (rev 167667)
@@ -1,3 +1,17 @@
+2014-04-22  ChangSeok Oh  <changseok...@collabora.com>
+
+        [GTK] YCM choose a newer compile_commands.json in between Release or Debug
+        https://bugs.webkit.org/show_bug.cgi?id=131911
+
+        Reviewed by Martin Robinson.
+
+        common.get_build_path returns release path even though Debug configuration
+        is newer than Release. So YouCompleteMe is used to refer old build setup inadvertently.
+
+        * gtk/ycm_extra_conf.py:
+        (get_build_path): Compare modified time of Release and Debug. And return a recent modified path.
+        (FlagsForFile):
+
 2014-04-21  Brent Fulgham  <bfulg...@apple.com>
 
         Unreviewed build fix.

Modified: trunk/Tools/gtk/ycm_extra_conf.py (167666 => 167667)


--- trunk/Tools/gtk/ycm_extra_conf.py	2014-04-22 17:30:56 UTC (rev 167666)
+++ trunk/Tools/gtk/ycm_extra_conf.py	2014-04-22 17:38:15 UTC (rev 167667)
@@ -61,6 +61,26 @@
     return result
 
 
+def get_build_path():
+    webkitbuild_path = os.path.join(common.get_build_path(fatal=False), '..')
+    if not os.path.exists(webkitbuild_path):
+        return None
+
+    release_build_path = os.path.join(webkitbuild_path, 'Release')
+    debug_build_path = os.path.join(webkitbuild_path, 'Debug')
+
+    try:
+        release_mtime = os.path.getmtime(os.path.join(release_build_path, 'compile_commands.json'))
+    except os.error:
+        release_mtime = 0
+    try:
+        debug_mtime = os.path.getmtime(os.path.join(debug_build_path, 'compile_commands.json'))
+    except os.error:
+        debug_mtime = 0
+
+    return release_build_path if release_mtime >= debug_mtime else debug_build_path
+
+
 def FlagsForFile(filename, **kwargs):
     """This is the main entry point for YCM. Its interface is fixed.
 
@@ -88,7 +108,7 @@
         # Force config.h file inclusion, for GLib macros.
         result['flags'].append("-includeconfig.h")
 
-    build_path = os.path.normpath(common.get_build_path(fatal=False))
+    build_path = os.path.normpath(get_build_path())
     if not build_path:
         print "Could not find WebKit build path."
         return result
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to