Kaydet (Commit) 80bbca88 authored tarafından Yurii Kolesnykov's avatar Yurii Kolesnykov Kaydeden (comit) Michael Stahl

An attempt to fix xcode-ide-integration

Added more Xcode specific files to .gitignore.
Made some properties common in gbuil-to-ide to avoid code duplication/bugs.
Xcode projects are broken for now.

Change-Id: I9530435ffe54158ae68ddae0581ac68f968af235
Reviewed-on: https://gerrit.libreoffice.org/15694Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst b7c8c337
...@@ -97,10 +97,22 @@ __pycache__ ...@@ -97,10 +97,22 @@ __pycache__
.DS_Store .DS_Store
# Xcode specific # Xcode specific
build build/
project.xcworkspace *.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata xcuserdata
*.xuserstate *.xcuserstate
*.xccheckout
*.moved-aside
DerivedData
*.xcodeproj
*.xcworkspace
# MSVS specific # MSVS specific
*/Debug */Debug
......
...@@ -103,7 +103,7 @@ class GbuildParser: ...@@ -103,7 +103,7 @@ class GbuildParser:
def __init__(self): def __init__(self):
(self.makecmd, self.srcdir, self.builddir, self.instdir, self.libs, (self.makecmd, self.srcdir, self.builddir, self.instdir, self.libs,
self.exes, self.libnames, self.exenames) = ('', '', '', '', [], [], {}, {}) self.exes, self.libnames, self.exenames, self.target_by_path, self.target_by_location) = ('', '', '', '', [], [], {}, {}, {}, {})
def __mapping_to_dict(self, mapping): def __mapping_to_dict(self, mapping):
mapping_dict = {} mapping_dict = {}
...@@ -215,6 +215,21 @@ class GbuildParser: ...@@ -215,6 +215,21 @@ class GbuildParser:
self.exenames = self.__mapping_to_dict(exenamesmatch.group(1)) self.exenames = self.__mapping_to_dict(exenamesmatch.group(1))
continue continue
state = GbuildParserState() state = GbuildParserState()
for target in set(self.libs) | set(self.exes):
if target.location not in self.target_by_location:
self.target_by_location[target.location] = set()
self.target_by_location[target.location] |= set([target])
for cxx in target.cxxobjects:
path = '/'.join(cxx.split('/')[:-1])
if path not in self.target_by_path:
self.target_by_path[path] = set()
self.target_by_path[path] |= set([target])
for path in self.target_by_path:
if len(self.target_by_path[path]) > 1:
print('fdo#70422: multiple target use dir %s: %s' % (
path, ', '.join([target.short_name() for target in self.target_by_path[path]])))
return self return self
...@@ -462,40 +477,26 @@ VersionControl=kdevgit ...@@ -462,40 +477,26 @@ VersionControl=kdevgit
def write_includepaths(self, path): def write_includepaths(self, path):
includedirfile = open(os.path.join(path, '.kdev_include_paths'), 'w') includedirfile = open(os.path.join(path, '.kdev_include_paths'), 'w')
include = set() include = set()
for target in self.target_by_path[path]: for target in self.gbuildparser.target_by_path[path]:
include |= set(target.include) include |= set(target.include)
includedirfile.write('\n'.join(include)) includedirfile.write('\n'.join(include))
includedirfile.close() includedirfile.close()
def __init__(self, gbuildparser, ide): def __init__(self, gbuildparser, ide):
IdeIntegrationGenerator.__init__(self, gbuildparser, ide) IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
self.target_by_location = {}
self.target_by_path = {}
for target in set(self.gbuildparser.libs) | set(self.gbuildparser.exes):
if target.location not in self.target_by_location:
self.target_by_location[target.location] = set()
self.target_by_location[target.location] |= set([target])
for cxx in target.cxxobjects:
path = '/'.join(cxx.split('/')[:-1])
if path not in self.target_by_path:
self.target_by_path[path] = set()
self.target_by_path[path] |= set([target])
for path in self.target_by_path:
if len(self.target_by_path[path]) > 1:
print('fdo#70422: multiple target use dir %s: %s' % (
path, ', '.join([target.short_name() for target in self.target_by_path[path]])))
def emit(self): def emit(self):
for path in self.target_by_path: for path in self.gbuildparser.target_by_path:
self.write_includepaths(path) self.write_includepaths(path)
for location in self.target_by_location: for location in self.gbuildparser.target_by_location:
for f in os.listdir(location): for f in os.listdir(location):
if f.endswith('.kdev4'): if f.endswith('.kdev4'):
try: try:
os.remove(os.path.join(location, f)) os.remove(os.path.join(location, f))
except OSError: except OSError:
shutil.rmtree(os.path.join(location, f)) shutil.rmtree(os.path.join(location, f))
for location in self.target_by_location: for location in self.gbuildparser.target_by_location:
modulename = os.path.split(location)[1] modulename = os.path.split(location)[1]
self.write_modulestub(location, modulename) self.write_modulestub(location, modulename)
self.write_modulebeef(location, modulename) self.write_modulebeef(location, modulename)
...@@ -601,10 +602,11 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -601,10 +602,11 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
'sourceTree': '<group>'} 'sourceTree': '<group>'}
return result return result
def build_source_list(self, modulename): def build_source_list(self, module):
self.sourceList = {}
self.sourceRefList = {} self.sourceRefList = {}
for i in self.gbuildparser.libs[modulename].cxxobjects: self.sourceList = {}
for i in module.cxxobjects:
ref = self.generate_id() ref = self.generate_id()
self.sourceList[self.generate_id()] = ref self.sourceList[self.generate_id()] = ref
self.sourceRefList[ref] = {'lastKnownFileType': 'sourcecode.cpp.cpp', self.sourceRefList[ref] = {'lastKnownFileType': 'sourcecode.cpp.cpp',
...@@ -618,7 +620,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -618,7 +620,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
'runOnlyForDeploymentPostprocessing': 0} 'runOnlyForDeploymentPostprocessing': 0}
return result return result
def generate_project(self, modulename): def generate_project(self, target):
self.rootObjectId = self.generate_id() self.rootObjectId = self.generate_id()
self.mainGroupId = self.generate_id() self.mainGroupId = self.generate_id()
self.subMainGroupId = self.generate_id() self.subMainGroupId = self.generate_id()
...@@ -626,14 +628,14 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -626,14 +628,14 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
self.productRefGroupId = self.generate_id() self.productRefGroupId = self.generate_id()
self.productGroupId = self.generate_id() self.productGroupId = self.generate_id()
self.targetId = self.generate_id() self.targetId = self.generate_id()
self.build_source_list(modulename) self.build_source_list(target)
self.sourcesBuildPhaseId = self.generate_id() self.sourcesBuildPhaseId = self.generate_id()
objects = {self.rootObjectId: self.generate_root_object(modulename), objects = {self.rootObjectId: self.generate_root_object(target),
self.targetId: self.generate_target(modulename), self.targetId: self.generate_target(target),
self.mainGroupId: self.generate_main_group(modulename), self.mainGroupId: self.generate_main_group(target),
self.subMainGroupId: self.generate_sub_main_group(modulename), self.subMainGroupId: self.generate_sub_main_group(target),
self.productGroupId: self.generate_product_group(modulename), self.productGroupId: self.generate_product_group(target),
self.sourcesBuildPhaseId: self.generate_sources_build_phase(modulename) self.sourcesBuildPhaseId: self.generate_sources_build_phase(target)
} }
for i in self.sourceList.keys(): for i in self.sourceList.keys():
ref = self.sourceList[i] ref = self.sourceList[i]
...@@ -651,28 +653,26 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -651,28 +653,26 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
# For some reverse-engineered documentation on the project.pbxproj format, # For some reverse-engineered documentation on the project.pbxproj format,
# see http://www.monobjc.net/xcode-project-file-format.html . # see http://www.monobjc.net/xcode-project-file-format.html .
def write_xcodeproj(self, moduledir, modulename): def write_xcodeproj(self, moduledir, target):
xcodeprojdir = os.path.join(moduledir, '%s.xcodeproj' % modulename) xcodeprojdir = os.path.join(moduledir, '%s.xcodeproj' % target.name)
try: try:
os.mkdir(xcodeprojdir) os.mkdir(xcodeprojdir)
except: except:
pass pass
self.write_dict_to_plist(self.generate_project(modulename), self.write_dict_to_plist(self.generate_project(target),
open(os.path.join(xcodeprojdir, 'project.pbxproj'), 'w')) open(os.path.join(xcodeprojdir, 'project.pbxproj'), 'w'))
def __init__(self, gbuildparser, ide): def __init__(self, gbuildparser, ide):
IdeIntegrationGenerator.__init__(self, gbuildparser, ide) IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
self.target_by_location = {}
for target in set(self.gbuildparser.libs) | set(self.gbuildparser.exes):
if target.location not in self.target_by_location:
self.target_by_location[target.location] = set()
self.target_by_location[target.location] |= set([target])
def emit(self): def emit(self):
for location in self.target_by_location: self.rootlocation = './'
modulename = os.path.split(location)[1] for location in self.gbuildparser.target_by_location:
self.write_xcodeproj(location, modulename) 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.name)
self.write_xcodeproj(location, target)
class VisualStudioIntegrationGenerator(IdeIntegrationGenerator): class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
...@@ -697,13 +697,6 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator): ...@@ -697,13 +697,6 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
'rebuild': self.module_make_command('clean unitcheck slowcheck subsequentcheck') 'rebuild': self.module_make_command('clean unitcheck slowcheck subsequentcheck')
} }
} }
self.target_by_location = {}
for target in set(self.gbuildparser.libs) | set(self.gbuildparser.exes):
if target.is_empty():
continue
if target.location not in self.target_by_location:
self.target_by_location[target.location] = set()
self.target_by_location[target.location] |= set([target])
def retrieve_toolset(self, ide): def retrieve_toolset(self, ide):
ide_toolset_map = {'vs2012': 'v110', 'vs2013': 'v120'} ide_toolset_map = {'vs2012': 'v110', 'vs2013': 'v120'}
...@@ -721,11 +714,11 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator): ...@@ -721,11 +714,11 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
def emit(self): def emit(self):
all_projects = [] all_projects = []
for location in self.target_by_location: for location in self.gbuildparser.target_by_location:
projects = [] projects = []
module = location.split('/')[-1] module = location.split('/')[-1]
module_directory = os.path.join(self.solution_directory, module) module_directory = os.path.join(self.solution_directory, module)
for target in self.target_by_location[location]: for target in self.gbuildparser.target_by_location[location]:
project_path = os.path.join(module_directory, '%s.vcxproj' % target.name) project_path = os.path.join(module_directory, '%s.vcxproj' % target.name)
project_guid = self.write_project(project_path, target) project_guid = self.write_project(project_path, target)
p = VisualStudioIntegrationGenerator.Project(project_guid, target, project_path) p = VisualStudioIntegrationGenerator.Project(project_guid, target, project_path)
......
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