[Libreoffice-commits] core.git: 2 commits - bin/gbuild-to-ideNS Makefile.in

jan Iversen jani at libreoffice.org
Mon Feb 20 07:33:26 UTC 2017


 Makefile.in         |    4 ++--
 bin/gbuild-to-ideNS |   51 +++++++++++++++++++++++----------------------------
 2 files changed, 25 insertions(+), 30 deletions(-)

New commits:
commit 5382fdaf2d651a393a1caf2e09351c77cb84c753
Author: jan Iversen <jani at libreoffice.org>
Date:   Mon Feb 20 07:50:33 2017 +0100

    Reverted ide generator script.
    
    Copied gbuildt-o-ide from December 14 to
    gbuild-to-ideNS (script for old generators).
    
    Change-Id: I5900aedeb22f2eb1ef5b0e3672175df34845a063

diff --git a/bin/gbuild-to-ideNS b/bin/gbuild-to-ideNS
index 7fee5a4..e18f3bd 100755
--- a/bin/gbuild-to-ideNS
+++ b/bin/gbuild-to-ideNS
@@ -39,47 +39,40 @@ class GbuildLinkTarget:
 
 
 class GbuildLib(GbuildLinkTarget):
-    def __init__(self, name, library, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs):
+    def __init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs):
         GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs)
-        self.library = library
 
     def short_name(self):
         """Return the short name of target based on the Library_* makefile name"""
         return 'Library %s' % self.name
 
     def target_name(self):
-        return 'Library_%s' % self.library
+        return 'Library_%s' % self.name
 
     def library_name(self):
-        return self.library
+        return self.name
 
 class GbuildTest(GbuildLinkTarget):
-    def __init__(self, name, test, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs):
+    def __init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs):
         GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs)
-        self.test = test
 
     def short_name(self):
         """Return the short name of target based n the CppunitTest_* makefile names"""
         return 'CppunitTest %s' % self.name
 
     def target_name(self):
-        return 'CppunitTest_%s' % self.test
-
-    def test_name(self):
-        return self.test
-
+        return 'CppunitTest_%s' % self.name
 
 class GbuildExe(GbuildLinkTarget):
-    def __init__(self, name, executable, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs):
+    def __init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs):
         GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs)
-        self.executable = executable
 
     def short_name(self):
         """Return the short name of target based on the Executable_* makefile name"""
         return 'Executable %s' % self.name
 
     def target_name(self):
-        return 'Executable_%s' % self.executable
+        return 'Executable_%s' % self.name
 
 
 class GbuildParser:
@@ -88,7 +81,7 @@ class GbuildParser:
         self.binpath = os.path.dirname(os.environ['GPERF']) # woha, this is quite a hack
         (self.srcdir, self.builddir, self.instdir, self.workdir) = (os.environ['SRCDIR'], os.environ['BUILDDIR'], os.environ['INSTDIR'], os.environ['WORKDIR'])
         (self.libs, self.exes, self.tests, self.modulenamelist) = ([], [], [], [])
-        (self.libnames, self.exenames, self.testnames, self.target_by_path, self.target_by_location) = ({}, {}, {}, {}, {})
+        (self.target_by_path, self.target_by_location) = ({}, {})
 
     includepattern = re.compile('-I(\S+)')
     isystempattern = re.compile('-isystem\s*(\S+)')
@@ -129,7 +122,6 @@ class GbuildParser:
         (foundincludes, foundisystem) = GbuildParser.__split_includes(json['INCLUDE'])
         return GbuildLib(
             GbuildParser.libpattern.match(os.path.basename(json['MAKEFILE'])).group(1),
-            json['LINKTARGET'],
             os.path.dirname(json['MAKEFILE']),
             foundincludes,
             foundisystem,
@@ -151,7 +143,6 @@ class GbuildParser:
 
         return GbuildTest(
             testname,
-            json['LINKTARGET'],
             os.path.dirname(json['MAKEFILE']),
             foundincludes,
             foundisystem,
@@ -165,7 +156,6 @@ class GbuildParser:
         (foundincludes, foundisystem) = GbuildParser.__split_includes(json['INCLUDE'])
         return GbuildExe(
             GbuildParser.exepattern.match(os.path.basename(json['MAKEFILE'])).group(1),
-            json['LINKTARGET'],
             os.path.dirname(json['MAKEFILE']),
             foundincludes,
             foundisystem,
@@ -178,17 +168,14 @@ class GbuildParser:
         for jsonfilename in os.listdir(os.path.join(self.workdir, 'GbuildToJson', 'Library')):
             with open(os.path.join(self.workdir, 'GbuildToJson', 'Library', jsonfilename), 'r') as f:
                 lib = self.__lib_from_json(json.load(f))
-                self.libnames[lib.library] = lib.name
                 self.libs.append(lib)
         for jsonfilename in os.listdir(os.path.join(self.workdir, 'GbuildToJson', 'Executable')):
             with open(os.path.join(self.workdir, 'GbuildToJson', 'Executable', jsonfilename), 'r') as f:
                 exe = self.__exe_from_json(json.load(f))
-                self.exenames[exe.executable] = exe.name
                 self.exes.append(exe)
         for jsonfilename in os.listdir(os.path.join(self.workdir, 'GbuildToJson', 'CppunitTest')):
             with open(os.path.join(self.workdir, 'GbuildToJson', 'CppunitTest', jsonfilename), 'r') as f:
                 test = self.__test_from_json(json.load(f))
-                self.testnames[test.test] = test.name
                 self.tests.append(test)
         for target in set(self.libs) | set(self.exes) | set(self.tests):
             if target.location not in self.target_by_location:
@@ -199,6 +186,10 @@ class GbuildParser:
                 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(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
@@ -711,7 +702,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
     # 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.name)
+        xcodeprojdir = os.path.join(moduledir, '%s.xcodeproj' % target.target_name())
         try:
             os.mkdir(xcodeprojdir)
         except:
@@ -728,7 +719,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
             # 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)
+                # project_path = os.path.join(module_directory, '%s.pbxroj' % target.target_name())
                 self.write_xcodeproj(location, target)
 
 
@@ -777,7 +768,7 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
             module = location.split('/')[-1]
             module_directory = os.path.join(self.solution_directory, module)
             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.target_name())
                 project_guid = self.write_project(project_path, target)
                 p = VisualStudioIntegrationGenerator.Project(project_guid, target, project_path)
                 projects.append(p)
@@ -803,7 +794,7 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
             f.write('Microsoft Visual Studio Solution File, Format Version 12.00\n')
             for project in projects:
                 target = project.target
-                print(' %s' % target.name, end='')
+                print(' %s' % target.target_name(), end='')
                 proj_path = os.path.relpath(project.path, os.path.abspath(os.path.dirname(solution_path)))
                 f.write('Project("{%s}") = "%s", "%s", "{%s}"\n' %
                         (VisualStudioIntegrationGenerator.nmake_project_guid,
@@ -915,7 +906,7 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
             if os.path.isfile(cxxfile):
                 ET.SubElement(cxxobjects_node, '{%s}ClCompile' % ns, Include=cxxfile)
             else:
-                print('Source %s in project %s does not exist' % (cxxfile, target.name))
+                print('Source %s in project %s does not exist' % (cxxfile, target.target_name()))
 
         includes_node = ET.SubElement(proj_node, '{%s}ItemGroup' % ns)
         for cxxobject in target.cxxobjects:
@@ -1616,14 +1607,18 @@ SUBDIRS = %(subdirs)s
 """
 
 
-if __name__ == '__main__':
+def get_options():
     parser = argparse.ArgumentParser(
         description='LibreOffice gbuild IDE project generator')
     parser.add_argument('--ide', dest='ide', required=True,
                         help='the IDE to generate project files for')
     parser.add_argument('--make', dest='makecmd', required=True,
                         help='the command to execute make')
-    args = parser.parse_args()
+    return parser.parse_args()
+
+
+if __name__ == '__main__':
+    args = get_options()
     # FIXME: Hack
     if args.makecmd == 'make':
         args.makecmd = '/usr/bin/make'
commit 433fb310e0774f6d27e7ea7fb0048c32237a76da
Author: jan Iversen <jani at libreoffice.org>
Date:   Mon Feb 20 07:42:12 2017 +0100

    use old ide generator for vs2013 and vs2015
    
    Currently we have 2 generator python scripts,
    Makefile.in selects which one is to be used (old/new).
    
    Change-Id: I1f7f8c216a97e273ce1b8e5149d1ffc80ab1277a

diff --git a/Makefile.in b/Makefile.in
index 7ae46ae..6c3149c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -424,14 +424,14 @@ endef
 
 $(foreach ide,\
 	debug \
-	vs2013 \
-	vs2015 \
 	testIde \
 	xcode, \
 $(eval $(call gb_Top_GbuildToIdeIntegration,$(ide))))
 
 $(foreach ide,\
 	codelite \
+	vs2013 \
+	vs2015 \
 	kdevelop \
 	vim \
 	qtcreator \


More information about the Libreoffice-commits mailing list