From eda9beace3caad0be71f9b7bf245ae0805d855bb Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Thu, 10 Jan 2013 17:51:47 +0100 Subject: wixl: handle ComponentGroup and ComponentGroupRef --- tools/wixl/builder.vala | 23 ++++++++++++++++++++--- tools/wixl/wix.vala | 24 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) (limited to 'tools/wixl') diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala index 701bba4..9a25737 100644 --- a/tools/wixl/builder.vala +++ b/tools/wixl/builder.vala @@ -383,13 +383,30 @@ namespace Wixl { } + void feature_add_component (WixFeature feature, WixComponent component) throws GLib.Error { + component.in_feature.append (feature); + db.table_feature_components.add (feature.Id, component.Id); + } + public override void visit_component_ref (WixComponentRef ref) throws GLib.Error { + var component = resolve (@ref); + + if (ref.parent is WixFeature) { + feature_add_component (@ref.parent as WixFeature, component); + } else if (ref.parent is WixComponentGroup) { + // will be added in GroupRef + } else + warning ("unhandled parent type %s", @ref.parent.name); + } + + public override void visit_component_group_ref (WixComponentGroupRef ref) throws GLib.Error { + var group = resolve (@ref); + if (ref.parent is WixFeature) { var feature = ref.parent as WixFeature; - var component = resolve (@ref); - component.in_feature.append (feature); - db.table_feature_components.add (feature.Id, @ref.Id); + foreach (var comp in group.children) + feature_add_component (feature, resolve (comp as WixElement)); } else warning ("unhandled parent type %s", @ref.parent.name); } diff --git a/tools/wixl/wix.vala b/tools/wixl/wix.vala index eb7f08a..b336441 100644 --- a/tools/wixl/wix.vala +++ b/tools/wixl/wix.vala @@ -28,6 +28,7 @@ namespace Wixl { public abstract void visit_upgrade_version (WixUpgradeVersion version) throws GLib.Error; public abstract void visit_action (WixAction action) throws GLib.Error; public abstract void visit_text (WixText text) throws GLib.Error; + public abstract void visit_component_group_ref (WixComponentGroupRef ref) throws GLib.Error; } public abstract class WixNode: Object { @@ -210,6 +211,16 @@ namespace Wixl { } } + public class WixComponentGroup: WixElement { + static construct { + name = "ComponentGroup"; + + add_child_types (child_types, { + typeof (WixComponentRef), + }); + } + } + public class WixFragment: WixElement { static construct { name = "Fragment"; @@ -217,6 +228,7 @@ namespace Wixl { add_child_types (child_types, { typeof (WixDirectory), typeof (WixDirectoryRef), + typeof (WixComponentGroup), }); } @@ -370,6 +382,7 @@ namespace Wixl { add_child_types (child_types, { typeof (WixComponentRef), + typeof (WixComponentGroupRef), typeof (WixFeature), }); } @@ -398,6 +411,17 @@ namespace Wixl { } } + public class WixComponentGroupRef: WixElementRef { + static construct { + name = "ComponentGroupRef"; + ref_type = typeof (WixComponentGroup); + } + + public override void accept (WixNodeVisitor visitor) throws GLib.Error { + visitor.visit_component_group_ref (this); + } + } + public class WixCondition: WixElement { static construct { name = "Condition"; -- cgit