[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - 5 commits - bin/gbuild-to-ide

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 4 09:36:32 UTC 2019


 bin/gbuild-to-ide |   39 +++++++++++++++++++++++++++++++--------
 1 file changed, 31 insertions(+), 8 deletions(-)

New commits:
commit 64474993a698a6f3ec41588cd12db192ba7a8bae
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Oct 11 11:54:07 2019 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Nov 4 08:07:46 2019 +0100

    qtcreator: Sort SUBDIRS in lo.pro alphabetically
    
    ... in particular to have a deterministic order and see
    more easily what relevant effects changes to the
    gbuild-to-ide script have while testing those.
    
    Change-Id: I4583a8ca5a779d1d1e8aa6db7bb0295abd6154ee
    Reviewed-on: https://gerrit.libreoffice.org/80653
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    (cherry picked from commit 2ef2c031ce9ec730b13fca8bca808f382aab5fe4)

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 412e1b7a0431..267eac13e83f 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -1606,7 +1606,7 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
         # create meta .pro file (lists all sub projects)
         qt_meta_pro_file = 'lo.pro'
         try:
-            subdirs = " \\\n".join(subdirs_list)
+            subdirs = " \\\n".join(sorted(subdirs_list))
             content = QtCreatorIntegrationGenerator.pro_meta_template % {'subdirs': subdirs}
             with open(qt_meta_pro_file, 'w+') as fmpro:
                 fmpro.write(content)
commit 13e29d1b97667300263ade270eb9e0a822f8fc38
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Oct 11 11:47:57 2019 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Nov 4 08:07:38 2019 +0100

    qtcreator-ide-integration: Take unit tests into account
    
    This makes code-completion, clang checks, navigation etc.
    work in files related to those as well.
    
    Change-Id: Ie0b7d75f2ed953228d74ae070056327bff7ff2a2
    Reviewed-on: https://gerrit.libreoffice.org/80652
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    (cherry picked from commit 0470bfdff2b1bca7a075d130b029d4a1a54e90fc)

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 2da77d86db7f..412e1b7a0431 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -1005,7 +1005,7 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
     def __init__(self, gbuildparser, ide):
         IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
         self.target_by_location = {}
-        for target in set(self.gbuildparser.libs) | set(self.gbuildparser.exes):
+        for target in set(self.gbuildparser.libs) | set(self.gbuildparser.exes) | set(self.gbuildparser.tests):
             if target.location not in self.target_by_location:
                 self.target_by_location[target.location] = set()
             self.target_by_location[target.location] |= set([target])
@@ -1461,7 +1461,7 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
 
         self.data_libs = {}
 
-        all_libs = set(self.gbuildparser.libs) | set(self.gbuildparser.exes)
+        all_libs = set(self.gbuildparser.libs) | set(self.gbuildparser.exes) | set(self.gbuildparser.tests)
         for lib in all_libs:
             self._log("\nlibrary : %s, loc=%s" % (lib.short_name(), lib.location))
             lib_name = os.path.basename(lib.location)
commit 290fbab60366fccc5302bf1ded6cee8eb5b9cfe6
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Mon Jul 15 13:01:15 2019 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Nov 4 08:07:32 2019 +0100

    qtcreator: Recursively include module's header files
    
    Recursivley walk the include directories located
    inside the current module's directory, since includes
    are basically paths relative to the include directories
    and can refer to files in subdirectories of the include
    path, like e.g.
    
        #include <extended/AccessibleBrowseBoxBase.hxx>
    
    in 'accessibility/source/extended/AccessibleBrowseBoxBase.cxx'.
    
    This way, such header files are added to the .pro files
    and are thus e.g. shown in Qt Creator's project view
    and can be found by using 'a <FILEANME>' in the Locator.
    
    Change-Id: Id74f971b2ffee82203f74a4d444c41166c671920
    Reviewed-on: https://gerrit.libreoffice.org/75628
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    (cherry picked from commit de44936e61dbd0a0b1d397717f58319f7c0075d5)

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 6e1717b37c80..2da77d86db7f 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -1513,10 +1513,11 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
             # List headers files from current lib
             for hdir in lib.include:
                 if hdir.startswith(lib.location):
-                    for hf in os.listdir(hdir):
-                        if hf.endswith(('.h', '.hxx', '.hpp', '.hrc')):
-                            hf_lopath = lopath(os.path.join(hdir, hf))
-                            headers_list.append(hf_lopath)
+                    for dirpath, _, files in os.walk(hdir):
+                        for hf in files:
+                            if hf.endswith(('.h', '.hxx', '.hpp', '.hrc')):
+                                hf_lopath = lopath(os.path.join(dirpath, hf))
+                                headers_list.append(hf_lopath)
 
             # List defines
             for key, value in lib.defs.items():
commit 13e8a6f5b247c17413a812eb07b482c04f9f4945
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Jul 5 08:46:10 2019 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Nov 4 08:07:24 2019 +0100

    qtcreator: Make paths work with cygwin
    
    Absolute paths in files created by GbuildToJson
    in Cygwin environment are Windows paths
    (like "C:/....'), while relative paths in the Python
    program executed in Cygwin are treated as Unix paths
    ('/cygdrive/c/....') which caused wrong relative paths to
    be generated by the call to 'os.relpath'. It would walk up to
    the root of the Windows path and then walk down the tree in the
    Unix file system path again.
    
    This converts the paths to absolute Windows paths first to avoid
    this issue.
    
    Change-Id: I2e3e6926e312d64aa18067933a5903ac7ad5d31a
    Reviewed-on: https://gerrit.libreoffice.org/75114
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    (cherry picked from commit 22c6ffc274a4dd29fdd6c0d02415139502bddae6)

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index e76486c359b0..6e1717b37c80 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -9,6 +9,7 @@
 #
 
 import argparse
+import ntpath
 import os
 import os.path
 import shutil
@@ -1467,6 +1468,14 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
             lib_folder = os.path.relpath(lib.location, self.base_folder)
 
             def lopath(path):
+                if platform =="cygwin":
+                    # absolute paths from GbuildToJson are Windows paths,
+                    # so convert everything to such ones
+                    abs_path = path
+                    if not ntpath.isabs(abs_path):
+                        abs_path = ntpath.join(self.gbuildparser.srcdir, path)
+                    return ntpath.relpath(abs_path, lib.location).replace('\\', '/')
+
                 return os.path.relpath(path, lib.location)
 
             defines_list = []
commit 5f3b7cbcfda41c748cfbc52f4b76b3364cdc048d
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Jun 7 21:44:03 2019 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Nov 4 08:07:13 2019 +0100

    qtcreator: Take over '-std=...' from CXXFLAGS
    
    If the '-std=' compiler flag is set in CXXFLAGS,
    take that over into the .pro files used by
    Qt Creator.
    
    This makes ClangCodeModel use the correct std version,
    and e.g. know about 'std::string_view' if '-std=gnu++2a'
    (or anything else indicating C++17 or higher is supported)
    is used and thus avoids unnecessary errors/warnings from
    being displayed.
    
    Use a list, so other flags can easily be added later.
    (It currently doesn't seem reasonable to me to just pass all
    cxxflags though, since .pro files are currently only generated
    per top-level module, while C++ flags can differ between
    different targets in the same module).
    
    Change-Id: Id3f3e2b9ba77e5220a17fd4796937c816979959a
    Reviewed-on: https://gerrit.libreoffice.org/73677
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    (cherry picked from commit 92c03d9bf644b0f10de52ce0da09f97056e46247)

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 5c9c6e2445f3..e76486c359b0 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -1490,6 +1490,12 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
                 if ext:
                     headers_list.append(lopath(file_ + ext))
 
+            cxxflags_list = []
+            for cxxflag in lib.cxxflags:
+                # extract flag for C++ standard version
+                if cxxflag.startswith('-std'):
+                    cxxflags_list.append(cxxflag)
+
             # List all include paths
             for hdir in (lib.include + lib.include_sys):
                 hf_lopath = lopath(hdir)
@@ -1514,12 +1520,14 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
             if lib_folder in self.data_libs:
                 self.data_libs[lib_folder]['sources'] |= set(sources_list)
                 self.data_libs[lib_folder]['headers'] |= set(headers_list)
+                self.data_libs[lib_folder]['cxxflags'] |= set(cxxflags_list)
                 self.data_libs[lib_folder]['includepath'] |= set(includepath_list)
                 self.data_libs[lib_folder]['defines'] |= set(defines_list)
             else:
                 self.data_libs[lib_folder] = {
                     'sources': set(sources_list),
                     'headers': set(headers_list),
+                    'cxxflags': set(cxxflags_list),
                     'includepath': set(includepath_list),
                     'defines': set(defines_list),
                     'loc': lib.location,
@@ -1542,6 +1550,7 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
         for lib_folder in subdirs_list:
             sources_list = sorted(self.data_libs[lib_folder]['sources'])
             headers_list = sorted(self.data_libs[lib_folder]['headers'])
+            cxxflags_list = sorted(self.data_libs[lib_folder]['cxxflags'])
             includepath_list = sorted(self.data_libs[lib_folder]['includepath'])
             defines_list = sorted(self.data_libs[lib_folder]['defines'])
             lib_loc = self.data_libs[lib_folder]['loc']
@@ -1549,13 +1558,15 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
 
             sources = " \\\n".join(sources_list)
             headers = " \\\n".join(headers_list)
+            cxxflags = " \\\n".join(cxxflags_list)
             includepath = " \\\n".join(includepath_list)
             defines = " \\\n".join(defines_list)
 
             # create .pro file
             qt_pro_file = '%s/%s.pro' % (lib_loc, lib_name)
             try:
-                content = QtCreatorIntegrationGenerator.pro_template % {'sources': sources, 'headers': headers, 'includepath': includepath, 'defines': defines}
+                content = QtCreatorIntegrationGenerator.pro_template % {'sources': sources, 'headers': headers,
+                                                                        'cxxflags': cxxflags, 'includepath': includepath, 'defines': defines}
                 mode = 'w+'
                 with open(qt_pro_file, mode) as fpro:
                     fpro.write(content)
@@ -1618,6 +1629,8 @@ CONFIG += console
 CONFIG -= app_bundle
 CONFIG -= qt
 
+QMAKE_CXXFLAGS += %(cxxflags)s
+
 INCLUDEPATH += %(includepath)s
 
 SOURCES += %(sources)s


More information about the Libreoffice-commits mailing list