[Libreoffice-commits] core.git: bin/gbuild-to-ide

Federico Bassini kurogan21 at gmail.com
Mon Jan 16 11:47:16 UTC 2017


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

New commits:
commit de409aeed2e1efad47a25794d7a1ffba0272e35c
Author: Federico Bassini <kurogan21 at gmail.com>
Date:   Mon Jan 16 12:08:54 2017 +0100

    gbuildparser in gbuild-to-ide - added headers of the include module
    
    this is the version of gbuild-to-ide that implement a capture 1 of the project "keeping contributors"
    it adds all the headers files (.hxx,.h,.hpp) content in the folder include in moduleDict['include']['headers']
    there is an error in the VisualStudioIntegrationGeneration.emit() because there is a for that work only with the modules[<module_name>]['targets']
    whatever i'll do a comment in the code(i added a if statement!)with the error description that generate this error to not forget!
    
    Change-Id: I7cd6a15482d99406573dbd9bd095987772377cff
    Reviewed-on: https://gerrit.libreoffice.org/33162
    Reviewed-by: jan iversen <jani at documentfoundation.org>
    Tested-by: jan iversen <jani at documentfoundation.org>

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 2d9e721..d9e2535 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -20,6 +20,7 @@ import xml.etree.ElementTree as ET
 import xml.dom.minidom as minidom
 import traceback
 import collections
+import subprocess
 
 class GbuildLinkTarget:
     def __init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs,
@@ -141,11 +142,22 @@ class GbuildParser:
                         moduleDict[module] = {'targets': set()}
                     moduleDict[module]['targets'] |= set([newObj])
 
+        moduleDict['include']={'headers':self.find_all_headers_include_git(), 'targets': {}}
         for module in sorted(moduleDict):
             self.modules[module] = moduleDict[module]
         return self
 
 
+    def find_all_headers_include_git(self):
+        cmdResult1=subprocess.Popen(('git', 'ls-files', 'include'), cwd=self.srcdir,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+        cmdResult2=subprocess.check_output(('grep', '-i', '-E', '".*\.hxx$|.*\.h$|.*\.hpp$"'),cwd=self.srcdir,stdin=cmdResult1.stdout)
+
+        #decode from byte to string
+        allfiles=[]
+        for file in cmdResult2.splitlines():
+            allfiles.append(file.decode()[8:])
+        return allfiles
+
 class IdeIntegrationGenerator:
 
     def __init__(self, gbuildparser, ide):
@@ -161,6 +173,8 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
 
     def create_include_paths(self):
         for module in self.gbuildparser.modules:
+            if module == 'include':
+                continue
             modulepath = os.path.join(self.gbuildparser.builddir, module)
             includedirfile = open(os.path.join(modulepath, '.eclipsesettingfile'), 'w')
             modulelibs = []
@@ -177,6 +191,8 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
 
     def create_macros(self):
         for module in self.gbuildparser.modules:
+            if module == 'include':
+                continue
             modulepath = os.path.join(self.gbuildparser.builddir, module)
             macrofile = open(os.path.join(modulepath, '.macros'), 'w')
             modulelibs = []
@@ -233,6 +249,8 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
 """
 
         for module in self.gbuildparser.modules:
+            if module == 'include':
+                continue
             tempxml = []
             modulepath = os.path.join(self.gbuildparser.builddir, module)
 
@@ -832,13 +850,14 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
         for module in self.gbuildparser.modules:
             projects = []
             module_directory = os.path.join(self.solution_directory, module)
-            for target in self.gbuildparser.modules[module]['targets']:
-                project_path = os.path.join(module_directory, '%s.vcxproj' % target.target_name)
-                project_guid = self.write_project(project_path, target)
-                p = VisualStudioIntegrationGenerator.Project(project_guid, target, project_path)
-                projects.append(p)
-            self.write_solution(os.path.join(module_directory, '%s.sln' % module), projects)
-            all_projects += projects
+            if module != 'include': #FIXME
+                for target in self.gbuildparser.modules[module]['targets']:
+                    project_path = os.path.join(module_directory, '%s.vcxproj' % target.target_name)
+                    project_guid = self.write_project(project_path, target)
+                    p = VisualStudioIntegrationGenerator.Project(project_guid, target, project_path)
+                    projects.append(p)
+                self.write_solution(os.path.join(module_directory, '%s.sln' % module), projects)
+                all_projects += projects
 
         self.write_solution(os.path.join(self.solution_directory, 'LibreOffice.sln'), all_projects)
 
@@ -1683,6 +1702,9 @@ def get_options():
                         help='the IDE to generate project files for')
     parser.add_argument('--make', dest='makecmd', required=True,
                         help='the command to execute make')
+    #add to debug a new functions in the project keeping contributors
+    parser.add_argument('--debug',dest='debug',required=False,
+                        help='debug the new functions')
     return parser.parse_args()
 
 
@@ -1692,6 +1714,7 @@ if __name__ == '__main__':
     if args.makecmd == 'make':
         args.makecmd = '/usr/bin/make'
 
+
     paths = {}
     generators = {
         # Supported platforms


More information about the Libreoffice-commits mailing list