Skip to content
/ wix Public

Commit 717ac81

Browse files
committed
Sync IEngine.SetUpdateSource with native side.
Fixes wixtoolset/issues#9023
1 parent 90b1d34 commit 717ac81

File tree

8 files changed

+96
-4
lines changed

8 files changed

+96
-4
lines changed

src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ public void SetUpdate(string localSource, string downloadSource, long size, Upda
259259
}
260260

261261
/// <inheritdoc/>
262-
public void SetUpdateSource(string url)
262+
public void SetUpdateSource(string url, string authorizationHeader)
263263
{
264-
this.engine.SetUpdateSource(url);
264+
this.engine.SetUpdateSource(url, authorizationHeader);
265265
}
266266

267267
/// <inheritdoc/>

src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ void LaunchApprovedExe(
220220
/// Sets the URL to the update feed.
221221
/// </summary>
222222
void SetUpdateSource(
223-
[MarshalAs(UnmanagedType.LPWStr)] string url
223+
[MarshalAs(UnmanagedType.LPWStr)] string url,
224+
[MarshalAs(UnmanagedType.LPWStr)] string wzAuthorizationHeader
224225
);
225226

226227
/// <summary>

src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ public interface IEngine
156156
/// Sets the URL to the update feed.
157157
/// </summary>
158158
/// <param name="url">URL of the update feed.</param>
159-
void SetUpdateSource(string url);
159+
/// <param name="authorizationHeader">Additional proxy authentication header. Not currently used.</param>
160+
void SetUpdateSource(string url, string authorizationHeader);
160161

161162
/// <summary>
162163
/// Set the local source for a package or container.

src/test/burn/TestBA/TestBA.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class TestBA : BootstrapperApplication
4242
private int retryExecuteFilesInUse;
4343
private bool rollingBack;
4444
private string forceDownloadSource;
45+
private string forceUpdateSource;
4546

4647
private IBootstrapperCommand Command { get; set; }
4748

@@ -217,9 +218,28 @@ private void ShutdownUiThread(int? exitCode = null)
217218
}
218219
}
219220

221+
protected override void OnDetectBegin(DetectBeginEventArgs args)
222+
{
223+
this.Log("OnDetectBegin");
224+
225+
this.forceUpdateSource = this.ReadPackageAction(null, "ForceUpdateSource");
226+
if (!String.IsNullOrEmpty(this.forceUpdateSource))
227+
{
228+
this.Log(" OnDetectBegin::ForceUpdateSource: {0}", this.forceUpdateSource);
229+
}
230+
231+
}
232+
220233
protected override void OnDetectUpdateBegin(DetectUpdateBeginEventArgs args)
221234
{
222235
this.Log("OnDetectUpdateBegin");
236+
237+
if (!String.IsNullOrEmpty(this.forceUpdateSource))
238+
{
239+
this.Log(" OnDetectUpdateBegin::ForceUpdateSource: {0}", this.forceUpdateSource);
240+
this.Engine.SetUpdateSource(this.forceUpdateSource, String.Empty);
241+
}
242+
223243
if (LaunchAction.UpdateReplaceEmbedded == this.action || LaunchAction.UpdateReplace == this.action)
224244
{
225245
args.Skip = false;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
<?ifndef TestVersion?>
4+
<?define TestVersion = 1.0.0.0?>
5+
<?endif?>
6+
7+
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
8+
<Bundle
9+
Name="~$(var.TestGroupName) - $(var.BundleName)"
10+
Version="$(var.TestVersion)"
11+
Id="WixToolset.Burn.SetUpdateSourceTest"
12+
Compressed="yes">
13+
14+
<Update Location="updateurl" />
15+
16+
<Log Prefix="~$(var.TestGroupName)_$(var.BundleName)" />
17+
18+
<Variable Name="TestGroupName" Value="$(var.TestGroupName)" />
19+
20+
<Chain>
21+
<PackageGroupRef Id="TestBA" />
22+
<PackageGroupRef Id="BundlePackages" />
23+
</Chain>
24+
</Bundle>
25+
26+
<Fragment>
27+
<PackageGroup Id="BundlePackages">
28+
<MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" />
29+
</PackageGroup>
30+
</Fragment>
31+
</Wix>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<Project Sdk="WixToolset.Sdk">
3+
<PropertyGroup>
4+
<OutputType>Bundle</OutputType>
5+
<UpgradeCode>{C60B9483-CE87-4FDA-AE5A-B39A52E956E8}</UpgradeCode>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<ProjectReference Include="..\PackageA\PackageA.wixproj" />
9+
<ProjectReference Include="..\PackageB\PackageB.wixproj" />
10+
<ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<PackageReference Include="WixToolset.BootstrapperApplications.wixext" />
14+
<PackageReference Include="WixToolset.NetFx.wixext" />
15+
</ItemGroup>
16+
</Project>

src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ public void CanSetDownloadSourceAndForceDownload()
2929
packageA.VerifyInstalled(false);
3030
}
3131

32+
[RuntimeFact]
33+
public void CanSetUpdateSource()
34+
{
35+
var packageA = this.CreatePackageInstaller("PackageA");
36+
var bundleA = this.CreateBundleInstaller("BundleUpdate");
37+
var testBAController = this.CreateTestBAController();
38+
39+
testBAController.SetForceUpdateSource("https://1e1bf2be1c384fd1a0c4c0500eef971b/update_feed.atom.xml");
40+
41+
packageA.VerifyInstalled(false);
42+
43+
bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
44+
45+
bundleA.Install();
46+
47+
packageA.VerifyInstalled(true);
48+
}
49+
3250
[RuntimeFact]
3351
public void CanCancelExePackageAndAbandonIt()
3452
{

src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public void SetQuitAfterDetect(string value = "true")
6767
this.SetBurnTestValue("QuitAfterDetect", value);
6868
}
6969

70+
public void SetForceUpdateSource(string url)
71+
{
72+
this.SetBurnTestValue("ForceUpdateSource", url);
73+
}
74+
7075
/// <summary>
7176
/// Slows the cache progress of a package.
7277
/// </summary>

0 commit comments

Comments
 (0)