Modernize tuple creation and update dependencies.
Bob Arnson committed
Oct 28, 2019 at 21:17 UTC
7a934bcfb8d460b0cf91a51caa956a8bbff14edf
10 files changed
+47
-60
src/ca/fwca.vcxproj
+6
-17
@@ -1,10 +1,8 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<!-- 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. -->
3
-
3
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5
- <Import Project="..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props')" />
6
- <Import Project="..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props" Condition="Exists('..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props')" />
7
-
4
+ <Import Project="..\..\packages\WixToolset.WcaUtil.4.0.8\build\WixToolset.WcaUtil.props" Condition="Exists('..\..\packages\WixToolset.WcaUtil.4.0.8\build\WixToolset.WcaUtil.props')" />
5
+ <Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
6
<ItemGroup Label="ProjectConfigurations">
7
<ProjectConfiguration Include="Debug|Win32">
8
<Configuration>Debug</Configuration>
@@ -15,7 +13,6 @@
13
<Platform>Win32</Platform>
14
</ProjectConfiguration>
15
</ItemGroup>
18
-
16
<PropertyGroup Label="Globals">
17
<ProjectGuid>{F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}</ProjectGuid>
18
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -25,40 +22,32 @@
22
<ProjectModuleDefinitionFile>fwca.def</ProjectModuleDefinitionFile>
23
<Description>WiX Toolset Firewall CustomAction</Description>
24
</PropertyGroup>
28
-
25
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
26
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31
-
27
<PropertyGroup>
28
<ProjectAdditionalLinkLibraries>msi.lib</ProjectAdditionalLinkLibraries>
29
</PropertyGroup>
35
-
30
<ItemGroup>
31
<ClCompile Include="dllmain.cpp">
32
<PrecompiledHeader>Create</PrecompiledHeader>
33
</ClCompile>
34
<ClCompile Include="firewall.cpp" />
35
</ItemGroup>
42
-
36
<ItemGroup>
37
<ClInclude Include="cost.h" />
38
<ClInclude Include="CustomMsiErrors.h" />
39
<ClInclude Include="precomp.h" />
40
</ItemGroup>
48
-
41
<ItemGroup>
50
- <None Include="packages.config" />
42
<None Include="fwca.def" />
43
+ <None Include="packages.config" />
44
</ItemGroup>
53
-
45
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
55
-
46
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
47
<PropertyGroup>
48
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
49
</PropertyGroup>
60
- <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props'))" />
61
- <Error Condition="!Exists('..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props'))" />
50
+ <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props'))" />
51
+ <Error Condition="!Exists('..\..\packages\WixToolset.WcaUtil.4.0.8\build\WixToolset.WcaUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.WcaUtil.4.0.8\build\WixToolset.WcaUtil.props'))" />
52
</Target>
63
-</Project>
64
-
53
+</Project>
\ No newline at end of file
src/ca/packages.config
+2
-2
@@ -1,5 +1,5 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<packages>
3
- <package id="WixToolset.DUtil" version="4.0.6" targetFramework="native" />
4
- <package id="WixToolset.WcaUtil" version="4.0.2" targetFramework="native" />
3
+ <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
4
+ <package id="WixToolset.WcaUtil" version="4.0.8" targetFramework="native" />
5
</packages>
\ No newline at end of file
src/test/WixToolsetTest.Firewall/WixToolsetTest.Firewall.csproj
+9
-3
@@ -23,6 +23,9 @@
23
</ItemGroup>
24
25
<ItemGroup>
26
+ <PackageReference Include="WixToolset.Core" Version="4.0.*" PrivateAssets="all" />
27
+ <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" PrivateAssets="all" />
28
+ <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" PrivateAssets="all" />
29
<PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" PrivateAssets="all" />
30
</ItemGroup>
31
@@ -31,8 +34,11 @@
34
</ItemGroup>
35
36
<ItemGroup>
34
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
35
- <PackageReference Include="xunit" Version="2.4.0" />
36
- <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
37
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
38
+ <PackageReference Include="xunit" Version="2.4.1" />
39
+ <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
40
+ <PrivateAssets>all</PrivateAssets>
41
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
42
+ </PackageReference>
43
</ItemGroup>
44
</Project>
src/wixext/FirewallCompiler.cs
+15
-18
@@ -4,10 +4,10 @@ namespace WixToolset.Firewall
4
{
5
using System;
6
using System.Collections.Generic;
7
- using System.Globalization;
7
using System.Xml.Linq;
8
using WixToolset.Data;
9
using WixToolset.Extensibility;
10
+ using WixToolset.Firewall.Tuples;
11
12
/// <summary>
13
/// The compiler for the WiX Toolset Firewall Extension.
@@ -255,13 +255,18 @@ namespace WixToolset.Firewall
255
fileId = file;
256
}
257
258
- var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixFirewallException", id);
259
- row.Set(1, name);
260
- row.Set(2, remoteAddresses);
258
+ var tuple = new WixFirewallExceptionTuple(sourceLineNumbers, id)
259
+ {
260
+ Name = name,
261
+ RemoteAddresses = remoteAddresses,
262
+ Profile = profile ?? FirewallConstants.NET_FW_PROFILE2_ALL,
263
+ ComponentRef = componentId,
264
+ Description = description,
265
+ };
266
267
if (!String.IsNullOrEmpty(port))
268
{
264
- row.Set(3, port);
269
+ tuple.Port = port;
270
271
if (!protocol.HasValue)
272
{
@@ -270,32 +275,24 @@ namespace WixToolset.Firewall
275
}
276
}
277
273
- if (protocol.HasValue)
274
- {
275
- row.Set(4, protocol);
276
- }
278
+ tuple.Protocol = protocol.Value;
279
280
if (!String.IsNullOrEmpty(fileId))
281
{
280
- row.Set(5, $"[#{fileId}]");
282
+ tuple.Program = $"[#{fileId}]";
283
this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", fileId);
284
}
285
else if (!String.IsNullOrEmpty(program))
286
{
285
- row.Set(5, program);
287
+ tuple.Program = program;
288
}
289
290
if (CompilerConstants.IntegerNotSet != attributes)
291
{
290
- row.Set(6, attributes);
292
+ tuple.Attributes = attributes;
293
}
294
293
- // Default is "all"
294
- row.Set(7, profile ?? FirewallConstants.NET_FW_PROFILE2_ALL);
295
-
296
- row.Set(8, componentId);
297
-
298
- row.Set(9, description);
295
+ section.Tuples.Add(tuple);
296
297
if (this.Context.Platform == Platform.ARM)
298
{
src/wixext/FirewallWindowsInstallerBackendExtension.cs
+4
-1
@@ -1,9 +1,10 @@
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
3
namespace WixToolset.Firewall
4
{
5
using System.Linq;
6
using System.Xml;
7
+ using WixToolset.Data;
8
using WixToolset.Data.WindowsInstaller;
9
using WixToolset.Extensibility;
10
@@ -13,6 +14,8 @@ namespace WixToolset.Firewall
14
15
protected override TableDefinition[] TableDefinitionsForTuples => Tables;
16
17
+ public override bool TryAddTupleToOutput(IntermediateTuple tuple, WindowsInstallerData output) => this.BackendHelper.TryAddTupleToOutputMatchingTableDefinitions(tuple, output, this.TableDefinitionsForTuples, true);
18
+
19
private static TableDefinition[] LoadTables()
20
{
21
using (var resourceStream = typeof(FirewallWindowsInstallerBackendBinderExtension).Assembly.GetManifestResourceStream("WixToolset.Firewall.tables.xml"))
src/wixext/Tuples/FirewallTupleDefinitions.cs
+1
-2
@@ -15,7 +15,6 @@ namespace WixToolset.Firewall.Tuples
15
FirewallTupleDefinitionNames.WixFirewallException,
16
new[]
17
{
18
- new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.WixFirewallException), IntermediateFieldType.String),
18
new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Name), IntermediateFieldType.String),
19
new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.RemoteAddresses), IntermediateFieldType.String),
20
new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Port), IntermediateFieldType.String),
@@ -23,7 +22,7 @@ namespace WixToolset.Firewall.Tuples
22
new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Program), IntermediateFieldType.String),
23
new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Attributes), IntermediateFieldType.Number),
24
new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Profile), IntermediateFieldType.Number),
26
- new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Component_), IntermediateFieldType.String),
25
+ new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.ComponentRef), IntermediateFieldType.String),
26
new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Description), IntermediateFieldType.String),
27
},
28
typeof(WixFirewallExceptionTuple));
src/wixext/Tuples/WixFirewallExceptionTuple.cs
+6
-13
@@ -6,7 +6,6 @@ namespace WixToolset.Firewall.Tuples
6
7
public enum WixFirewallExceptionTupleFields
8
{
9
- WixFirewallException,
9
Name,
10
RemoteAddresses,
11
Port,
@@ -14,7 +13,7 @@ namespace WixToolset.Firewall.Tuples
13
Program,
14
Attributes,
15
Profile,
17
- Component_,
16
+ ComponentRef,
17
Description,
18
}
19
@@ -30,12 +29,6 @@ namespace WixToolset.Firewall.Tuples
29
30
public IntermediateField this[WixFirewallExceptionTupleFields index] => this.Fields[(int)index];
31
33
- public string WixFirewallException
34
- {
35
- get => this.Fields[(int)WixFirewallExceptionTupleFields.WixFirewallException].AsString();
36
- set => this.Set((int)WixFirewallExceptionTupleFields.WixFirewallException, value);
37
- }
38
-
32
public string Name
33
{
34
get => this.Fields[(int)WixFirewallExceptionTupleFields.Name].AsString();
@@ -54,9 +47,9 @@ namespace WixToolset.Firewall.Tuples
47
set => this.Set((int)WixFirewallExceptionTupleFields.Port, value);
48
}
49
57
- public int Protocol
50
+ public int? Protocol
51
{
59
- get => this.Fields[(int)WixFirewallExceptionTupleFields.Protocol].AsNumber();
52
+ get => this.Fields[(int)WixFirewallExceptionTupleFields.Protocol].AsNullableNumber();
53
set => this.Set((int)WixFirewallExceptionTupleFields.Protocol, value);
54
}
55
@@ -78,10 +71,10 @@ namespace WixToolset.Firewall.Tuples
71
set => this.Set((int)WixFirewallExceptionTupleFields.Profile, value);
72
}
73
81
- public string Component_
74
+ public string ComponentRef
75
{
83
- get => this.Fields[(int)WixFirewallExceptionTupleFields.Component_].AsString();
84
- set => this.Set((int)WixFirewallExceptionTupleFields.Component_, value);
76
+ get => this.Fields[(int)WixFirewallExceptionTupleFields.ComponentRef].AsString();
77
+ set => this.Set((int)WixFirewallExceptionTupleFields.ComponentRef, value);
78
}
79
80
public string Description
src/wixext/tables.xml
+1
-1
@@ -17,7 +17,7 @@
17
<columnDefinition name="Program" type="string" length="255" nullable="yes" modularize="property"
18
category="formatted" description="Exception for a program (formatted path name)." />
19
<columnDefinition name="Attributes" type="number" length="4" nullable="yes"
20
- minValue="0" maxValue="65536" description="Vital=1" />
20
+ description="Vital=1" />
21
<columnDefinition name="Profile" type="number" length="4" nullable="no"
22
category="integer" minValue="1" maxValue="2147483647" description="Profile (1=domain; 2=private; 4=public; 2147483647=all)." />
23
<columnDefinition name="Component_" type="string" length="72" modularize="column"
src/wixlib/firewall.wixproj
+2
-2
@@ -1,7 +1,7 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<!-- 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. -->
3
<Project DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
4
- <Import Project="..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props" Condition="Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props')" />
4
+ <Import Project="..\..\packages\WixToolset.MSBuild.4.0.0-build-0051\build\WixToolset.MSBuild.props" Condition="Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0051\build\WixToolset.MSBuild.props')" />
5
<Import Project="..\FindLocalWix.props" />
6
<PropertyGroup>
7
<ProjectGuid>{1acffefd-505a-41a5-acbf-a02b7b473aa2}</ProjectGuid>
@@ -38,7 +38,7 @@
38
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
39
</PropertyGroup>
40
<Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
41
- <Error Condition="!Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props'))" />
41
+ <Error Condition="!Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0051\build\WixToolset.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.MSBuild.4.0.0-build-0051\build\WixToolset.MSBuild.props'))" />
42
</Target>
43
<Import Project="..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" />
44
</Project>
\ No newline at end of file
src/wixlib/packages.config
+1
-1
@@ -1,5 +1,5 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<packages>
3
<package id="Nerdbank.GitVersioning" version="2.1.65" developmentDependency="true" targetFramework="net40" />
4
- <package id="WixToolset.MSBuild" version="4.0.0-build-0005" developmentDependency="true" targetFramework="net40" />
4
+ <package id="WixToolset.MSBuild" version="4.0.0-build-0051" developmentDependency="true" targetFramework="net40" />
5
</packages>
\ No newline at end of file