Change: Wrap all files to be included in the .msi in a ComponentGroupRef

With this, all the files are organised into Components,
each of which points to a Directory defined in the StandardDirectory element.
This simplifies the Feature element considerable as only thing it needs to
include everything in the built msi is a reference to `ApplicationComponents`
This commit is contained in:
JKarasti 2024-09-23 21:57:38 +03:00 committed by Alex Pyrgiotis
parent 265c1dde97
commit 41e78c907f
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -64,26 +64,17 @@ def build_dir_xml(root, data):
def build_components_xml(root, data): def build_components_xml(root, data):
component_ids = [] component_el = ET.SubElement(
if "component_id" in data: root,
component_ids.append(data["component_id"]) "Component",
Id=data["component_id"],
if "component_guid" in data: Guid=data["component_guid"],
dir_ref_el = ET.SubElement(root, "DirectoryRef", Id=data["directory_id"]) Directory=data["directory_id"],
component_el = ET.SubElement( )
dir_ref_el, for filename in data["files"]:
"Component", ET.SubElement(component_el, "File", Source=filename)
Id=data["component_id"],
Guid=data["component_guid"],
)
for filename in data["files"]:
file_el = ET.SubElement(
component_el, "File", Source=filename, Id="file_" + uuid.uuid4().hex
)
for subdata in data["dirs"]: for subdata in data["dirs"]:
component_ids += build_components_xml(root, subdata) build_components_xml(root, subdata)
return component_ids
def main(): def main():
@ -233,8 +224,7 @@ def main():
# Add the Feature element # Add the Feature element
feature_el = ET.SubElement(package_el, "Feature", Id="DefaultFeature", Level="1") feature_el = ET.SubElement(package_el, "Feature", Id="DefaultFeature", Level="1")
for component_id in component_ids: ET.SubElement(feature_el, "ComponentGroupRef", Id="ApplicationComponents")
ET.SubElement(feature_el, "ComponentRef", Id=component_id)
ET.SubElement(feature_el, "ComponentRef", Id="ApplicationShortcuts") ET.SubElement(feature_el, "ComponentRef", Id="ApplicationShortcuts")
print(f'<?define ProductVersion = "{version}"?>') print(f'<?define ProductVersion = "{version}"?>')