summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2016-12-14 22:25:12 +0100
committerjan iversen <jani@documentfoundation.org>2016-12-15 07:54:15 +0000
commitee3f793a2d4e2977a3e952e1439708d8936953d7 (patch)
treed0703686e7379dcb62c2f95f5f09797fff787d45 /bin
parent1f32fdc712e2cd1c9279b15b07b78db27b2eb484 (diff)
tdf#70414: Fix VisualStudio ide integration
'LINKTARGET' is not really helpful as target name. Use name based on makefile's name and hope something like b81ac16e65b311d6e43c05c22c65d2040c9d7e04 is not needed anymore. And if there are still some inconsistencies, we should fix makefile's name. Also, don't use target.name because it's not unique. There can be e.g. both Library_smoketest and CppunitTest_smoketest. Change-Id: I541a1e41f80446e875e1bb2bfa89786e356e0e74 Reviewed-on: https://gerrit.libreoffice.org/32027 Reviewed-by: jan iversen <jani@documentfoundation.org> Tested-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gbuild-to-ide39
1 files changed, 13 insertions, 26 deletions
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 7de2fb48d371..8ee2d134c9fd 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -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:
@@ -715,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:
@@ -732,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)
@@ -781,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)
@@ -807,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,
@@ -919,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: