From 84cb6c26c945fe031bbe36c666d0bbd6275d843b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 11 Aug 2018 01:03:57 -0700 Subject: Add support for tracking files to simplify file transfers --- src/WixToolset.Extensibility/Data/BindResult.cs | 2 +- .../Data/FileTransferType.cs | 17 ------------ src/WixToolset.Extensibility/Data/IFileTransfer.cs | 3 -- .../Data/ILayoutContext.cs | 2 +- src/WixToolset.Extensibility/Data/ITrackedFile.cs | 32 ++++++++++++++++++++++ .../Data/TrackedFileType.cs | 30 ++++++++++++++++++++ .../Services/IBackendHelper.cs | 12 ++++++-- 7 files changed, 73 insertions(+), 25 deletions(-) delete mode 100644 src/WixToolset.Extensibility/Data/FileTransferType.cs create mode 100644 src/WixToolset.Extensibility/Data/ITrackedFile.cs create mode 100644 src/WixToolset.Extensibility/Data/TrackedFileType.cs (limited to 'src') diff --git a/src/WixToolset.Extensibility/Data/BindResult.cs b/src/WixToolset.Extensibility/Data/BindResult.cs index 0ccaa08b..e467d269 100644 --- a/src/WixToolset.Extensibility/Data/BindResult.cs +++ b/src/WixToolset.Extensibility/Data/BindResult.cs @@ -8,6 +8,6 @@ namespace WixToolset.Extensibility.Data { public IEnumerable FileTransfers { get; set; } - public IEnumerable ContentFilePaths { get; set; } + public IEnumerable TrackedFiles { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/FileTransferType.cs b/src/WixToolset.Extensibility/Data/FileTransferType.cs deleted file mode 100644 index b00a00c4..00000000 --- a/src/WixToolset.Extensibility/Data/FileTransferType.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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.Extensibility.Data -{ - public enum FileTransferType - { - /// - /// Transfer of a file built during this build. - /// - Built, - - /// - /// Transfer of a file contained in the output. - /// - Content, - } -} diff --git a/src/WixToolset.Extensibility/Data/IFileTransfer.cs b/src/WixToolset.Extensibility/Data/IFileTransfer.cs index ca936219..6f521536 100644 --- a/src/WixToolset.Extensibility/Data/IFileTransfer.cs +++ b/src/WixToolset.Extensibility/Data/IFileTransfer.cs @@ -23,8 +23,5 @@ namespace WixToolset.Extensibility.Data /// Optional source line numbers where this file transfer orginated. SourceLineNumber SourceLineNumbers { get; set; } - - /// Type of file this transfer is moving or copying. - FileTransferType Type { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index 7011fcf6..89aadc4d 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -11,7 +11,7 @@ namespace WixToolset.Extensibility.Data IEnumerable Extensions { get; set; } - IEnumerable ContentFilePaths { get; set; } + IEnumerable TrackedFiles { get; set; } IEnumerable FileTransfers { get; set; } diff --git a/src/WixToolset.Extensibility/Data/ITrackedFile.cs b/src/WixToolset.Extensibility/Data/ITrackedFile.cs new file mode 100644 index 00000000..df36bd2b --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ITrackedFile.cs @@ -0,0 +1,32 @@ +// 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.Extensibility.Data +{ + using WixToolset.Data; + + /// + /// Interface used to track all files processed. + /// + public interface ITrackedFile + { + /// + /// Indicates whether the tracked file should be cleaned by the project. + /// + bool Clean { get; set; } + + /// + /// Path to tracked file. + /// + string Path { get; set; } + + /// + /// Optional source line numbers where the tracked file was created. + /// + SourceLineNumber SourceLineNumbers { get; set; } + + /// + /// Type of tracked file. + /// + TrackedFileType Type { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/TrackedFileType.cs b/src/WixToolset.Extensibility/Data/TrackedFileType.cs new file mode 100644 index 00000000..195d5de9 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/TrackedFileType.cs @@ -0,0 +1,30 @@ +// 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.Extensibility.Data +{ + public enum TrackedFileType + { + /// + /// File tracked as input (like content included in an .msi). + /// + Input, + + /// + /// Temporary file (like an .idt or any other temporary file). + /// These are to be deleted before the build completes. + /// + Temporary, + + /// + /// Intermediate file (like a .cab in the cabcache). + /// These are left for subsequent builds. + /// + Intermediate, + + /// + /// Final output (like a .msi, .cab or .wixpdb). + /// These are the whole point of the build process. + /// + Final, + } +} diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs index 813b40ef..0622693d 100644 --- a/src/WixToolset.Extensibility/Services/IBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IBackendHelper.cs @@ -17,9 +17,7 @@ namespace WixToolset.Extensibility.Services /// Source for the file transfer. /// Destiation for the file transfer. /// Indicates whether to move or copy the source file. - /// Type of file transfer to create. - /// Optional source line numbers that requested the file transfer. - IFileTransfer CreateFileTransfer(string source, string destination, bool move, FileTransferType type, SourceLineNumber sourceLineNumbers = null); + IFileTransfer CreateFileTransfer(string source, string destination, bool move, SourceLineNumber sourceLineNumbers = null); /// /// Creates a version 3 name-based UUID. @@ -28,5 +26,13 @@ namespace WixToolset.Extensibility.Services /// The value. /// The generated GUID for the given namespace and value. string CreateGuid(Guid namespaceGuid, string value); + + /// + /// Creates a tracked file. + /// + /// Destination path for the build output. + /// Type of tracked file to create. + /// Optional source line numbers that requested the tracked file. + ITrackedFile TrackFile(string path, TrackedFileType type, SourceLineNumber sourceLineNumbers = null); } } -- cgit v1.2.3-55-g6feb