diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.BuildTasks/DoIt.cs | 6 | ||||
| -rw-r--r-- | src/WixToolset.BuildTasks/wix.targets | 13 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs | 60 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs | 8 |
4 files changed, 81 insertions, 6 deletions
diff --git a/src/WixToolset.BuildTasks/DoIt.cs b/src/WixToolset.BuildTasks/DoIt.cs index 5faf163c..3aa9f5a3 100644 --- a/src/WixToolset.BuildTasks/DoIt.cs +++ b/src/WixToolset.BuildTasks/DoIt.cs | |||
| @@ -47,7 +47,9 @@ namespace WixToolset.BuildTasks | |||
| 47 | 47 | ||
| 48 | public string OutputType { get; set; } | 48 | public string OutputType { get; set; } |
| 49 | 49 | ||
| 50 | public string PdbOutputFile { get; set; } | 50 | public ITaskItem PdbFile { get; set; } |
| 51 | |||
| 52 | public string PdbType { get; set; } | ||
| 51 | 53 | ||
| 52 | public bool Pedantic { get; set; } | 54 | public bool Pedantic { get; set; } |
| 53 | 55 | ||
| @@ -162,6 +164,8 @@ namespace WixToolset.BuildTasks | |||
| 162 | commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.InstallerPlatform); | 164 | commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.InstallerPlatform); |
| 163 | commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); | 165 | commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); |
| 164 | commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType); | 166 | commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType); |
| 167 | commandLineBuilder.AppendSwitchIfNotNull("-pdb ", this.PdbFile); | ||
| 168 | commandLineBuilder.AppendSwitchIfNotNull("-pdbType ", this.PdbType); | ||
| 165 | commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo); | 169 | commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo); |
| 166 | commandLineBuilder.AppendArrayIfNotNull("-culture ", this.Cultures); | 170 | commandLineBuilder.AppendArrayIfNotNull("-culture ", this.Cultures); |
| 167 | commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants); | 171 | commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants); |
diff --git a/src/WixToolset.BuildTasks/wix.targets b/src/WixToolset.BuildTasks/wix.targets index a3787309..4f8b9999 100644 --- a/src/WixToolset.BuildTasks/wix.targets +++ b/src/WixToolset.BuildTasks/wix.targets | |||
| @@ -54,8 +54,11 @@ | |||
| 54 | <OutputName Condition=" '$(OutputName)'=='' ">$(MSBuildProjectName)</OutputName> | 54 | <OutputName Condition=" '$(OutputName)'=='' ">$(MSBuildProjectName)</OutputName> |
| 55 | <AssemblyName>$(OutputName)</AssemblyName> | 55 | <AssemblyName>$(OutputName)</AssemblyName> |
| 56 | 56 | ||
| 57 | <!-- Default the OutputType to a known WiX Toolset type. --> | 57 | <!-- Default OutputType to a known WiX Toolset type. --> |
| 58 | <OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType> | 58 | <OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType> |
| 59 | |||
| 60 | <!-- Default WixPdbType to a known WiX Toolset type. --> | ||
| 61 | <WixPdbType Condition=" '$(WixPdbType)' == '' ">full</WixPdbType> | ||
| 59 | </PropertyGroup> | 62 | </PropertyGroup> |
| 60 | 63 | ||
| 61 | <!-- | 64 | <!-- |
| @@ -228,6 +231,11 @@ | |||
| 228 | Condition=" '$(MSBuildToolsVersion)' == '' OR '$(MSBuildToolsVersion)' < '4.0' " | 231 | Condition=" '$(MSBuildToolsVersion)' == '' OR '$(MSBuildToolsVersion)' < '4.0' " |
| 229 | Text="MSBuild v$(MSBuildToolsVersion) is not supported by the project "$(MSBuildProjectFile)". You must use MSBuild v4.0 or later." /> | 232 | Text="MSBuild v$(MSBuildToolsVersion) is not supported by the project "$(MSBuildProjectFile)". You must use MSBuild v4.0 or later." /> |
| 230 | 233 | ||
| 234 | <Error | ||
| 235 | Code="WIX103" | ||
| 236 | Condition=" '$(WixPdbType)' != 'none' and '$(WixPdbType)' != 'full' and '$(WixPdbType)' != 'partial' " | ||
| 237 | Text="The WixPdbType property '$(WixPdbType)' is not valid in project "$(MSBuildProjectFile)". Supported values are: 'full', 'none', 'partial'" /> | ||
| 238 | |||
| 231 | </Target> | 239 | </Target> |
| 232 | 240 | ||
| 233 | <!-- | 241 | <!-- |
| @@ -636,7 +644,8 @@ | |||
| 636 | 644 | ||
| 637 | OutputFile="$(OutputFile)" | 645 | OutputFile="$(OutputFile)" |
| 638 | OutputType="$(OutputType)" | 646 | OutputType="$(OutputType)" |
| 639 | PdbOutputFile="$(PdbOutputFile)" | 647 | PdbFile="$(PdbOutputFile)" |
| 648 | PdbType="$(WixPdbType)" | ||
| 640 | 649 | ||
| 641 | AdditionalOptions="$(CompilerAdditionalOptions) $(LinkerAdditionalOptions)" | 650 | AdditionalOptions="$(CompilerAdditionalOptions) $(LinkerAdditionalOptions)" |
| 642 | DefineConstants="$(DefineConstants);$(SolutionDefineConstants);$(ProjectDefineConstants);$(ProjectReferenceDefineConstants)" | 651 | DefineConstants="$(DefineConstants);$(SolutionDefineConstants);$(ProjectDefineConstants);$(ProjectReferenceDefineConstants)" |
diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs index 9f761c32..c52bb22d 100644 --- a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs +++ b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs | |||
| @@ -52,6 +52,66 @@ namespace WixToolsetTest.BuildTasks | |||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | [Fact] | 54 | [Fact] |
| 55 | public void CanBuildWithDefaultAndExplicitlyFullWixpdbs() | ||
| 56 | { | ||
| 57 | var expectedOutputs = new[] | ||
| 58 | { | ||
| 59 | @"bin\en-US\cab1.cab", | ||
| 60 | @"bin\en-US\MsiPackage.msi", | ||
| 61 | @"bin\en-US\MsiPackage.wixpdb", | ||
| 62 | }; | ||
| 63 | |||
| 64 | this.AssertWixpdb(null, expectedOutputs); | ||
| 65 | this.AssertWixpdb("Full", expectedOutputs); | ||
| 66 | } | ||
| 67 | |||
| 68 | [Fact] | ||
| 69 | public void CanBuildWithPartialWixpdb() | ||
| 70 | { | ||
| 71 | this.AssertWixpdb("partial", new[] | ||
| 72 | { | ||
| 73 | @"bin\en-US\MsiPackage.wixpdb", | ||
| 74 | }); | ||
| 75 | } | ||
| 76 | |||
| 77 | [Fact] | ||
| 78 | public void CanBuildWithNoWixpdb() | ||
| 79 | { | ||
| 80 | this.AssertWixpdb("NONE", new[] | ||
| 81 | { | ||
| 82 | @"bin\en-US\cab1.cab", | ||
| 83 | @"bin\en-US\MsiPackage.msi", | ||
| 84 | }); | ||
| 85 | } | ||
| 86 | |||
| 87 | private void AssertWixpdb(string wixpdbType, string[] expectedOutputFiles) | ||
| 88 | { | ||
| 89 | var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); | ||
| 90 | |||
| 91 | using (var fs = new DisposableFileSystem()) | ||
| 92 | { | ||
| 93 | var baseFolder = fs.GetFolder(); | ||
| 94 | var binFolder = Path.Combine(baseFolder, @"bin\"); | ||
| 95 | var intermediateFolder = Path.Combine(baseFolder, @"obj\"); | ||
| 96 | |||
| 97 | var result = MsbuildRunner.Execute(projectPath, new[] | ||
| 98 | { | ||
| 99 | wixpdbType == null ? String.Empty : $"-p:WixPdbType={wixpdbType}", | ||
| 100 | $"-p:WixTargetsPath={WixTargetsPath}", | ||
| 101 | $"-p:IntermediateOutputPath={intermediateFolder}", | ||
| 102 | $"-p:OutputPath={binFolder}", | ||
| 103 | }); | ||
| 104 | result.AssertSuccess(); | ||
| 105 | |||
| 106 | var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) | ||
| 107 | .Select(s => s.Substring(baseFolder.Length + 1)) | ||
| 108 | .OrderBy(s => s) | ||
| 109 | .ToArray(); | ||
| 110 | Assert.Equal(expectedOutputFiles, paths); | ||
| 111 | } | ||
| 112 | } | ||
| 113 | |||
| 114 | [Fact] | ||
| 55 | public void CanBuild64BitMsiPackage() | 115 | public void CanBuild64BitMsiPackage() |
| 56 | { | 116 | { |
| 57 | var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); | 117 | var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); |
diff --git a/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs b/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs index 41cf8e64..d572a91a 100644 --- a/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs +++ b/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs | |||
| @@ -22,7 +22,7 @@ namespace WixToolsetTest.BuildTasks | |||
| 22 | { | 22 | { |
| 23 | var baseFolder = fs.GetFolder(); | 23 | var baseFolder = fs.GetFolder(); |
| 24 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 24 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 25 | 25 | var pdbPath = Path.Combine(baseFolder, @"bin\testpackage.wixpdb"); | |
| 26 | var engine = new FakeBuildEngine(); | 26 | var engine = new FakeBuildEngine(); |
| 27 | 27 | ||
| 28 | var task = new DoIt | 28 | var task = new DoIt |
| @@ -43,16 +43,18 @@ namespace WixToolsetTest.BuildTasks | |||
| 43 | }, | 43 | }, |
| 44 | IntermediateDirectory = new TaskItem(intermediateFolder), | 44 | IntermediateDirectory = new TaskItem(intermediateFolder), |
| 45 | OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")), | 45 | OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")), |
| 46 | PdbType = "Full", | ||
| 47 | PdbFile = new TaskItem(pdbPath), | ||
| 46 | }; | 48 | }; |
| 47 | 49 | ||
| 48 | var result = task.Execute(); | 50 | var result = task.Execute(); |
| 49 | Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}"); | 51 | Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}"); |
| 50 | 52 | ||
| 51 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); | 53 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); |
| 52 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | 54 | Assert.True(File.Exists(pdbPath)); |
| 53 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab"))); | 55 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab"))); |
| 54 | 56 | ||
| 55 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); | 57 | var intermediate = Intermediate.Load(pdbPath); |
| 56 | var section = intermediate.Sections.Single(); | 58 | var section = intermediate.Sections.Single(); |
| 57 | 59 | ||
| 58 | var fileTuple = section.Tuples.OfType<FileTuple>().Single(); | 60 | var fileTuple = section.Tuples.OfType<FileTuple>().Single(); |
