Kaydet (Commit) f42751f5 authored tarafından jan Iversen's avatar jan Iversen

gbuild-to-ide, fixed typo and changed xcode generator

target_name used - instead of _ which caused solutions to have a new name

xcode generator changed to use fixed id for the major groups, in
order to facilitate debugging of the solutions.

Change-Id: I444c74f37dc471625fa3f28240678f9968d1e710
üst 99f3f180
...@@ -44,7 +44,7 @@ class GbuildLinkTarget: ...@@ -44,7 +44,7 @@ class GbuildLinkTarget:
return self.name return self.name
def target_name(self): def target_name(self):
return self.build_type + '-' + self.name return self.build_type + '_' + self.name
def short_name(self): def short_name(self):
return self.build_type + ' ' + self.name return self.build_type + ' ' + self.name
...@@ -503,6 +503,23 @@ VersionControl=kdevgit ...@@ -503,6 +503,23 @@ VersionControl=kdevgit
class XcodeIntegrationGenerator(IdeIntegrationGenerator): class XcodeIntegrationGenerator(IdeIntegrationGenerator):
def __init__(self, gbuildparser, ide):
IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
def emit(self):
self.rootlocation = self.gbuildparser.srcdir + '/osx'
for location in self.gbuildparser.target_by_location:
for target in self.gbuildparser.target_by_location[location]:
xcodeprojdir = os.path.join(location, '%s.xcodeproj' % target.target_name())
try:
os.mkdir(xcodeprojdir)
except:
pass
p = self.generate_project(target)
with open(os.path.join(xcodeprojdir, 'project.pbxproj'), 'w') as f:
f.write('// !$*UTF8*$!\n')
self.write_dict(p, f, 0)
def indent(self, file, level): def indent(self, file, level):
if level == 0: if level == 0:
return return
...@@ -545,10 +562,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -545,10 +562,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
file.write(',') file.write(',')
file.write(')') file.write(')')
def write_dict_to_plist(self, dict, file):
file.write('// !$*UTF8*$!\n')
self.write_dict(dict, file, 0)
def get_product_type(self, modulename): def get_product_type(self, modulename):
if modulename.build_type == 'Library': if modulename.build_type == 'Library':
return 'com.apple.product-type.library.dynamic' return 'com.apple.product-type.library.dynamic'
...@@ -708,17 +721,18 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -708,17 +721,18 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
return result return result
def generate_project(self, target): def generate_project(self, target):
self.rootObjectId = self.generate_id() self.rootObjectId = 'X0100001' # self.generate_id()
self.mainGroupId = self.generate_id() self.mainGroupId = 'X0100002' # self.generate_id()
self.targetId = 'X0100003' # self.generate_id()
self.configurationListId = 'X0100004' # self.generate_id()
self.productRefGroupId = 'X0100005' # self.generate_id()
self.subMainGroupId = self.generate_id() self.subMainGroupId = self.generate_id()
self.productReferenceId = self.generate_id() self.productReferenceId = self.generate_id()
self.productRefGroupId = self.generate_id()
self.productGroupId = self.generate_id() self.productGroupId = self.generate_id()
self.targetId = self.generate_id()
self.targetRefId = self.generate_id() self.targetRefId = self.generate_id()
self.build_source_list(target) self.build_source_list(target)
self.sourcesBuildPhaseId = self.generate_id() self.sourcesBuildPhaseId = self.generate_id()
self.configurationListId = self.generate_id()
self.configurationDebugId = self.generate_id() self.configurationDebugId = self.generate_id()
objects = {self.rootObjectId: self.generate_root_object(target), objects = {self.rootObjectId: self.generate_root_object(target),
self.targetId: self.generate_target(target), self.targetId: self.generate_target(target),
...@@ -751,29 +765,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -751,29 +765,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
'rootObject': self.rootObjectId} 'rootObject': self.rootObjectId}
return project return project
# For some reverse-engineered documentation on the project.pbxproj format,
# see http://www.monobjc.net/xcode-project-file-format.html .
def write_xcodeproj(self, moduledir, target):
xcodeprojdir = os.path.join(moduledir, '%s.xcodeproj' % target.target_name())
try:
os.mkdir(xcodeprojdir)
except:
pass
self.write_dict_to_plist(self.generate_project(target),
open(os.path.join(xcodeprojdir, 'project.pbxproj'), 'w'))
def __init__(self, gbuildparser, ide):
IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
def emit(self):
self.rootlocation = './'
for location in self.gbuildparser.target_by_location:
# module = location.split('/')[-1]
# module_directory = os.path.join(self.rootlocation, module)
for target in self.gbuildparser.target_by_location[location]:
# project_path = os.path.join(module_directory, '%s.pbxroj' % target.target_name())
self.write_xcodeproj(location, target)
class VisualStudioIntegrationGenerator(IdeIntegrationGenerator): class VisualStudioIntegrationGenerator(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