Kaydet (Commit) fe37d93a authored tarafından Gulsah Kose's avatar Gulsah Kose Kaydeden (comit) Maxim Monastirsky

tdf#84628 Added per module's macro definitions to eclipsesettingfile.xml

Change-Id: Ic9a7b5d95052917ba8c5fb0f696e4ccf91f0bda4
Signed-off-by: 's avatarGulsah Kose <gulsah.1004@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/20336Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
üst 58482f97
...@@ -311,6 +311,27 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator): ...@@ -311,6 +311,27 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
includedirfile.write('\n'.join(include)) includedirfile.write('\n'.join(include))
includedirfile.close() 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): def create_settings_file(self):
settingsfiletemplate = """\ settingsfiletemplate = """\
...@@ -359,11 +380,21 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator): ...@@ -359,11 +380,21 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
settingsfile = open(os.path.join(modulepath, 'eclipsesettingfile.xml'), 'r') settingsfile = open(os.path.join(modulepath, 'eclipsesettingfile.xml'), 'r')
tempxml = settingsfile.readlines() tempxml = settingsfile.readlines()
tempinclude = open(os.path.join(modulepath, '.eclipsesettingfile'), 'r') tempinclude = open(os.path.join(modulepath, '.eclipsesettingfile'), 'r')
tempmacro = open(os.path.join(modulepath, '.macros'), 'r')
for includepath in tempinclude: for includepath in tempinclude:
if includepath[-1:] == "\n": if includepath[-1:] == "\n":
includepath = includepath[:-1] includepath = includepath[:-1]
templine = "<includepath>%s</includepath>\n" % includepath templine = "<includepath>%s</includepath>\n" % includepath
tempxml.insert(5, templine) 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) tempxml="".join(tempxml)
settingsfile.close settingsfile.close
...@@ -371,10 +402,11 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator): ...@@ -371,10 +402,11 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
settingsfile.write(tempxml) settingsfile.write(tempxml)
settingsfile.close() settingsfile.close()
os.remove(os.path.join(modulepath, '.eclipsesettingfile')) os.remove(os.path.join(modulepath, '.eclipsesettingfile'))
os.remove(os.path.join(modulepath, '.macros'))
def emit(self): def emit(self):
self.create_include_paths() self.create_include_paths()
self.create_macros()
self.create_settings_file() self.create_settings_file()
class DebugIntegrationGenerator(IdeIntegrationGenerator): class DebugIntegrationGenerator(IdeIntegrationGenerator):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment