From 41622a07f82c57cf3d80393b0b6914f5ccb76e33 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 1 Jan 2019 00:26:30 -0800 Subject: Load .wixlib intermediates with single creator Using a single creator ensures definitions are shared and consistent across the entire build. --- src/WixToolset.Core/CommandLine/BuildCommand.cs | 31 +++++++++------------- .../TupleDefinitionCreator.cs | 7 +++-- 2 files changed, 17 insertions(+), 21 deletions(-) (limited to 'src/WixToolset.Core') diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 87a3cd30..f754c876 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs @@ -331,27 +331,20 @@ namespace WixToolset.Core.CommandLine private IEnumerable LoadLibraries(IEnumerable libraryFiles, ITupleDefinitionCreator creator) { - var libraries = new List(); - - foreach (var libraryFile in libraryFiles) + try { - try - { - var library = Intermediate.Load(libraryFile, creator); - - libraries.Add(library); - } - catch (WixCorruptFileException e) - { - this.Messaging.Write(e.Error); - } - catch (WixUnexpectedFileFormatException e) - { - this.Messaging.Write(e.Error); - } + return Intermediate.Load(libraryFiles, creator); + } + catch (WixCorruptFileException e) + { + this.Messaging.Write(e.Error); + } + catch (WixUnexpectedFileFormatException e) + { + this.Messaging.Write(e.Error); } - return libraries; + return Array.Empty(); } private IEnumerable LoadLocalizationFiles(IEnumerable locFiles, IDictionary preprocessorVariables) @@ -437,7 +430,7 @@ namespace WixToolset.Core.CommandLine public string OutputsFile { get; private set; } public string BuiltOutputsFile { get; private set; } - + public CommandLine(IMessaging messaging) { this.Messaging = messaging; diff --git a/src/WixToolset.Core/ExtensibilityServices/TupleDefinitionCreator.cs b/src/WixToolset.Core/ExtensibilityServices/TupleDefinitionCreator.cs index b442da2b..e223e3a4 100644 --- a/src/WixToolset.Core/ExtensibilityServices/TupleDefinitionCreator.cs +++ b/src/WixToolset.Core/ExtensibilityServices/TupleDefinitionCreator.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. namespace WixToolset.Core.ExtensibilityServices { @@ -23,7 +23,10 @@ namespace WixToolset.Core.ExtensibilityServices public void AddCustomTupleDefinition(IntermediateTupleDefinition definition) { - this.CustomDefinitionByName.Add(definition.Name, definition); + if (!this.CustomDefinitionByName.TryGetValue(definition.Name, out var existing) || definition.Revision > existing.Revision) + { + this.CustomDefinitionByName[definition.Name] = definition; + } } public bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition) -- cgit v1.2.3-55-g6feb