summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGulsah Kose <gulsah.1004@gmail.com>2015-12-01 21:06:00 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2015-12-30 22:07:55 +0000
commitfe37d93a110cb9941c61fed0c71369a21a7d2765 (patch)
tree64edd381a5c290cfce1824e42c611615ddc01040
parent58482f97c1c54c4008479af46eae47a0b9b6e12b (diff)
tdf#84628 Added per module's macro definitions to eclipsesettingfile.xml
Change-Id: Ic9a7b5d95052917ba8c5fb0f696e4ccf91f0bda4 Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/20336 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
-rwxr-xr-xbin/gbuild-to-ide34
1 files changed, 33 insertions, 1 deletions
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 1df534f10fd8..3c40b551fd24 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):