From de14a8055181d00514192f3ed36672b02d5e73ee Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Fri, 4 Jan 2013 13:50:24 +0100 Subject: Sequence actions in Builder --- src/builder.vala | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ src/msi.vala | 79 ++++++++++++-------------------------------------------- 2 files changed, 84 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/builder.vala b/src/builder.vala index 7587120..8fa6303 100644 --- a/src/builder.vala +++ b/src/builder.vala @@ -8,9 +8,77 @@ namespace Wixl { this.root = root; } + delegate void AddSequence (string action, int sequence) throws GLib.Error; + + void sequence_actions () throws GLib.Error { + AddSequence add = (action, sequence) => { + db.table_admin_execute_sequence.add (action, sequence); + }; + add ("CostInitialize", 800); + add ("FileCost", 900); + add ("CostFinalize", 1000); + add ("InstallValidate", 1400); + add ("InstallInitialize", 1500); + add ("InstallAdminPackage", 3900); + add ("InstallFiles", 4000); + add ("InstallFinalize", 6600); + + add = (action, sequence) => { + db.table_admin_ui_sequence.add (action, sequence); + }; + add ("CostInitialize", 800); + add ("FileCost", 900); + add ("CostFinalize", 1000); + add ("ExecuteAction", 1300); + + add = (action, sequence) => { + db.table_advt_execute_sequence.add (action, sequence); + }; + add ("CostInitialize", 800); + add ("CostFinalize", 1000); + add ("InstallValidate", 1400); + add ("InstallInitialize", 1500); + add ("PublishFeatures", 6300); + add ("PublishProduct", 6400); + add ("InstallFinalize", 6600); + + add = (action, sequence) => { + db.table_install_execute_sequence.add (action, sequence); + }; + add ("ValidateProductID", 700); + add ("CostInitialize", 800); + add ("FileCost", 900); + add ("CostFinalize", 1000); + add ("InstallValidate", 1400); + add ("InstallInitialize", 1500); + add ("ProcessComponents", 1600); + add ("UnpublishFeatures", 1800); + if (db.table_registry.records.length () > 0) { + add ("RemoveRegistryValues", 2600); + add ("WriteRegistryValues", 2600); + } + if (db.table_remove_file.records.length () > 0) + add ("RemoveFiles", 3500); + add ("RegisterUser", 6000); + add ("RegisterProduct", 6100); + add ("PublishFeatures", 6300); + add ("PublishProduct", 6400); + add ("InstallFinalize", 6600); + + add = (action, sequence) => { + db.table_install_ui_sequence.add (action, sequence); + }; + add ("ValidateProductID", 700); + add ("CostInitialize", 800); + add ("FileCost", 900); + add ("CostFinalize", 1000); + add ("ExecuteAction", 1300); + } + public MsiDatabase build () throws GLib.Error { db = new MsiDatabase (); root.accept (this); + sequence_actions (); return db; } diff --git a/src/msi.vala b/src/msi.vala index d45f810..b1de96b 100644 --- a/src/msi.vala +++ b/src/msi.vala @@ -34,17 +34,6 @@ namespace Wixl { class MsiTableAdminExecuteSequence: MsiTable { construct { name = "AdminExecuteSequence"; - try { - add ("CostInitialize", 800); - add ("FileCost", 900); - add ("CostFinalize", 1000); - add ("InstallValidate", 1400); - add ("InstallInitialize", 1500); - add ("InstallAdminPackage", 3900); - add ("InstallFiles", 4000); - add ("InstallFinalize", 6600); - } catch (GLib.Error e) { - } } public void add (string action, int sequence) throws GLib.Error { @@ -70,14 +59,6 @@ namespace Wixl { class MsiTableAdminUISequence: MsiTable { construct { name = "AdminUISequence"; - - try { - add ("CostInitialize", 800); - add ("FileCost", 900); - add ("CostFinalize", 1000); - add ("ExecuteAction", 1300); - } catch (GLib.Error e) { - } } public void add (string action, int sequence) throws GLib.Error { @@ -103,17 +84,6 @@ namespace Wixl { class MsiTableAdvtExecuteSequence: MsiTable { construct { name = "AdvtExecuteSequence"; - - try { - add ("CostInitialize", 800); - add ("CostFinalize", 1000); - add ("InstallValidate", 1400); - add ("InstallInitialize", 1500); - add ("InstallFinalize", 6600); - add ("PublishFeatures", 6300); - add ("PublishProduct", 6400); - } catch (GLib.Error e) { - } } public void add (string action, int sequence) throws GLib.Error { @@ -161,23 +131,6 @@ namespace Wixl { class MsiTableInstallExecuteSequence: MsiTable { construct { name = "InstallExecuteSequence"; - - try { - add ("CostInitialize", 800); - add ("FileCost", 900); - add ("CostFinalize", 1000); - add ("InstallValidate", 1400); - add ("InstallInitialize", 1500); - add ("InstallFinalize", 6600); - add ("PublishFeatures", 6300); - add ("PublishProduct", 6400); - add ("ValidateProductID", 700); - add ("ProcessComponents", 1600); - add ("UnpublishFeatures", 1800); - add ("RegisterUser", 6000); - add ("RegisterProduct", 6100); - } catch (GLib.Error e) { - } } public void add (string action, int sequence) throws GLib.Error { @@ -203,15 +156,6 @@ namespace Wixl { class MsiTableInstallUISequence: MsiTable { construct { name = "InstallUISequence"; - - try { - add ("CostInitialize", 800); - add ("FileCost", 900); - add ("CostFinalize", 1000); - add ("ExecuteAction", 1300); - add ("ValidateProductID", 700); - } catch (GLib.Error e) { - } } public void add (string action, int sequence) throws GLib.Error { @@ -512,6 +456,11 @@ namespace Wixl { public MsiTableFeatureComponents table_feature_components; public MsiTableRemoveFile table_remove_file; public MsiTableRegistry table_registry; + public MsiTableAdminExecuteSequence table_admin_execute_sequence; + public MsiTableAdminUISequence table_admin_ui_sequence; + public MsiTableAdvtExecuteSequence table_advt_execute_sequence; + public MsiTableInstallExecuteSequence table_install_execute_sequence; + public MsiTableInstallUISequence table_install_ui_sequence; HashTable tables; @@ -543,15 +492,18 @@ namespace Wixl { table_feature_components = new MsiTableFeatureComponents (); table_remove_file = new MsiTableRemoveFile (); table_registry = new MsiTableRegistry (); + table_admin_execute_sequence = new MsiTableAdminExecuteSequence (); + table_admin_ui_sequence = new MsiTableAdminUISequence (); + table_advt_execute_sequence = new MsiTableAdvtExecuteSequence (); + table_install_execute_sequence = new MsiTableInstallExecuteSequence (); + table_install_ui_sequence = new MsiTableInstallUISequence (); foreach (var t in new MsiTable[] { - new MsiTableAdminExecuteSequence (), - new MsiTableAdminUISequence (), - new MsiTableAdvtExecuteSequence (), - new MsiTableError (), - new MsiTableFile (), - new MsiTableInstallExecuteSequence (), - new MsiTableInstallUISequence (), + table_admin_execute_sequence, + table_admin_ui_sequence, + table_advt_execute_sequence, + table_install_execute_sequence, + table_install_ui_sequence, table_directory, table_media, table_property, @@ -561,6 +513,7 @@ namespace Wixl { table_feature_components, table_remove_file, table_registry, + new MsiTableError (), new MsiTable_Validation () }) { tables.insert (t.name, t); -- cgit