summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGulsah Kose <gulsah.1004@gmail.com>2015-11-27 20:28:10 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-11-27 22:06:49 +0100
commitbc7a490af90d2ec2e68a6385d6daf9720e9b6dd6 (patch)
treee050b3215b7de00d519283d4e434a49c8abc5bcc
parent4245d367eae1ffdfffb292207f5e0fcf91fc3a22 (diff)
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@gmail.com>
-rw-r--r--.gitignore5
-rw-r--r--Makefile.in3
-rwxr-xr-xbin/gbuild-to-ide123
3 files changed, 90 insertions, 41 deletions
diff --git a/.gitignore b/.gitignore
index 7999ec4d8896..6bab9f9a2f42 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 2a4748eb7270..51a2e61f8252 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 953747e204ef..0ca502217aac 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):