@joebigelow / wix-1 / commits / aecff401

Modernize NetfxCompiler and table definitions.

Sean Hall committed Apr 5, 2020 at 21:27 UTC aecff401f974f603cb78b8a665000b2a93490e80
7 files changed +48 -36
src/Directory.Build.props
+3 -1
@@ -8,6 +8,7 @@
8 <PropertyGroup>
9 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
10 <EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink>
11 + <MSBuildWarningsAsMessages>MSB3246</MSBuildWarningsAsMessages>
12
13 <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName>
14 <BaseOutputPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\))</BaseOutputPath>
@@ -21,6 +22,7 @@
22 <Product>WiX Toolset</Product>
23 </PropertyGroup>
24
24 - <Import Project="Cpp.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.vcxproj' " />
25 + <Import Project="Cpp.Build.props" Condition=" Exists('Cpp.Build.props') And '$(MSBuildProjectExtension)'=='.vcxproj' " />
26 + <Import Project="Wix.Build.props" Condition=" Exists('Wix.Build.props') And '$(MSBuildProjectExtension)'=='.wixproj' " />
27 <Import Project="Custom.Build.props" Condition=" Exists('Custom.Build.props') " />
28 </Project>
src/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj
+6 -9
@@ -3,7 +3,7 @@
3
4 <Project Sdk="Microsoft.NET.Sdk">
5 <PropertyGroup>
6 - <TargetFramework>netcoreapp2.1</TargetFramework>
6 + <TargetFramework>netcoreapp3.1</TargetFramework>
7 <IsPackable>false</IsPackable>
8 </PropertyGroup>
9
@@ -23,10 +23,10 @@
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" />
26 + <PackageReference Include="WixToolset.Core" Version="4.0.*" />
27 + <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" />
28 + <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" />
29 + <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" />
30 </ItemGroup>
31
32 <ItemGroup>
@@ -36,9 +36,6 @@
36 <ItemGroup>
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>
39 + <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />
40 </ItemGroup>
41 </Project>
src/wixext/NetFxCompiler.cs
+6 -6
@@ -53,14 +53,14 @@ namespace WixToolset.Netfx
53 /// <param name="fileId">The file identifier of the parent element.</param>
54 private void ParseNativeImageElement(Intermediate intermediate, IntermediateSection section, XElement element, string fileId)
55 {
56 - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
56 + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
57 Identifier id = null;
58 string appBaseDirectory = null;
59 string assemblyApplication = null;
60 int attributes = 0x8; // 32bit is on by default
61 int priority = 3;
62
63 - foreach (XAttribute attrib in element.Attributes())
63 + foreach (var attrib in element.Attributes())
64 {
65 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
66 {
@@ -75,7 +75,7 @@ namespace WixToolset.Netfx
75 // See if a formatted value is specified.
76 if (-1 == appBaseDirectory.IndexOf("[", StringComparison.Ordinal))
77 {
78 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Directory", appBaseDirectory);
78 + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Directory, appBaseDirectory);
79 }
80 break;
81 case "AssemblyApplication":
@@ -84,7 +84,7 @@ namespace WixToolset.Netfx
84 // See if a formatted value is specified.
85 if (-1 == assemblyApplication.IndexOf("[", StringComparison.Ordinal))
86 {
87 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", assemblyApplication);
87 + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.File, assemblyApplication);
88 }
89 break;
90 case "Debug":
@@ -140,7 +140,7 @@ namespace WixToolset.Netfx
140
141 if (null == id)
142 {
143 - this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id"));
143 + id = this.ParseHelper.CreateIdentifier("nni", fileId);
144 }
145
146 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
@@ -149,7 +149,7 @@ namespace WixToolset.Netfx
149
150 if (!this.Messaging.EncounteredError)
151 {
152 - section.Tuples.Add(new NetFxNativeImageTuple(sourceLineNumbers, id)
152 + section.AddTuple(new NetFxNativeImageTuple(sourceLineNumbers, id)
153 {
154 FileRef = fileId,
155 Priority = priority,
src/wixext/NetfxTableDefinitions.cs new
+29
@@ -0,0 +1,29 @@
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.Netfx
4 +{
5 + using WixToolset.Data.WindowsInstaller;
6 +
7 + public static class NetfxTableDefinitions
8 + {
9 + public static readonly TableDefinition NetFxNativeImage = new TableDefinition(
10 + "Wix4NetFxNativeImage",
11 + new[]
12 + {
13 + new ColumnDefinition("Wix4NetFxNativeImage", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The primary key, a non-localized token.", modularizeType: ColumnModularizeType.Column),
14 + new ColumnDefinition("File_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "File", keyColumn: 1, description: "The assembly for which a native image will be generated.", modularizeType: ColumnModularizeType.Column),
15 + new ColumnDefinition("Priority", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Integer, minValue: 0, maxValue: 3, description: "The priority for generating this native image: 0 is syncronous, 1-3 represent various levels of queued generation."),
16 + new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Integer, minValue: 0, maxValue: 2147483647, description: "Integer containing bit flags representing native image attributes."),
17 + new ColumnDefinition("File_Application", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "The application which loads this assembly.", modularizeType: ColumnModularizeType.Column),
18 + new ColumnDefinition("Directory_ApplicationBase", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "The directory containing the application which loads this assembly.", modularizeType: ColumnModularizeType.Column),
19 + },
20 + tupleDefinitionName: "NetFxNativeImage",
21 + tupleIdIsPrimaryKey: true
22 + );
23 +
24 + public static readonly TableDefinition[] All = new[]
25 + {
26 + NetFxNativeImage,
27 + };
28 + }
29 +}
src/wixext/NetfxWindowsInstallerBackendExtension.cs
+1 -17
@@ -8,22 +8,6 @@ namespace WixToolset.Netfx
8
9 public class NetfxWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension
10 {
11 - private static readonly TableDefinition[] Tables = new[] {
12 - new TableDefinition(
13 - "Wix4NetFxNativeImage",
14 - "NetFxNativeImage",
15 - new[]
16 - {
17 - new ColumnDefinition("Wix4NetFxNativeImage", ColumnType.String, 72, true, false, ColumnCategory.Identifier, description: "The primary key, a non-localized token."),
18 - new ColumnDefinition("File_", ColumnType.String, 0, false, false, ColumnCategory.Identifier, keyTable:"File", keyColumn: 1, description: "The assembly for which a native image will be generated."),
19 - new ColumnDefinition("Priority", ColumnType.Number, 2, false, false, ColumnCategory.Integer, maxValue: 3, description: "The priority for generating this native image: 0 is syncronous, 1-3 represent various levels of queued generation."),
20 - new ColumnDefinition("Attributes", ColumnType.Number, 4, false, false, ColumnCategory.Integer, maxValue: 2147483647, description: "Integer containing bit flags representing native image attributes."),
21 - new ColumnDefinition("File_Application", ColumnType.String, 72, false, true, ColumnCategory.Formatted, description: "The application which loads this assembly."),
22 - new ColumnDefinition("Directory_ApplicationBase", ColumnType.String, 72, false, true, ColumnCategory.Formatted, description: "The directory containing the application which loads this assembly."),
23 - }
24 - ),
25 - };
26 -
27 - public override IEnumerable<TableDefinition> TableDefinitions { get => Tables; }
11 + public override IEnumerable<TableDefinition> TableDefinitions => NetfxTableDefinitions.All;
12 }
13 }
src/wixlib/netfx.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-0082\build\WixToolset.MSBuild.props" Condition="Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0082\build\WixToolset.MSBuild.props')" />
4 + <Import Project="..\..\packages\WixToolset.MSBuild.4.0.0-build-0083\build\WixToolset.MSBuild.props" Condition="Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0083\build\WixToolset.MSBuild.props')" />
5 <Import Project="..\FindLocalWix.props" />
6 <PropertyGroup>
7 <ProjectGuid>{45e4a6ac-3190-4e17-83f0-9935ffa5dc2b}</ProjectGuid>
@@ -45,7 +45,7 @@
45 <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>
46 </PropertyGroup>
47 <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'))" />
48 - <Error Condition="!Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0082\build\WixToolset.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.MSBuild.4.0.0-build-0082\build\WixToolset.MSBuild.props'))" />
48 + <Error Condition="!Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0083\build\WixToolset.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.MSBuild.4.0.0-build-0083\build\WixToolset.MSBuild.props'))" />
49 <Error Condition="!Exists('..\..\packages\WixToolset.Util.wixext.4.0.27\build\WixToolset.Util.wixext.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.Util.wixext.4.0.27\build\WixToolset.Util.wixext.targets'))" />
50 </Target>
51 <Import Project="..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" />
src/wixlib/packages.config
+1 -1
@@ -1,6 +1,6 @@
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-0082" developmentDependency="true" targetFramework="net40" />
4 + <package id="WixToolset.MSBuild" version="4.0.0-build-0083" developmentDependency="true" targetFramework="net40" />
5 <package id="WixToolset.Util.wixext" version="4.0.27" targetFramework="net40" />
6 </packages>
\ No newline at end of file