@joebigelow / wix / commits / 84cb6c26

Add support for tracking files to simplify file transfers

Rob Mensching committed Aug 11, 2018 at 01:03 UTC 84cb6c26c945fe031bbe36c666d0bbd6275d843b
7 files changed +73 -25
src/WixToolset.Extensibility/Data/BindResult.cs
+1 -1
@@ -8,6 +8,6 @@ namespace WixToolset.Extensibility.Data
8 {
9 public IEnumerable<IFileTransfer> FileTransfers { get; set; }
10
11 - public IEnumerable<string> ContentFilePaths { get; set; }
11 + public IEnumerable<ITrackedFile> TrackedFiles { get; set; }
12 }
13 }
src/WixToolset.Extensibility/Data/FileTransferType.cs deleted
-17
@@ -1,17 +0,0 @@
1 -// 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.
2 -
3 -namespace WixToolset.Extensibility.Data
4 -{
5 - public enum FileTransferType
6 - {
7 - /// <summary>
8 - /// Transfer of a file built during this build.
9 - /// </summary>
10 - Built,
11 -
12 - /// <summary>
13 - /// Transfer of a file contained in the output.
14 - /// </summary>
15 - Content,
16 - }
17 -}
src/WixToolset.Extensibility/Data/IFileTransfer.cs
-3
@@ -23,8 +23,5 @@ namespace WixToolset.Extensibility.Data
23
24 /// <summary>Optional source line numbers where this file transfer orginated.</summary>
25 SourceLineNumber SourceLineNumbers { get; set; }
26 -
27 - /// <summary>Type of file this transfer is moving or copying.</summary>
28 - FileTransferType Type { get; set; }
26 }
27 }
src/WixToolset.Extensibility/Data/ILayoutContext.cs
+1 -1
@@ -11,7 +11,7 @@ namespace WixToolset.Extensibility.Data
11
12 IEnumerable<ILayoutExtension> Extensions { get; set; }
13
14 - IEnumerable<string> ContentFilePaths { get; set; }
14 + IEnumerable<ITrackedFile> TrackedFiles { get; set; }
15
16 IEnumerable<IFileTransfer> FileTransfers { get; set; }
17
src/WixToolset.Extensibility/Data/ITrackedFile.cs new
+32
@@ -0,0 +1,32 @@
1 +// 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.
2 +
3 +namespace WixToolset.Extensibility.Data
4 +{
5 + using WixToolset.Data;
6 +
7 + /// <summary>
8 + /// Interface used to track all files processed.
9 + /// </summary>
10 + public interface ITrackedFile
11 + {
12 + /// <summary>
13 + /// Indicates whether the tracked file should be cleaned by the project.
14 + /// </summary>
15 + bool Clean { get; set; }
16 +
17 + /// <summary>
18 + /// Path to tracked file.
19 + /// </summary>
20 + string Path { get; set; }
21 +
22 + /// <summary>
23 + /// Optional source line numbers where the tracked file was created.
24 + /// </summary>
25 + SourceLineNumber SourceLineNumbers { get; set; }
26 +
27 + /// <summary>
28 + /// Type of tracked file.
29 + /// </summary>
30 + TrackedFileType Type { get; set; }
31 + }
32 +}
src/WixToolset.Extensibility/Data/TrackedFileType.cs new
+30
@@ -0,0 +1,30 @@
1 +// 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.
2 +
3 +namespace WixToolset.Extensibility.Data
4 +{
5 + public enum TrackedFileType
6 + {
7 + /// <summary>
8 + /// File tracked as input (like content included in an .msi).
9 + /// </summary>
10 + Input,
11 +
12 + /// <summary>
13 + /// Temporary file (like an .idt or any other temporary file).
14 + /// These are to be deleted before the build completes.
15 + /// </summary>
16 + Temporary,
17 +
18 + /// <summary>
19 + /// Intermediate file (like a .cab in the cabcache).
20 + /// These are left for subsequent builds.
21 + /// </summary>
22 + Intermediate,
23 +
24 + /// <summary>
25 + /// Final output (like a .msi, .cab or .wixpdb).
26 + /// These are the whole point of the build process.
27 + /// </summary>
28 + Final,
29 + }
30 +}
src/WixToolset.Extensibility/Services/IBackendHelper.cs
+9 -3
@@ -17,9 +17,7 @@ namespace WixToolset.Extensibility.Services
17 /// <param name="source">Source for the file transfer.</param>
18 /// <param name="destination">Destiation for the file transfer.</param>
19 /// <param name="move">Indicates whether to move or copy the source file.</param>
20 - /// <param name="type">Type of file transfer to create.</param>
21 - /// <param name="sourceLineNumbers">Optional source line numbers that requested the file transfer.</param>
22 - IFileTransfer CreateFileTransfer(string source, string destination, bool move, FileTransferType type, SourceLineNumber sourceLineNumbers = null);
20 + IFileTransfer CreateFileTransfer(string source, string destination, bool move, SourceLineNumber sourceLineNumbers = null);
21
22 /// <summary>
23 /// Creates a version 3 name-based UUID.
@@ -28,5 +26,13 @@ namespace WixToolset.Extensibility.Services
26 /// <param name="value">The value.</param>
27 /// <returns>The generated GUID for the given namespace and value.</returns>
28 string CreateGuid(Guid namespaceGuid, string value);
29 +
30 + /// <summary>
31 + /// Creates a tracked file.
32 + /// </summary>
33 + /// <param name="path">Destination path for the build output.</param>
34 + /// <param name="type">Type of tracked file to create.</param>
35 + /// <param name="sourceLineNumbers">Optional source line numbers that requested the tracked file.</param>
36 + ITrackedFile TrackFile(string path, TrackedFileType type, SourceLineNumber sourceLineNumbers = null);
37 }
38 }