diff options
Diffstat (limited to 'src/test')
5 files changed, 118 insertions, 11 deletions
diff --git a/src/test/wix/TestData/WixprojModuleCsprojWinFormsNetFx/WixprojModuleCsprojWinFormsNetFx.wixproj b/src/test/wix/TestData/WixprojModuleCsprojWinFormsNetFx/WixprojModuleCsprojWinFormsNetFx.wixproj index 07e42b08..6009460c 100644 --- a/src/test/wix/TestData/WixprojModuleCsprojWinFormsNetFx/WixprojModuleCsprojWinFormsNetFx.wixproj +++ b/src/test/wix/TestData/WixprojModuleCsprojWinFormsNetFx/WixprojModuleCsprojWinFormsNetFx.wixproj | |||
@@ -1,19 +1,11 @@ | |||
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. --> | 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 | |||
2 | <Project Sdk='WixToolset.Sdk'> | 3 | <Project Sdk='WixToolset.Sdk'> |
3 | <!--<Project> | ||
4 | <Import Sdk="WixToolset.Sdk" Project='D:\src\wix4\build\wix\Debug\netcoreapp3.1\Sdk\Sdk.props' />--> | ||
5 | <PropertyGroup> | 4 | <PropertyGroup> |
6 | <OutputType>Module</OutputType> | 5 | <OutputType>Module</OutputType> |
7 | </PropertyGroup> | 6 | </PropertyGroup> |
8 | 7 | ||
9 | <!--<PropertyGroup> | ||
10 | <WixBinDir>D:\src\wix4\build\wix\Debug\publish\WixToolset.Sdk\tools\net461\x86\</WixBinDir> | ||
11 | <WixBinDir64>D:\src\wix4\build\wix\Debug\publish\WixToolset.Sdk\tools\net461\x64\</WixBinDir64> | ||
12 | </PropertyGroup>--> | ||
13 | |||
14 | <ItemGroup> | 8 | <ItemGroup> |
15 | <ProjectReference Include="..\CsprojWindowsFormsNetFx\CsprojWindowsFormsNetFx.csproj" /> | 9 | <ProjectReference Include="..\CsprojWindowsFormsNetFx\CsprojWindowsFormsNetFx.csproj" /> |
16 | </ItemGroup> | 10 | </ItemGroup> |
17 | |||
18 | <!--<Import Sdk="WixToolset.Sdk" Project='D:\src\wix4\build\wix\Debug\netcoreapp3.1\Sdk\Sdk.targets' />--> | ||
19 | </Project> | 11 | </Project> |
diff --git a/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.ja-jp.wxl b/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.ja-jp.wxl index 52e1871e..0f902c8d 100644 --- a/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.ja-jp.wxl +++ b/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.ja-jp.wxl | |||
@@ -5,7 +5,7 @@ This file contains the declaration of all the localizable strings. | |||
5 | --> | 5 | --> |
6 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="ja-JP"> | 6 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="ja-JP"> |
7 | 7 | ||
8 | <String Id="PackageName">WixprojPackageVcxprojWindowsApp, eh?</String> | 8 | <String Id="PackageName">WixprojPackageVcxprojWindowsApp-jp</String> |
9 | <String Id="FeatureTitle">The First Feature in my Prooooduct, eh?</String> | 9 | <String Id="FeatureTitle">The First Feature in my Prooooduct, eh?</String> |
10 | 10 | ||
11 | </WixLocalization> | 11 | </WixLocalization> |
diff --git a/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.wxs b/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.wxs index fe849608..508d4721 100644 --- a/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.wxs +++ b/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.wxs | |||
@@ -1,5 +1,7 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" |
2 | xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui"> | ||
2 | <Package Name='!(loc.PackageName)' Manufacturer='WiX Toolset' Version='0.0.1' UpgradeCode='41a2c17e-1976-465b-bcde-eae03516ca68'> | 3 | <Package Name='!(loc.PackageName)' Manufacturer='WiX Toolset' Version='0.0.1' UpgradeCode='41a2c17e-1976-465b-bcde-eae03516ca68'> |
4 | <SoftwareTag Regid='wixtoolset.org' InstallDirectory='ApplicationFolder' /> | ||
3 | 5 | ||
4 | <StandardDirectory Id='ProgramFiles6432Folder'> | 6 | <StandardDirectory Id='ProgramFiles6432Folder'> |
5 | <Directory Id='ApplicationFolder' Name='Test App'> | 7 | <Directory Id='ApplicationFolder' Name='Test App'> |
@@ -16,5 +18,7 @@ | |||
16 | 18 | ||
17 | <MergeRef Id='WinFormsModule' /> | 19 | <MergeRef Id='WinFormsModule' /> |
18 | </Feature> | 20 | </Feature> |
21 | |||
22 | <ui:WixUI Id="WixUI_Minimal" /> | ||
19 | </Package> | 23 | </Package> |
20 | </Wix> | 24 | </Wix> |
diff --git a/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/WixprojPackageVcxprojWindowsApp.wixproj b/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/WixprojPackageVcxprojWindowsApp.wixproj index 7dc26a2d..bbd39870 100644 --- a/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/WixprojPackageVcxprojWindowsApp.wixproj +++ b/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/WixprojPackageVcxprojWindowsApp.wixproj | |||
@@ -5,5 +5,7 @@ | |||
5 | <ProjectReference Include="..\VcxprojWindowsApp\VcxprojWindowsApp.vcxproj" /> | 5 | <ProjectReference Include="..\VcxprojWindowsApp\VcxprojWindowsApp.vcxproj" /> |
6 | <ProjectReference Include="..\WixprojLibraryVcxprojDll\WixprojLibraryVcxprojDll.wixproj" /> | 6 | <ProjectReference Include="..\WixprojLibraryVcxprojDll\WixprojLibraryVcxprojDll.wixproj" /> |
7 | <ProjectReference Include="..\WixprojModuleCsprojWinFormsNetFx\WixprojModuleCsprojWinFormsNetFx.wixproj" /> | 7 | <ProjectReference Include="..\WixprojModuleCsprojWinFormsNetFx\WixprojModuleCsprojWinFormsNetFx.wixproj" /> |
8 | |||
9 | <PackageReference Include="Wixtoolset.UI.wixext" Version="4.0.0-preview.1-build.205" /> | ||
8 | </ItemGroup> | 10 | </ItemGroup> |
9 | </Project> | 11 | </Project> |
diff --git a/src/test/wix/WixE2E/WixE2EFixture.cs b/src/test/wix/WixE2E/WixE2EFixture.cs index 89762f72..b1c6b2de 100644 --- a/src/test/wix/WixE2E/WixE2EFixture.cs +++ b/src/test/wix/WixE2E/WixE2EFixture.cs | |||
@@ -2,7 +2,12 @@ | |||
2 | 2 | ||
3 | namespace WixE2E | 3 | namespace WixE2E |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.IO; | 6 | using System.IO; |
7 | using System.Linq; | ||
8 | using System.Security.Cryptography; | ||
9 | using System.Text; | ||
10 | using System.Threading; | ||
6 | using WixBuildTools.TestSupport; | 11 | using WixBuildTools.TestSupport; |
7 | using Xunit; | 12 | using Xunit; |
8 | 13 | ||
@@ -52,6 +57,93 @@ namespace WixE2E | |||
52 | result.AssertSuccess(); | 57 | result.AssertSuccess(); |
53 | } | 58 | } |
54 | 59 | ||
60 | [Fact] | ||
61 | public void CanIncrementalBuildPackageWithNativeWindowsAppWithNoEdits() | ||
62 | { | ||
63 | var projectDirectory = TestData.Get("TestData", "WixprojPackageVcxprojWindowsApp"); | ||
64 | var projectPath = Path.Combine(projectDirectory, "WixprojPackageVcxprojWindowsApp.wixproj"); | ||
65 | var projectBinPath = Path.Combine(projectDirectory, "bin"); | ||
66 | |||
67 | CleanEverything(); | ||
68 | |||
69 | var result = RestoreAndBuild(projectPath); | ||
70 | result.AssertSuccess(); | ||
71 | |||
72 | var firstBuiltFiles = Directory.GetFiles(projectBinPath, "*.*", SearchOption.AllDirectories).ToArray(); | ||
73 | var firstHashes = firstBuiltFiles.Select(s => $"{s.Substring(projectBinPath.Length).TrimStart('\\')} with hash: {GetFileHash(s)}").ToArray(); | ||
74 | |||
75 | // This should be an incremental build and not do any work. | ||
76 | // | ||
77 | result = RestoreAndBuild(projectPath); | ||
78 | result.AssertSuccess(); | ||
79 | |||
80 | var secondBuiltFiles = Directory.GetFiles(projectBinPath, "*.*", SearchOption.AllDirectories).ToArray(); | ||
81 | var secondHashes = secondBuiltFiles.Select(s => $"{s.Substring(projectBinPath.Length).TrimStart('\\')} with hash: {GetFileHash(s)}").ToArray(); | ||
82 | |||
83 | WixAssert.CompareLineByLine(firstHashes, secondHashes); | ||
84 | } | ||
85 | |||
86 | [Fact] | ||
87 | public void CanIncrementalBuildPackageWithNativeWindowsAppWithEdits() | ||
88 | { | ||
89 | var projectDirectory = TestData.Get("TestData", "WixprojPackageVcxprojWindowsApp"); | ||
90 | var projectPath = Path.Combine(projectDirectory, "WixprojPackageVcxprojWindowsApp.wixproj"); | ||
91 | var projectBinPath = Path.Combine(projectDirectory, "bin"); | ||
92 | |||
93 | CleanEverything(); | ||
94 | |||
95 | var result = RestoreAndBuild(projectPath); | ||
96 | result.AssertSuccess(); | ||
97 | |||
98 | var firstBuiltFiles = Directory.GetFiles(projectBinPath, "*.*", SearchOption.AllDirectories).ToArray(); | ||
99 | var firstRelativePaths = firstBuiltFiles.Select(s => $"{s.Substring(projectBinPath.Length).TrimStart('\\')}").ToArray(); | ||
100 | var firstHashes = firstBuiltFiles.Select(s => $"{s.Substring(projectBinPath.Length).TrimStart('\\')} with hash: {GetFileHash(s)}").ToArray(); | ||
101 | |||
102 | var packageWxsPath = Path.Combine(projectDirectory, "Package.wxs"); | ||
103 | File.SetLastWriteTime(packageWxsPath, DateTime.Now); | ||
104 | |||
105 | // This should be an incremental build that does work because a file was updated. | ||
106 | // | ||
107 | result = RestoreAndBuild(projectPath); | ||
108 | result.AssertSuccess(); | ||
109 | |||
110 | var secondBuiltFiles = Directory.GetFiles(projectBinPath, "*.*", SearchOption.AllDirectories).ToArray(); | ||
111 | var secondRelativePaths = secondBuiltFiles.Select(s => $"{s.Substring(projectBinPath.Length).TrimStart('\\')}").ToArray(); | ||
112 | var secondHashes = secondBuiltFiles.Select(s => $"{s.Substring(projectBinPath.Length).TrimStart('\\')} with hash: {GetFileHash(s)}").ToArray(); | ||
113 | |||
114 | WixAssert.CompareLineByLine(firstRelativePaths, secondRelativePaths); | ||
115 | Assert.NotEqual(firstHashes, secondHashes); | ||
116 | } | ||
117 | |||
118 | [Fact(Skip = "Investigate if .NET Core WebApplications can be incrementally built")] | ||
119 | public void CanIncrementalBuildPackageWithNetCoreWebAppWithoutEdits() | ||
120 | { | ||
121 | var projectDirectory = TestData.Get("TestData", "WixprojPackageCsprojWebApplicationNetCore"); | ||
122 | var projectPath = Path.Combine(projectDirectory, "WixprojPackageCsprojWebApplicationNetCore.wixproj"); | ||
123 | var projectBinPath = Path.Combine(projectDirectory, "bin"); | ||
124 | |||
125 | CleanEverything(); | ||
126 | |||
127 | var result = RestoreAndBuild(projectPath); | ||
128 | result.AssertSuccess(); | ||
129 | |||
130 | var firstBuiltFiles = Directory.GetFiles(projectBinPath, "*.*", SearchOption.AllDirectories).ToArray(); | ||
131 | var firstHashes = firstBuiltFiles.Select(s => $"{s.Substring(projectBinPath.Length).TrimStart('\\')} with hash: {GetFileHash(s)}").ToArray(); | ||
132 | |||
133 | //var packageWxsPath = Path.Combine(projectDirectory, "Package.wxs"); | ||
134 | //File.SetLastWriteTime(packageWxsPath, DateTime.Now); | ||
135 | |||
136 | // This should be an incremental build that does work because a file was updated. | ||
137 | // | ||
138 | result = RestoreAndBuild(projectPath); | ||
139 | result.AssertSuccess(); | ||
140 | |||
141 | var secondBuiltFiles = Directory.GetFiles(projectBinPath, "*.*", SearchOption.AllDirectories).ToArray(); | ||
142 | var secondHashes = secondBuiltFiles.Select(s => $"{s.Substring(projectBinPath.Length).TrimStart('\\')} with hash: {GetFileHash(s)}").ToArray(); | ||
143 | |||
144 | WixAssert.CompareLineByLine(firstHashes, secondHashes); | ||
145 | } | ||
146 | |||
55 | private static void CleanEverything() | 147 | private static void CleanEverything() |
56 | { | 148 | { |
57 | var rootFolder = TestData.Get("TestData"); | 149 | var rootFolder = TestData.Get("TestData"); |
@@ -71,6 +163,23 @@ namespace WixE2E | |||
71 | } | 163 | } |
72 | } | 164 | } |
73 | 165 | ||
166 | private static string GetFileHash(string path) | ||
167 | { | ||
168 | using (var sha2 = SHA256.Create()) | ||
169 | { | ||
170 | var bytes = File.ReadAllBytes(path); | ||
171 | var hashBytes = sha2.ComputeHash(bytes); | ||
172 | |||
173 | var sb = new StringBuilder(); | ||
174 | foreach (var hash in hashBytes) | ||
175 | { | ||
176 | sb.AppendFormat("{0:X}", hash); | ||
177 | } | ||
178 | |||
179 | return sb.ToString(); | ||
180 | } | ||
181 | } | ||
182 | |||
74 | private static MsbuildRunnerResult RestoreAndBuild(string projectPath, bool x64 = true) | 183 | private static MsbuildRunnerResult RestoreAndBuild(string projectPath, bool x64 = true) |
75 | { | 184 | { |
76 | return MsbuildRunner.Execute(projectPath, new[] { "-Restore", "-v:m", "-bl" }, x64); | 185 | return MsbuildRunner.Execute(projectPath, new[] { "-Restore", "-v:m", "-bl" }, x64); |