@joebigelow / wix / commits / 6d17a027

Add per-platform custom action support.

Bob Arnson committed Jul 4, 2020 at 18:59 UTC 6d17a027ff6155ed50f78858cad17d1baef9856d
11 files changed +109 -70
Dependency.wixext.sln
+2 -2
@@ -1,7 +1,7 @@
1 
2 Microsoft Visual Studio Solution File, Format Version 12.00
3 -# Visual Studio 15
4 -VisualStudioVersion = 15.0.28010.2016
3 +# Visual Studio Version 16
4 +VisualStudioVersion = 16.0.30204.135
5 MinimumVisualStudioVersion = 10.0.40219.1
6 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dependencyca", "src\ca\dependencyca.vcxproj", "{B86AF46C-0F90-49CC-923F-A800B088D015}"
7 EndProject
src/ca/dependencyca.vcxproj
+27 -12
@@ -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">
4 <Import Project="..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props')" />
5 <Import Project="..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props" Condition="Exists('..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props')" />
7 -
6 <ItemGroup Label="ProjectConfigurations">
7 <ProjectConfiguration Include="Debug|Win32">
8 <Configuration>Debug</Configuration>
@@ -14,43 +12,60 @@
12 <Configuration>Release</Configuration>
13 <Platform>Win32</Platform>
14 </ProjectConfiguration>
15 + <ProjectConfiguration Include="Debug|x64">
16 + <Configuration>Debug</Configuration>
17 + <Platform>x64</Platform>
18 + </ProjectConfiguration>
19 + <ProjectConfiguration Include="Release|x64">
20 + <Configuration>Release</Configuration>
21 + <Platform>x64</Platform>
22 + </ProjectConfiguration>
23 + <ProjectConfiguration Include="Debug|ARM">
24 + <Configuration>Debug</Configuration>
25 + <Platform>ARM</Platform>
26 + </ProjectConfiguration>
27 + <ProjectConfiguration Include="Release|ARM">
28 + <Configuration>Release</Configuration>
29 + <Platform>ARM</Platform>
30 + </ProjectConfiguration>
31 + <ProjectConfiguration Include="Debug|ARM64">
32 + <Configuration>Debug</Configuration>
33 + <Platform>ARM64</Platform>
34 + </ProjectConfiguration>
35 + <ProjectConfiguration Include="Release|ARM64">
36 + <Configuration>Release</Configuration>
37 + <Platform>ARM64</Platform>
38 + </ProjectConfiguration>
39 </ItemGroup>
18 -
40 <PropertyGroup Label="Globals">
41 <ProjectGuid>{B86AF46C-0F90-49CC-923F-A800B088D015}</ProjectGuid>
42 <ConfigurationType>DynamicLibrary</ConfigurationType>
22 - <PlatformToolset>v141</PlatformToolset>
43 + <PlatformToolset>v142</PlatformToolset>
44 <CharacterSet>Unicode</CharacterSet>
45 <TargetName>dependencyca</TargetName>
46 <ProjectModuleDefinitionFile>wixdepca.def</ProjectModuleDefinitionFile>
47 <Description>WiX Toolset Dependency CustomAction</Description>
48 + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
49 </PropertyGroup>
28 -
50 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
51 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31 -
52 <PropertyGroup>
53 <ProjectAdditionalLinkLibraries>msi.lib</ProjectAdditionalLinkLibraries>
54 </PropertyGroup>
35 -
55 <ItemGroup>
56 <ClCompile Include="dllmain.cpp">
57 <PrecompiledHeader>Create</PrecompiledHeader>
58 </ClCompile>
59 <ClCompile Include="wixdepca.cpp" />
60 </ItemGroup>
42 -
61 <ItemGroup>
62 <ClInclude Include="precomp.h" />
63 </ItemGroup>
46 -
64 <ItemGroup>
65 <None Include="packages.config" />
66 <None Include="wixdepca.def" />
67 </ItemGroup>
51 -
68 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
53 -
69 <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
70 <PropertyGroup>
71 <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>
@@ -58,4 +73,4 @@
73 <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props'))" />
74 <Error Condition="!Exists('..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props'))" />
75 </Target>
61 -</Project>
76 +</Project>
\ No newline at end of file
src/ca/dependencyca.vcxproj.filters
+1
@@ -31,5 +31,6 @@
31 <None Include="wixdepca.def">
32 <Filter>Source Files</Filter>
33 </None>
34 + <None Include="packages.config" />
35 </ItemGroup>
36 </Project>
\ No newline at end of file
src/wixext/DependencyCompiler.cs
+2 -21
@@ -362,17 +362,7 @@ namespace WixToolset.Dependency
362
363 if (PackageType.None == packageType)
364 {
365 - // Reference the Check custom action to check for dependencies on the current provider.
366 - if (Platform.ARM == this.Context.Platform)
367 - {
368 - // Ensure the ARM version of the CA is referenced.
369 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck_ARM");
370 - }
371 - else
372 - {
373 - // All other supported platforms use x86.
374 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck");
375 - }
365 + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyCheck", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64);
366
367 // Generate registry rows for the provider using binder properties.
368 var keyProvides = String.Concat(DependencyCommon.RegistryRoot, key);
@@ -578,16 +568,7 @@ namespace WixToolset.Dependency
568
569 private void AddReferenceToWixDependencyRequire(IntermediateSection section, SourceLineNumber sourceLineNumbers)
570 {
581 - if (Platform.ARM == this.Context.Platform)
582 - {
583 - // Ensure the ARM version of the CA is referenced.
584 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM");
585 - }
586 - else
587 - {
588 - // All other supported platforms use x86.
589 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire");
590 - }
571 + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyRequire", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64);
572 }
573 }
574 }
src/wixlib/DependencyExtension_Platform.wxi
+8 -5
@@ -3,23 +3,26 @@
3
4
5 <Include xmlns="http://wixtoolset.org/schemas/v4/wxs">
6 - <?include caSuffix.wxi ?>
6 + <?include caDecor.wxi ?>
7 +
8 <Fragment>
8 - <CustomAction Id="WixDependencyRequire$(var.Suffix)" BinaryKey="DependencyCA$(var.Suffix)" DllEntry="WixDependencyRequire" Execute="immediate" Return="check" SuppressModularization="yes"/>
9 + <CustomAction Id="$(var.Prefix)DependencyRequire$(var.Suffix)" BinaryKey="DependencyCA$(var.Suffix)" DllEntry="WixDependencyRequire" Execute="immediate" Return="check" SuppressModularization="yes"/>
10 <InstallExecuteSequence>
10 - <Custom Action="WixDependencyRequire$(var.Suffix)" Before="WixDependencyCheck$(var.Suffix)" Overridable="yes"><![CDATA[NOT DISABLEDEPENDENCYCHECK]]></Custom>
11 + <Custom Action="$(var.Prefix)DependencyRequire$(var.Suffix)" Before="WixDependencyCheck$(var.Suffix)" Overridable="yes"><![CDATA[NOT DISABLEDEPENDENCYCHECK]]></Custom>
12 </InstallExecuteSequence>
13 <UIRef Id="WixDependencyErrors"/>
14 <PropertyRef Id="DISABLEDEPENDENCYCHECK"/>
15 </Fragment>
16 +
17 <Fragment>
16 - <CustomAction Id="WixDependencyCheck$(var.Suffix)" BinaryKey="DependencyCA$(var.Suffix)" DllEntry="WixDependencyCheck" Execute="immediate" Return="check" SuppressModularization="yes"/>
18 + <CustomAction Id="$(var.Prefix)DependencyCheck$(var.Suffix)" BinaryKey="DependencyCA$(var.Suffix)" DllEntry="WixDependencyCheck" Execute="immediate" Return="check" SuppressModularization="yes"/>
19 <InstallExecuteSequence>
18 - <Custom Action="WixDependencyCheck$(var.Suffix)" Before="InstallInitialize" Overridable="yes"><![CDATA[(REMOVE OR MsiPatchRemovalList) AND NOT (UPGRADINGPRODUCTCODE OR IGNOREDEPENDENCIES="ALL")]]></Custom>
20 + <Custom Action="$(var.Prefix)DependencyCheck$(var.Suffix)" Before="InstallInitialize" Overridable="yes"><![CDATA[(REMOVE OR MsiPatchRemovalList) AND NOT (UPGRADINGPRODUCTCODE OR IGNOREDEPENDENCIES="ALL")]]></Custom>
21 </InstallExecuteSequence>
22 <UIRef Id="WixDependencyErrors"/>
23 <PropertyRef Id="IGNOREDEPENDENCIES"/>
24 </Fragment>
25 +
26 <Fragment>
27 <Binary Id="DependencyCA$(var.Suffix)" SourceFile="!(bindpath.$(var.platform))dependencyca.dll"/>
28 </Fragment>
src/wixlib/DependencyExtension_arm.wxs new
+8
@@ -0,0 +1,8 @@
1 +<?xml version="1.0"?>
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 +
4 +
5 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
6 + <?define platform=arm ?>
7 + <?include DependencyExtension_Platform.wxi ?>
8 +</Wix>
src/wixlib/DependencyExtension_arm64.wxs new
+8
@@ -0,0 +1,8 @@
1 +<?xml version="1.0"?>
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 +
4 +
5 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
6 + <?define platform=arm64 ?>
7 + <?include DependencyExtension_Platform.wxi ?>
8 +</Wix>
src/wixlib/DependencyExtension_x64.wxs new
+8
@@ -0,0 +1,8 @@
1 +<?xml version="1.0"?>
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 +
4 +
5 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
6 + <?define platform=x64 ?>
7 + <?include DependencyExtension_Platform.wxi ?>
8 +</Wix>
src/wixlib/caDecor.wxi new
+40
@@ -0,0 +1,40 @@
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 +
4 +
5 +<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">
6 + <?ifdef Prefix ?>
7 + <?undef Prefix ?>
8 + <?endif ?>
9 +
10 + <?define Prefix="Wix4" ?>
11 +
12 + <?ifndef platform ?>
13 + <?define platform="x86" ?>
14 + <?endif ?>
15 +
16 + <?if $(var.platform)="" ?>
17 + <?undef platform ?>
18 + <?define platform="x86" ?>
19 + <?endif ?>
20 +
21 + <?ifdef Suffix ?>
22 + <?undef Suffix ?>
23 + <?endif ?>
24 +
25 + <?if $(var.platform)~="x86" ?>
26 + <?define Suffix="_X86" ?>
27 + <?endif ?>
28 +
29 + <?if $(var.platform)~="x64" ?>
30 + <?define Suffix="_X64" ?>
31 + <?endif ?>
32 +
33 + <?if $(var.platform)~="arm" ?>
34 + <?define Suffix="_A32" ?>
35 + <?endif ?>
36 +
37 + <?if $(var.platform)~="arm64" ?>
38 + <?define Suffix="_A64" ?>
39 + <?endif ?>
40 +</Include>
src/wixlib/caSuffix.wxi deleted
-28
@@ -1,28 +0,0 @@
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 -
4 -<Include xmlns="http://wixtoolset.org/schemas/v4/wxs">
5 - <?ifndef platform ?>
6 - <?error Required value "platform" not defined in include caSuffix.wxi ?>
7 - <?endif ?>
8 -
9 - <?ifdef Suffix ?>
10 - <?undef Suffix ?>
11 - <?undef DeferredSuffix ?>
12 - <?endif ?>
13 -
14 - <?if $(var.platform)="x86" ?>
15 - <?define Suffix="" ?>
16 - <?define DeferredSuffix="" ?>
17 - <?endif ?>
18 -
19 - <?if $(var.platform)="x64" ?>
20 - <?define Suffix="_x64" ?>
21 - <?define DeferredSuffix="_64" ?>
22 - <?endif ?>
23 -
24 - <?if $(var.platform)="arm" ?>
25 - <?define Suffix="_ARM" ?>
26 - <?define DeferredSuffix="_ARM" ?>
27 - <?endif ?>
28 -</Include>
src/wixlib/dependency.wixproj
+5 -2
@@ -4,12 +4,15 @@
4 <PropertyGroup>
5 <OutputType>Library</OutputType>
6 <BindFiles>true</BindFiles>
7 - <!-- <SuppressSpecificWarnings>1086</SuppressSpecificWarnings> -->
7 + <SuppressSpecificWarnings>1086</SuppressSpecificWarnings>
8 <Cultures>en-us</Cultures>
9 </PropertyGroup>
10
11 <ItemGroup>
12 - <ProjectReference Include="..\ca\dependencyca.vcxproj" />
12 + <ProjectReference Include="..\ca\dependencyca.vcxproj" Properties="Platform=ARM" />
13 + <ProjectReference Include="..\ca\dependencyca.vcxproj" Properties="Platform=ARM64" />
14 + <ProjectReference Include="..\ca\dependencyca.vcxproj" Properties="Platform=x86" />
15 + <ProjectReference Include="..\ca\dependencyca.vcxproj" Properties="Platform=x64" />
16 </ItemGroup>
17
18 <ItemGroup>