bin/gbuild-to-ide |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit d7586471cdccaac742a69d53bc299875f02309cd
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Jan 31 14:45:09 2024 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Wed Jan 31 22:48:25 2024 +0100

    qtcreator: Fix generating .pro files for externals
    
    Since
    
        commit 3460799175e6c5795aa07c784e16d10ba9081d49
        Date:   Thu Jan 25 23:41:52 2024 +0600
    
            Clear gb_GbuildToJson_DENYLISTEDMODULES, allow these modules
    
    , externals are taken into account in the generation of IDE integrations,
    causing errors like this when running `make qtcreator-ide-integration`
    to generate the *.pro files for the QtCreator IDE integration:
    
        cd /home/michi/development/git/libreoffice &&  bin/gbuild-to-ide --ide 
qtcreator --make make
        ERROR : creating pro 
file=/home/michi/development/git/libreoffice/clucene/clucene.pro
        [Errno 2] No such file or directory: 
'/home/michi/development/git/libreoffice/clucene/clucene.pro'
        Traceback (most recent call last):
          File "/home/michi/development/git/libreoffice/bin/gbuild-to-ide", 
line 1787, in emit
            with open(qt_pro_file, mode) as fpro:
                 ^^^^^^^^^^^^^^^^^^^^^^^
        FileNotFoundError: [Errno 2] No such file or directory: 
'/home/michi/development/git/libreoffice/clucene/clucene.pro'
    
    Fix this by creating the .pro files in a directory that has the same
    relative path to the $(BUILDDIR) as the corresponding .mk files have
    in the $(SRCDIR) rather than in $(BUILDDIR)/$(LIBNAME)/.
    
    While both are the same for LO's internal modules,
    the latter directory does not exist for externals, since
    they're located underneath a top-level directory called "external".
    
    For the simple case of an in-tree build, this now e.g.
    creates a file `external/clucene/clucene.pro` instead
    of failing to create a `clucene/clucene.pro` because there's
    no top-level "clucene" directory.
    
    An alternative approach might to just ignore the externals,
    as this commit implemented it for the codelite integration:
    
        commit 41c8e0957369b7b53a3b9cf4b4cf1e49a982a414
        Date:   Sat Jan 27 21:54:10 2024 +0200
    
            fix codelite-ide-integration
    
            externals seems to be part of the list of modules now, but I
            don't know how to deal with that, so just ignore them.
    
    (In that case, they wouldn't be part of the project, speeding
    up update of the clang code model after changes, but then not providing
    features like code navigation and autocompletion etc.)
    
    Change-Id: Idb04af5f7445955e5dbf9ec3fd8626bbcb09ab11
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162837
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index ab4f947dc7d6..d4627707ecb8 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -1778,8 +1778,9 @@ class 
QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
             cxxstdversion = cxxstdversionflag[5:]
 
             # create .pro file
-            subdirs_meta_pro.append(lib_name)
-            qt_pro_file = os.path.join(self.base_folder, lib_name, lib_name + 
'.pro')
+            relative_subdir_path = os.path.relpath(lib_loc, 
self.gbuildparser.srcdir)
+            subdirs_meta_pro.append(relative_subdir_path)
+            qt_pro_file = os.path.join(self.base_folder, relative_subdir_path, 
lib_name + '.pro')
             try:
                 content = QtCreatorIntegrationGenerator.pro_template % 
{'sources': sources, 'headers': headers, 'cxxstdversionflag': cxxstdversionflag,
                                                                         
'cxxstdversion': cxxstdversion, 'objcxx_sources': objcxx_sources,
@@ -1796,7 +1797,7 @@ class 
QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
                 print("

", file=sys.stderr)
 
             # create .pro.shared file
-            qt_pro_shared_file = os.path.join(self.base_folder, lib_name, 
lib_name + '.pro.shared')
+            qt_pro_shared_file = os.path.join(self.base_folder, 
relative_subdir_path, lib_name + '.pro.shared')
             try:
                 with open(qt_pro_shared_file, mode) as fproshared:
                     
fproshared.write(self.generate_pro_shared_content(lib_folder))

Reply via email to