diff options
-rw-r--r-- | src/wix/WixToolset.BuildTasks/Common.cs | 13 | ||||
-rw-r--r-- | src/wix/WixToolset.BuildTasks/FileSearchHelperMethods.cs | 13 | ||||
-rw-r--r-- | src/wix/WixToolset.BuildTasks/GetCabList.cs | 20 | ||||
-rw-r--r-- | src/wix/WixToolset.BuildTasks/RefreshBundleGeneratedFile.cs | 19 | ||||
-rw-r--r-- | src/wix/WixToolset.BuildTasks/RefreshGeneratedFile.cs | 19 | ||||
-rw-r--r-- | src/wix/WixToolset.Sdk/tools/wix.targets | 4 |
6 files changed, 30 insertions, 58 deletions
diff --git a/src/wix/WixToolset.BuildTasks/Common.cs b/src/wix/WixToolset.BuildTasks/Common.cs index c5b709c2..837dfb17 100644 --- a/src/wix/WixToolset.BuildTasks/Common.cs +++ b/src/wix/WixToolset.BuildTasks/Common.cs | |||
@@ -4,6 +4,7 @@ namespace WixToolset.BuildTasks | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Text.RegularExpressions; | 6 | using System.Text.RegularExpressions; |
7 | using Microsoft.Build.Framework; | ||
7 | 8 | ||
8 | /// <summary> | 9 | /// <summary> |
9 | /// Common WixTasks utility methods and types. | 10 | /// Common WixTasks utility methods and types. |
@@ -13,8 +14,8 @@ namespace WixToolset.BuildTasks | |||
13 | /// <summary>Metadata key name to turn off harvesting of project references.</summary> | 14 | /// <summary>Metadata key name to turn off harvesting of project references.</summary> |
14 | public const string DoNotHarvest = "DoNotHarvest"; | 15 | public const string DoNotHarvest = "DoNotHarvest"; |
15 | 16 | ||
16 | private static readonly Regex AddPrefix = new Regex(@"^[^a-zA-Z_]", RegexOptions.Compiled); | 17 | private static readonly Regex AddPrefix = new Regex(@"^[^a-zA-Z_]"); |
17 | private static readonly Regex IllegalIdentifierCharacters = new Regex(@"[^A-Za-z0-9_\.]|\.{2,}", RegexOptions.Compiled); // non 'words' and assorted valid characters | 18 | private static readonly Regex IllegalIdentifierCharacters = new Regex(@"[^A-Za-z0-9_\.]|\.{2,}"); // non 'words' and assorted valid characters |
18 | 19 | ||
19 | /// <summary> | 20 | /// <summary> |
20 | /// Return an identifier based on passed file/directory name | 21 | /// Return an identifier based on passed file/directory name |
@@ -24,7 +25,7 @@ namespace WixToolset.BuildTasks | |||
24 | /// <remarks>This is duplicated from WiX's Common class.</remarks> | 25 | /// <remarks>This is duplicated from WiX's Common class.</remarks> |
25 | public static string GetIdentifierFromName(string name) | 26 | public static string GetIdentifierFromName(string name) |
26 | { | 27 | { |
27 | string result = IllegalIdentifierCharacters.Replace(name, "_"); // replace illegal characters with "_". | 28 | var result = IllegalIdentifierCharacters.Replace(name, "_"); // replace illegal characters with "_". |
28 | 29 | ||
29 | // MSI identifiers must begin with an alphabetic character or an | 30 | // MSI identifiers must begin with an alphabetic character or an |
30 | // underscore. Prefix all other values with an underscore. | 31 | // underscore. Prefix all other values with an underscore. |
@@ -35,5 +36,11 @@ namespace WixToolset.BuildTasks | |||
35 | 36 | ||
36 | return result; | 37 | return result; |
37 | } | 38 | } |
39 | |||
40 | public static string GetMetadataOrDefault(ITaskItem item, string metadataName, string defaultValue) | ||
41 | { | ||
42 | var value = item.GetMetadata(metadataName); | ||
43 | return String.IsNullOrWhiteSpace(value) ? defaultValue : value; | ||
44 | } | ||
38 | } | 45 | } |
39 | } | 46 | } |
diff --git a/src/wix/WixToolset.BuildTasks/FileSearchHelperMethods.cs b/src/wix/WixToolset.BuildTasks/FileSearchHelperMethods.cs index 397c9d7c..94ff8c67 100644 --- a/src/wix/WixToolset.BuildTasks/FileSearchHelperMethods.cs +++ b/src/wix/WixToolset.BuildTasks/FileSearchHelperMethods.cs | |||
@@ -33,20 +33,21 @@ namespace WixToolset.BuildTasks | |||
33 | 33 | ||
34 | if (directories == null) | 34 | if (directories == null) |
35 | { | 35 | { |
36 | return string.Empty; | 36 | return String.Empty; |
37 | } | 37 | } |
38 | 38 | ||
39 | string fileName = Path.GetFileName(defaultFullPath); | 39 | var fileName = Path.GetFileName(defaultFullPath); |
40 | foreach (string currentPath in directories) | 40 | foreach (var currentPath in directories) |
41 | { | 41 | { |
42 | if (String.IsNullOrEmpty(currentPath) || String.IsNullOrEmpty(currentPath.Trim())) | 42 | if (String.IsNullOrWhiteSpace(currentPath)) |
43 | { | 43 | { |
44 | continue; | 44 | continue; |
45 | } | 45 | } |
46 | 46 | ||
47 | if (File.Exists(Path.Combine(currentPath, fileName))) | 47 | var path = Path.Combine(currentPath, fileName); |
48 | if (File.Exists(path)) | ||
48 | { | 49 | { |
49 | return Path.Combine(currentPath, fileName); | 50 | return path; |
50 | } | 51 | } |
51 | } | 52 | } |
52 | 53 | ||
diff --git a/src/wix/WixToolset.BuildTasks/GetCabList.cs b/src/wix/WixToolset.BuildTasks/GetCabList.cs index 33fa5b37..6e8cd991 100644 --- a/src/wix/WixToolset.BuildTasks/GetCabList.cs +++ b/src/wix/WixToolset.BuildTasks/GetCabList.cs | |||
@@ -14,27 +14,17 @@ namespace WixToolset.BuildTasks | |||
14 | /// </summary> | 14 | /// </summary> |
15 | public class GetCabList : Task | 15 | public class GetCabList : Task |
16 | { | 16 | { |
17 | private ITaskItem database; | ||
18 | private ITaskItem[] cabList; | ||
19 | |||
20 | /// <summary> | 17 | /// <summary> |
21 | /// The list of database files to find cabs in | 18 | /// The list of database files to find cabs in |
22 | /// </summary> | 19 | /// </summary> |
23 | [Required] | 20 | [Required] |
24 | public ITaskItem Database | 21 | public ITaskItem Database { get; set; } |
25 | { | ||
26 | get { return this.database; } | ||
27 | set { this.database = value; } | ||
28 | } | ||
29 | 22 | ||
30 | /// <summary> | 23 | /// <summary> |
31 | /// The total list of cabs in this database | 24 | /// The total list of cabs in this database |
32 | /// </summary> | 25 | /// </summary> |
33 | [Output] | 26 | [Output] |
34 | public ITaskItem[] CabList | 27 | public ITaskItem[] CabList { get; private set; } |
35 | { | ||
36 | get { return this.cabList; } | ||
37 | } | ||
38 | 28 | ||
39 | /// <summary> | 29 | /// <summary> |
40 | /// Gets a complete list of external cabs referenced by the given installer database file. | 30 | /// Gets a complete list of external cabs referenced by the given installer database file. |
@@ -42,8 +32,8 @@ namespace WixToolset.BuildTasks | |||
42 | /// <returns>True upon completion of the task execution.</returns> | 32 | /// <returns>True upon completion of the task execution.</returns> |
43 | public override bool Execute() | 33 | public override bool Execute() |
44 | { | 34 | { |
45 | string databaseFile = this.database.ItemSpec; | 35 | string databaseFile = this.Database.ItemSpec; |
46 | Object []args = { }; | 36 | object[] args = { }; |
47 | System.Collections.Generic.List<ITaskItem> cabNames = new System.Collections.Generic.List<ITaskItem>(); | 37 | System.Collections.Generic.List<ITaskItem> cabNames = new System.Collections.Generic.List<ITaskItem>(); |
48 | 38 | ||
49 | // If the file doesn't exist, no cabs to return, so exit now | 39 | // If the file doesn't exist, no cabs to return, so exit now |
@@ -73,7 +63,7 @@ namespace WixToolset.BuildTasks | |||
73 | } | 63 | } |
74 | } | 64 | } |
75 | 65 | ||
76 | this.cabList = cabNames.ToArray(); | 66 | this.CabList = cabNames.ToArray(); |
77 | 67 | ||
78 | return true; | 68 | return true; |
79 | } | 69 | } |
diff --git a/src/wix/WixToolset.BuildTasks/RefreshBundleGeneratedFile.cs b/src/wix/WixToolset.BuildTasks/RefreshBundleGeneratedFile.cs index 7663e6df..983695c9 100644 --- a/src/wix/WixToolset.BuildTasks/RefreshBundleGeneratedFile.cs +++ b/src/wix/WixToolset.BuildTasks/RefreshBundleGeneratedFile.cs | |||
@@ -15,28 +15,17 @@ namespace WixToolset.BuildTasks | |||
15 | /// </summary> | 15 | /// </summary> |
16 | public class RefreshBundleGeneratedFile : Task | 16 | public class RefreshBundleGeneratedFile : Task |
17 | { | 17 | { |
18 | private ITaskItem[] generatedFiles; | ||
19 | private ITaskItem[] projectReferencePaths; | ||
20 | |||
21 | /// <summary> | 18 | /// <summary> |
22 | /// The list of files to generate. | 19 | /// The list of files to generate. |
23 | /// </summary> | 20 | /// </summary> |
24 | [Required] | 21 | [Required] |
25 | public ITaskItem[] GeneratedFiles | 22 | public ITaskItem[] GeneratedFiles { get; set; } |
26 | { | ||
27 | get { return this.generatedFiles; } | ||
28 | set { this.generatedFiles = value; } | ||
29 | } | ||
30 | 23 | ||
31 | /// <summary> | 24 | /// <summary> |
32 | /// All the project references in the project. | 25 | /// All the project references in the project. |
33 | /// </summary> | 26 | /// </summary> |
34 | [Required] | 27 | [Required] |
35 | public ITaskItem[] ProjectReferencePaths | 28 | public ITaskItem[] ProjectReferencePaths { get; set; } |
36 | { | ||
37 | get { return this.projectReferencePaths; } | ||
38 | set { this.projectReferencePaths = value; } | ||
39 | } | ||
40 | 29 | ||
41 | /// <summary> | 30 | /// <summary> |
42 | /// Gets a complete list of external cabs referenced by the given installer database file. | 31 | /// Gets a complete list of external cabs referenced by the given installer database file. |
@@ -55,9 +44,9 @@ namespace WixToolset.BuildTasks | |||
55 | continue; | 44 | continue; |
56 | } | 45 | } |
57 | 46 | ||
58 | string projectPath = CreateProjectReferenceDefineConstants.GetProjectPath(this.ProjectReferencePaths, i); | 47 | string projectPath = item.GetMetadata("MSBuildSourceProjectFile"); |
59 | string projectName = Path.GetFileNameWithoutExtension(projectPath); | 48 | string projectName = Path.GetFileNameWithoutExtension(projectPath); |
60 | string referenceName = ToolsCommon.GetIdentifierFromName(CreateProjectReferenceDefineConstants.GetReferenceName(item, projectName)); | 49 | string referenceName = ToolsCommon.GetIdentifierFromName(ToolsCommon.GetMetadataOrDefault(item, "Name", projectName)); |
61 | 50 | ||
62 | string[] pogs = item.GetMetadata("RefProjectOutputGroups").Split(';'); | 51 | string[] pogs = item.GetMetadata("RefProjectOutputGroups").Split(';'); |
63 | foreach (string pog in pogs) | 52 | foreach (string pog in pogs) |
diff --git a/src/wix/WixToolset.BuildTasks/RefreshGeneratedFile.cs b/src/wix/WixToolset.BuildTasks/RefreshGeneratedFile.cs index c57e3f0f..e18ae222 100644 --- a/src/wix/WixToolset.BuildTasks/RefreshGeneratedFile.cs +++ b/src/wix/WixToolset.BuildTasks/RefreshGeneratedFile.cs | |||
@@ -16,28 +16,17 @@ namespace WixToolset.BuildTasks | |||
16 | /// </summary> | 16 | /// </summary> |
17 | public class RefreshGeneratedFile : Task | 17 | public class RefreshGeneratedFile : Task |
18 | { | 18 | { |
19 | private ITaskItem[] generatedFiles; | ||
20 | private ITaskItem[] projectReferencePaths; | ||
21 | |||
22 | /// <summary> | 19 | /// <summary> |
23 | /// The list of files to generate. | 20 | /// The list of files to generate. |
24 | /// </summary> | 21 | /// </summary> |
25 | [Required] | 22 | [Required] |
26 | public ITaskItem[] GeneratedFiles | 23 | public ITaskItem[] GeneratedFiles { get; set; } |
27 | { | ||
28 | get { return this.generatedFiles; } | ||
29 | set { this.generatedFiles = value; } | ||
30 | } | ||
31 | 24 | ||
32 | /// <summary> | 25 | /// <summary> |
33 | /// All the project references in the project. | 26 | /// All the project references in the project. |
34 | /// </summary> | 27 | /// </summary> |
35 | [Required] | 28 | [Required] |
36 | public ITaskItem[] ProjectReferencePaths | 29 | public ITaskItem[] ProjectReferencePaths { get; set; } |
37 | { | ||
38 | get { return this.projectReferencePaths; } | ||
39 | set { this.projectReferencePaths = value; } | ||
40 | } | ||
41 | 30 | ||
42 | /// <summary> | 31 | /// <summary> |
43 | /// Gets a complete list of external cabs referenced by the given installer database file. | 32 | /// Gets a complete list of external cabs referenced by the given installer database file. |
@@ -55,9 +44,9 @@ namespace WixToolset.BuildTasks | |||
55 | continue; | 44 | continue; |
56 | } | 45 | } |
57 | 46 | ||
58 | string projectPath = CreateProjectReferenceDefineConstants.GetProjectPath(this.ProjectReferencePaths, i); | 47 | string projectPath = item.GetMetadata("MSBuildSourceProjectFile"); |
59 | string projectName = Path.GetFileNameWithoutExtension(projectPath); | 48 | string projectName = Path.GetFileNameWithoutExtension(projectPath); |
60 | string referenceName = ToolsCommon.GetIdentifierFromName(CreateProjectReferenceDefineConstants.GetReferenceName(item, projectName)); | 49 | string referenceName = ToolsCommon.GetIdentifierFromName(ToolsCommon.GetMetadataOrDefault(item, "Name", projectName)); |
61 | 50 | ||
62 | string[] pogs = item.GetMetadata("RefProjectOutputGroups").Split(';'); | 51 | string[] pogs = item.GetMetadata("RefProjectOutputGroups").Split(';'); |
63 | foreach (string pog in pogs) | 52 | foreach (string pog in pogs) |
diff --git a/src/wix/WixToolset.Sdk/tools/wix.targets b/src/wix/WixToolset.Sdk/tools/wix.targets index fde969e6..6b15769a 100644 --- a/src/wix/WixToolset.Sdk/tools/wix.targets +++ b/src/wix/WixToolset.Sdk/tools/wix.targets | |||
@@ -125,10 +125,6 @@ | |||
125 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | 125 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> |
126 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | 126 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> |
127 | 127 | ||
128 | <UsingTask TaskName="ReplaceString" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | ||
129 | <UsingTask TaskName="ReplaceString" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | ||
130 | <UsingTask TaskName="ReplaceString" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | ||
131 | |||
132 | <UsingTask TaskName="GenerateCompileWithObjectPath" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | 128 | <UsingTask TaskName="GenerateCompileWithObjectPath" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> |
133 | <UsingTask TaskName="GenerateCompileWithObjectPath" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | 129 | <UsingTask TaskName="GenerateCompileWithObjectPath" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> |
134 | <UsingTask TaskName="GenerateCompileWithObjectPath" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | 130 | <UsingTask TaskName="GenerateCompileWithObjectPath" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> |