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

Gulsah Kose gulsah.1004 at gmail.com
Fri Nov 27 13:08:16 PST 2015


 .gitignore        |    5 ++
 Makefile.in       |    3 -
 bin/gbuild-to-ide |  123 ++++++++++++++++++++++++++++++++++++------------------
 3 files changed, 90 insertions(+), 41 deletions(-)

New commits:
commit bc7a490af90d2ec2e68a6385d6daf9720e9b6dd6
Author: Gulsah Kose <gulsah.1004 at gmail.com>
Date:   Fri Nov 27 20:28:10 2015 +0200

    tdf#84628 Generated eclipse setting file for per module.
    
    This patch generated a setting file for per module. When imported the
    eclipsesettingfile.xml, underlined include lines are clearing up.
    Setting file includes included file paths for per module and provides
    correct build. .project file generator deleted because eclipse
    is creating .project file and overriding it.
    
    This adds a new property to the parser that stores each module.
    
    Change-Id: Ia10bb37c7c3fdb444a5b79ddf502b962e8ee5736
    Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>

diff --git a/.gitignore b/.gitignore
index 7999ec4..6bab9f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,6 +76,11 @@
 *.kdev4
 .kdev_include_paths
 .directory
+.cproject
+.project
+.settings
+.eclipsesettingfile
+eclipsesettingfile.xml
 
 # things below this point are targeted for elimination
 
diff --git a/Makefile.in b/Makefile.in
index 2a4748e..51a2e61 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -368,7 +368,8 @@ $(foreach ide,\
 	vs2013 \
 	vim \
 	xcode \
-	qtcreator,\
+	qtcreator \
+        eclipsecdt,\
 $(eval $(call gb_Top_GbuildToIdeIntegration,$(ide))))
 
 endif # MAKE_RESTARTS
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 953747e..0ca5022 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -103,8 +103,8 @@ class GbuildParser:
     warningpattern = re.compile('-W\S+')
 
     def __init__(self):
-        (self.makecmd, self.srcdir, self.builddir, self.instdir, self.libs,
-         self.exes, self.libnames, self.exenames, self.target_by_path, self.target_by_location) = ('', '', '', '', [], [], {}, {}, {}, {})
+        (self.makecmd, self.srcdir, self.builddir, self.instdir, self.libs, self.exes,
+         self.libnames, self.exenames, self.target_by_path, self.target_by_location, self.modulenamelist) = ('', '', '', '', [], [], {}, {}, {}, {}, [])
 
     def __mapping_to_dict(self, mapping):
         mapping_dict = {}
@@ -232,7 +232,8 @@ class GbuildParser:
             if len(set(self.target_by_path[path])) > 1:
                 print('fdo#70422: multiple target use dir %s: %s' % (
                     path, ', '.join([target.short_name() for target in set(self.target_by_path[path])])))
-
+        for location in self.target_by_location:
+            self.modulenamelist.append(os.path.split(location)[1])
         return self
 
 
@@ -245,49 +246,91 @@ class IdeIntegrationGenerator:
     def emit(self):
         pass
 
-
 class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
 
     def __init__(self, gbuildparser, ide):
         IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
-        self.oe_cdt = 'org.eclipse.cdt'
-        self.cdt_mb = self.oe_cdt + '.managebuilder.core'
-        self.cdt_core = self.oe_cdt + '.core'
-
-    def generate_project_file(self, name, comment, xmlversion, encoding):
-
-        projectfiletemplate = """
-<?xml version="%(xmlversion)s" encoding="%(encoding)s"?>
-<projectDescription>
-        <name>%(name)s</name>
-        <comment>%(comment)s</comment>
-        <projects>
-        </projects>
-        <buildSpec>
-                <buildCommand>
-                        <name>""" + self.cdt_mb + """.genmakebuilder</name>
-                        <triggers>clean,full,incremental,</triggers>
-                        <arguments>
-                        </arguments>
-                </buildCommand>
-                <buildCommand>
-                        <name>""" + self.cdt_mb + """.ScannerConfigBuilder</name>
-                        <triggers>full,incremental,</triggers>
-                        <arguments>
-                        </arguments>
-                </buildCommand>
-        </buildSpec>
-        <natures>
-                <nature>""" + self.cdt_core + """.cnature</nature>
-                <nature>""" + self.cdt_core + """.ccnature</nature>
-                <nature>""" + self.cdt_mb + """.managedBuildNature</nature>
-                <nature>""" + self.cdt_mb + """.ScannerConfigNature</nature>
-        </natures>
-</projectDescription>
-"""
 
-        return projectfiletemplate % {'name': name, 'comment': comment, 'xmlversion': xmlversion, 'encoding': encoding}
+    def create_include_paths(self):
+        for module in self.gbuildparser.modulenamelist:
+            modulepath = os.path.join(self.gbuildparser.builddir, module)
+            includedirfile = open(os.path.join(modulepath, '.eclipsesettingfile'), 'w')
+            modulelibs = []
+            for lib in self.gbuildparser.target_by_path.keys():
+                if lib.startswith(module+'/'):
+                    modulelibs.append(lib)
+            include = set()
+            for lib in modulelibs:
+                for target in self.gbuildparser.target_by_path[lib]:
+                    include |= set(target.include)
+            includedirfile.write('\n'.join(include))
+            includedirfile.close()
+
+    def create_settings_file(self):
+
+        settingsfiletemplate = """\
+<?xml version="1.0" encoding="UTF-8"?>
+<cdtprojectproperties>
+<section name="org.eclipse.cdt.internal.ui.wizards.settingswizards.IncludePaths">
+<language name="C++ Source File">
+
+
+</language>
+<language name="C Source File">
+
+</language>
+<language name="Object File">
+
+</language>
+<language name="Assembly Source File">
+
+</language>
+</section>
+<section name="org.eclipse.cdt.internal.ui.wizards.settingswizards.Macros">
+<language name="C++ Source File">
+
+</language>
+<language name="C Source File">
+
+</language>
+<language name="Object File">
+
+</language>
+<language name="Assembly Source File">
+
+</language>
+</section>
+</cdtprojectproperties>
+""" 
+
+        for module in self.gbuildparser.modulenamelist:
+            tempxml = []
+            modulepath = os.path.join(self.gbuildparser.builddir, module)
+
+            settingsfile = open(os.path.join(modulepath, 'eclipsesettingfile.xml'), 'w')
+            settingsfile.write(settingsfiletemplate)
+            settingsfile.close()
+
+            settingsfile = open(os.path.join(modulepath, 'eclipsesettingfile.xml'), 'r')
+            tempxml = settingsfile.readlines()
+            tempinclude = open(os.path.join(modulepath, '.eclipsesettingfile'), 'r')
+            for includepath in tempinclude:
+                if includepath[-1:] == "\n":
+                    includepath = includepath[:-1]
+                templine = "<includepath>%s</includepath>\n" % includepath
+                tempxml.insert(5, templine)
+            tempxml="".join(tempxml)
+            settingsfile.close
+
+            settingsfile = open(os.path.join(modulepath, 'eclipsesettingfile.xml'), 'w')
+            settingsfile.write(tempxml)
+            settingsfile.close()
+            os.remove(os.path.join(modulepath, '.eclipsesettingfile'))
+
 
+    def emit(self):
+        self.create_include_paths()
+        self.create_settings_file() 
 
 class DebugIntegrationGenerator(IdeIntegrationGenerator):
 


More information about the Libreoffice-commits mailing list