[Libreoffice-commits] core.git: bin/gbuild-to-ide
Gulsah Kose
gulsah.1004 at gmail.com
Wed Dec 30 14:08:30 PST 2015
bin/gbuild-to-ide | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
New commits:
commit fe37d93a110cb9941c61fed0c71369a21a7d2765
Author: Gulsah Kose <gulsah.1004 at gmail.com>
Date: Tue Dec 1 21:06:00 2015 +0200
tdf#84628 Added per module's macro definitions to eclipsesettingfile.xml
Change-Id: Ic9a7b5d95052917ba8c5fb0f696e4ccf91f0bda4
Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/20336
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 1df534f..3c40b55 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -311,6 +311,27 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
includedirfile.write('\n'.join(include))
includedirfile.close()
+
+ def create_macros(self):
+ for module in self.gbuildparser.modulenamelist:
+ modulepath = os.path.join(self.gbuildparser.builddir, module)
+ macrofile = open(os.path.join(modulepath, '.macros'), 'w')
+ modulelibs = []
+ for lib in self.gbuildparser.target_by_path.keys():
+ if lib.startswith(module+'/'):
+ modulelibs.append(lib)
+ define = []
+ defineset = set()
+ for lib in modulelibs:
+ for target in self.gbuildparser.target_by_path[lib]:
+ for i in target.defs.keys():
+ tmp = str(i) +','+str(target.defs[i])
+ if tmp not in defineset:
+ defineset.add(tmp)
+ macrofile.write('\n'.join(defineset))
+ macrofile.close()
+
+
def create_settings_file(self):
settingsfiletemplate = """\
@@ -359,11 +380,21 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
settingsfile = open(os.path.join(modulepath, 'eclipsesettingfile.xml'), 'r')
tempxml = settingsfile.readlines()
tempinclude = open(os.path.join(modulepath, '.eclipsesettingfile'), 'r')
+ tempmacro = open(os.path.join(modulepath, '.macros'), 'r')
for includepath in tempinclude:
if includepath[-1:] == "\n":
includepath = includepath[:-1]
templine = "<includepath>%s</includepath>\n" % includepath
tempxml.insert(5, templine)
+
+ for line in tempmacro:
+ macroskeyvalue = line.split(',')
+ macrokey = macroskeyvalue[0]
+ macrovalue = macroskeyvalue[1]
+ if macrovalue[-1:] == "\n":
+ macrovalue = macrovalue[:-1]
+ templine = "<macro><name>%s</name><value>%s</value></macro>\n" %(macrokey, macrovalue)
+ tempxml.insert(-13, templine)
tempxml="".join(tempxml)
settingsfile.close
@@ -371,10 +402,11 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
settingsfile.write(tempxml)
settingsfile.close()
os.remove(os.path.join(modulepath, '.eclipsesettingfile'))
-
+ os.remove(os.path.join(modulepath, '.macros'))
def emit(self):
self.create_include_paths()
+ self.create_macros()
self.create_settings_file()
class DebugIntegrationGenerator(IdeIntegrationGenerator):
More information about the Libreoffice-commits
mailing list