diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-02 14:40:21 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-02 16:49:02 +0100 |
commit | 49e087ef44d3b7b26baf71469621c0a2135e00a9 (patch) | |
tree | 7aff522f9a034b6c6950a4e13165385458222588 /bin | |
parent | 4c31b4ef2083087a822c3ae648fd09acc67d2f88 (diff) |
vs-ide-integration: make projects' GUIDs stable
Use uuid.uuid5 with a custom URL to generate stable GUIDs. This avoids
glitches in IDE when re-opening the solution after its re-generation
makes some previously opened files to show duplicate entries in IDE's
tabbed UI.
Also drop the UniqueIdentifier elements from .vcxproj.filters files,
which are optional and only used in VS automation [1], so are useless
with randomly-generated GUIDs.
[1] https://docs.microsoft.com/en-us/cpp/build/reference/vcxproj-filters-files
Change-Id: I91dae730286b3187a6ceffcb9ae3afc2b479f4d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124594
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/gbuild-to-ide | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index b66a641b7d34..b7c290cb8285 100755 --- a/bin/gbuild-to-ide +++ b/bin/gbuild-to-ide @@ -23,6 +23,7 @@ import traceback import subprocess from sys import platform import collections +import urllib.parse class GbuildLinkTarget: def __init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, cobjects, cflags, linked_libs): @@ -962,6 +963,10 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator): self.write_solution(os.path.join(self.solution_directory, 'LibreOffice.sln'), all_projects) + @staticmethod + def gen_guid(category, name): + return str(uuid.uuid5(uuid.NAMESPACE_URL, 'vnd.libreoffice.vs-ide-integration:' + category + '/' + urllib.parse.quote(name))).upper() + nmake_project_guid = '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942' nmake_folder_guid = '2150E333-8FDC-42A3-9474-1A3956D46DE8' @@ -1071,7 +1076,7 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator): folder = os.path.dirname(project_path) if not os.path.exists(folder): os.makedirs(folder) - project_guid = str(uuid.uuid4()).upper() + project_guid = self.gen_guid('project', target.short_name()) cxxflags = ' '.join(target.cxxflags) ns = 'http://schemas.microsoft.com/developer/msbuild/2003' ET.register_namespace('', ns) @@ -1232,8 +1237,6 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator): filters_node = ET.SubElement(proj_node, '{%s}ItemGroup' % ns) for proj_filter in filters: filter_node = ET.SubElement(filters_node, '{%s}Filter' % ns, Include=proj_filter) - filter_id_node = ET.SubElement(filter_node, '{%s}UniqueIdentifier' % ns) - filter_id_node.text = '{%s}' % str(uuid.uuid4()) self.write_pretty_xml(proj_node, filters_path) |