[Libreoffice-commits] core.git: bin/gbuild-to-ide

jan Iversen jani at documentfoundation.org
Mon Jan 2 16:18:52 UTC 2017


 bin/gbuild-to-ide |   51 ++++++++++++++++++++++++++++++++-------------------
 1 file changed, 32 insertions(+), 19 deletions(-)

New commits:
commit f61f34c900534b960f19425d1fe51608d6a4f12d
Author: jan Iversen <jani at documentfoundation.org>
Date:   Mon Jan 2 17:16:51 2017 +0100

    gbuild-to-ide update to xcode generator
    
    The generator now generates the same groups as xcode, with
    relative paths.
    
    This patch has been tested with l10ntools/pocheck.
    
    Next step is "sal" and actually compile
    
    Change-Id: I02c202434a346918e9ec725bd20e4713fc6fa73e

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 3f326c5..9c13907 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -507,7 +507,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
         IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
 
     def emit(self):
-        self.rootlocation = self.gbuildparser.srcdir + '/osx'
+        self.rootlocation = './'
         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())
@@ -572,14 +572,14 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
         else:
             return 'com.apple.product-type.something'
 
-    counter = 0
+    counter = 16777216
 
     def generate_id(self):
         XcodeIntegrationGenerator.counter = XcodeIntegrationGenerator.counter + 1
         return str('X%07x' % XcodeIntegrationGenerator.counter)
 
     def generate_build_phases(self, modulename):
-        result = [self.sourcesBuildPhaseId]
+        result = [self.sourcesBuildPhaseId, self.copyBuildPhaseId]
         return result
 
     def generate_root_object(self, modulename):
@@ -593,7 +593,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
                   'hasScannedForEncodings': 0,
                   'knownRegions': ['en'],
                   'mainGroup': self.mainGroupId,
-                  'productRefGroup': self.productGroupId,
+                  'productRefGroup': self.productRefGroupId,
                   'projectDirPath': '',
                   'projectRoot': '',
                   'buildConfigurationList': self.configurationListId,
@@ -604,7 +604,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
         result = {'isa': 'PBXFileReference',
                   'explicitFileType': 'compiled.mach-o.executable',
                   'includeInIndex': 0,
-                  'path': 'target',
+                  'path': modulename.name,
                   'sourceTree': 'BUILT_PRODUCTS_DIR'}
         return result
 
@@ -614,8 +614,8 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
                   'buildPhases': self.generate_build_phases(modulename),
                   'buildRules': [],
                   'dependencies': [],
-                  'name': 'target', # modulename,
-                  'productName': 'target', # modulename,
+                  'name': modulename.name, # modulename,
+                  'productName': modulename.name, # modulename,
                   'productReference': self.targetRefId,
                   'productType': self.get_product_type(modulename)}
         return result
@@ -632,7 +632,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
                       'CLANG_WARN_BOOL_CONVERSION': 'YES',
                       'CLANG_WARN_CONSTANT_CONVERSION': 'YES',
                       'CLANG_WARN_DIRECT_OBJC_ISA_USAGE': 'YES_ERROR',
-                      'CLANG_WARN_DOCUMENTATION_COMMENTS': 'YES',
+                      'CLANG_WARN_DOCUMEjNTATION_COMMENTS': 'YES',
                       'CLANG_WARN_EMPTY_BODY': 'YES',
                       'CLANG_WARN_ENUM_CONVERSION': 'YES',
                       'CLANG_WARN_INFINITE_RECURSION': 'YES',
@@ -663,7 +663,8 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
                       'MTL_ENABLE_DEBUG_INFO': 'YES',
                       'ONLY_ACTIVE_ARCH': 'YES',
                       'PRODUCT_NAME': '$(TARGET_NAME)',
-                      'SDKROOT': 'macosx'},
+                      'SDKROOT': 'macosx',
+                      'HEADER_SEARCH_PATHS': modulename.include},
                   'name': 'Debug'}
         return result
 
@@ -676,7 +677,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
 
     def generate_main_group(self, modulename):
         result = {'isa': 'PBXGroup',
-                  'children': [self.subMainGroupId, self.productGroupId],
+                  'children': [self.subMainGroupId, self.productRefGroupId],
                   'sourceTree': '<group>'}
         return result
 
@@ -691,13 +692,13 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
         result = {'isa': 'PBXGroup',
                   'children': self.generate_sub_main_children(modulename),
                   'name': name,
-                  'path': modulename,
+                  'path': name,
                   'sourceTree': '<group>'}
         return result
 
     def generate_product_group(self, modulename):
         result = {'isa': 'PBXGroup',
-                  'children': [self.productReferenceId],
+                  'children': [self.targetRefId],
                   'name': 'Products',
                   'sourceTree': '<group>'}
         return result
@@ -708,7 +709,9 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
 
         for i in module.cxxobjects:
             ref = self.generate_id()
-            self.sourceList[self.generate_id()] = ref
+            ref = 'X0100012'  # Ugly hack for today
+            self.sourceList['X0100011'] = ref # second ugly hack
+            #self.sourceList[self.generate_id()] = ref
             self.sourceRefList[ref] = {'lastKnownFileType': 'sourcecode.cpp.cpp',
                                        'path': i + '.cxx',
                                        'sourceTree': '<group>'}
@@ -720,27 +723,37 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
                   'runOnlyForDeploymentPostprocessing': 0}
         return result
 
+    def generate_copy_build_phase(self, modulename):
+        result = {'isa': 'PBXCopyFilesBuildPhase',
+                  'buildActionMask': 2147483647,
+                  'dstPath' : '',
+                  'dstSubfolderSpec': 0,
+                  'files': [],
+                  'runOnlyForDeploymentPostprocessing': 0}
+        return result
     def generate_project(self, target):
         self.rootObjectId = 'X0100001' # 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 = 'X0100006' # self.generate_id()
+        self.sourcesBuildPhaseId = 'X0100007' #  self.generate_id()
+        self.copyBuildPhaseId = 'X0100008' # self.generate_id()
+        self.targetRefId = 'X0100009' # self.generate_id()
+        self.configurationDebugId = 'X0100010' # self.generate_id()
 
-        self.subMainGroupId = self.generate_id()
         self.productReferenceId = self.generate_id()
         self.productGroupId = self.generate_id()
-        self.targetRefId = self.generate_id()
         self.build_source_list(target)
-        self.sourcesBuildPhaseId = self.generate_id()
-        self.configurationDebugId =  self.generate_id()
         objects = {self.rootObjectId: self.generate_root_object(target),
                    self.targetId: self.generate_target(target),
                    self.targetRefId: self.generate_ref_target(target),
                    self.mainGroupId: self.generate_main_group(target),
                    self.subMainGroupId: self.generate_sub_main_group(target),
-                   self.productGroupId: self.generate_product_group(target),
+                   self.productRefGroupId: self.generate_product_group(target),
                    self.sourcesBuildPhaseId: self.generate_sources_build_phase(target),
+                   self.copyBuildPhaseId: self.generate_copy_build_phase(target),
                    self.configurationListId: self.generate_configuration_list(target),
                    self.configurationDebugId: self.generate_configuration_debug(target)
                    }
@@ -755,7 +768,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
                 name = path
             objects[ref] = {'isa': 'PBXFileReference',
                             'lastKnownFileType': self.sourceRefList[ref]['lastKnownFileType'],
-                            'path': '../' + path,
+                            'path': '../../' + path,
                             'name': name,
                             'sourceTree': '<group>'}
         project = {'archiveVersion': 1,


More information about the Libreoffice-commits mailing list