Add per-platform custom action support.

This commit is contained in:
Bob Arnson 2020-07-04 18:59:34 -04:00
Родитель 4e1ad5e7a2
Коммит 6d17a027ff
11 изменённых файлов: 109 добавлений и 70 удалений

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2016
# Visual Studio Version 16
VisualStudioVersion = 16.0.30204.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dependencyca", "src\ca\dependencyca.vcxproj", "{B86AF46C-0F90-49CC-923F-A800B088D015}"
EndProject

Просмотреть файл

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props')" />
<Import Project="..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props" Condition="Exists('..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@ -14,43 +12,60 @@
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B86AF46C-0F90-49CC-923F-A800B088D015}</ProjectGuid>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<TargetName>dependencyca</TargetName>
<ProjectModuleDefinitionFile>wixdepca.def</ProjectModuleDefinitionFile>
<Description>WiX Toolset Dependency CustomAction</Description>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<ProjectAdditionalLinkLibraries>msi.lib</ProjectAdditionalLinkLibraries>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="wixdepca.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="precomp.h" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="wixdepca.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<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 @@
<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'))" />
<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'))" />
</Target>
</Project>
</Project>

Просмотреть файл

@ -31,5 +31,6 @@
<None Include="wixdepca.def">
<Filter>Source Files</Filter>
</None>
<None Include="packages.config" />
</ItemGroup>
</Project>

Просмотреть файл

@ -362,17 +362,7 @@ namespace WixToolset.Dependency
if (PackageType.None == packageType)
{
// Reference the Check custom action to check for dependencies on the current provider.
if (Platform.ARM == this.Context.Platform)
{
// Ensure the ARM version of the CA is referenced.
this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck_ARM");
}
else
{
// All other supported platforms use x86.
this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck");
}
this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyCheck", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64);
// Generate registry rows for the provider using binder properties.
var keyProvides = String.Concat(DependencyCommon.RegistryRoot, key);
@ -578,16 +568,7 @@ namespace WixToolset.Dependency
private void AddReferenceToWixDependencyRequire(IntermediateSection section, SourceLineNumber sourceLineNumbers)
{
if (Platform.ARM == this.Context.Platform)
{
// Ensure the ARM version of the CA is referenced.
this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM");
}
else
{
// All other supported platforms use x86.
this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire");
}
this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyRequire", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64);
}
}
}

Просмотреть файл

@ -3,23 +3,26 @@
<Include xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?include caSuffix.wxi ?>
<?include caDecor.wxi ?>
<Fragment>
<CustomAction Id="WixDependencyRequire$(var.Suffix)" BinaryKey="DependencyCA$(var.Suffix)" DllEntry="WixDependencyRequire" Execute="immediate" Return="check" SuppressModularization="yes"/>
<CustomAction Id="$(var.Prefix)DependencyRequire$(var.Suffix)" BinaryKey="DependencyCA$(var.Suffix)" DllEntry="WixDependencyRequire" Execute="immediate" Return="check" SuppressModularization="yes"/>
<InstallExecuteSequence>
<Custom Action="WixDependencyRequire$(var.Suffix)" Before="WixDependencyCheck$(var.Suffix)" Overridable="yes"><![CDATA[NOT DISABLEDEPENDENCYCHECK]]></Custom>
<Custom Action="$(var.Prefix)DependencyRequire$(var.Suffix)" Before="WixDependencyCheck$(var.Suffix)" Overridable="yes"><![CDATA[NOT DISABLEDEPENDENCYCHECK]]></Custom>
</InstallExecuteSequence>
<UIRef Id="WixDependencyErrors"/>
<PropertyRef Id="DISABLEDEPENDENCYCHECK"/>
</Fragment>
<Fragment>
<CustomAction Id="WixDependencyCheck$(var.Suffix)" BinaryKey="DependencyCA$(var.Suffix)" DllEntry="WixDependencyCheck" Execute="immediate" Return="check" SuppressModularization="yes"/>
<CustomAction Id="$(var.Prefix)DependencyCheck$(var.Suffix)" BinaryKey="DependencyCA$(var.Suffix)" DllEntry="WixDependencyCheck" Execute="immediate" Return="check" SuppressModularization="yes"/>
<InstallExecuteSequence>
<Custom Action="WixDependencyCheck$(var.Suffix)" Before="InstallInitialize" Overridable="yes"><![CDATA[(REMOVE OR MsiPatchRemovalList) AND NOT (UPGRADINGPRODUCTCODE OR IGNOREDEPENDENCIES="ALL")]]></Custom>
<Custom Action="$(var.Prefix)DependencyCheck$(var.Suffix)" Before="InstallInitialize" Overridable="yes"><![CDATA[(REMOVE OR MsiPatchRemovalList) AND NOT (UPGRADINGPRODUCTCODE OR IGNOREDEPENDENCIES="ALL")]]></Custom>
</InstallExecuteSequence>
<UIRef Id="WixDependencyErrors"/>
<PropertyRef Id="IGNOREDEPENDENCIES"/>
</Fragment>
<Fragment>
<Binary Id="DependencyCA$(var.Suffix)" SourceFile="!(bindpath.$(var.platform))dependencyca.dll"/>
</Fragment>

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- 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. -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?define platform=arm ?>
<?include DependencyExtension_Platform.wxi ?>
</Wix>

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- 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. -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?define platform=arm64 ?>
<?include DependencyExtension_Platform.wxi ?>
</Wix>

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- 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. -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?define platform=x64 ?>
<?include DependencyExtension_Platform.wxi ?>
</Wix>

40
src/wixlib/caDecor.wxi Normal file
Просмотреть файл

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?ifdef Prefix ?>
<?undef Prefix ?>
<?endif ?>
<?define Prefix="Wix4" ?>
<?ifndef platform ?>
<?define platform="x86" ?>
<?endif ?>
<?if $(var.platform)="" ?>
<?undef platform ?>
<?define platform="x86" ?>
<?endif ?>
<?ifdef Suffix ?>
<?undef Suffix ?>
<?endif ?>
<?if $(var.platform)~="x86" ?>
<?define Suffix="_X86" ?>
<?endif ?>
<?if $(var.platform)~="x64" ?>
<?define Suffix="_X64" ?>
<?endif ?>
<?if $(var.platform)~="arm" ?>
<?define Suffix="_A32" ?>
<?endif ?>
<?if $(var.platform)~="arm64" ?>
<?define Suffix="_A64" ?>
<?endif ?>
</Include>

Просмотреть файл

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<Include xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?ifndef platform ?>
<?error Required value "platform" not defined in include caSuffix.wxi ?>
<?endif ?>
<?ifdef Suffix ?>
<?undef Suffix ?>
<?undef DeferredSuffix ?>
<?endif ?>
<?if $(var.platform)="x86" ?>
<?define Suffix="" ?>
<?define DeferredSuffix="" ?>
<?endif ?>
<?if $(var.platform)="x64" ?>
<?define Suffix="_x64" ?>
<?define DeferredSuffix="_64" ?>
<?endif ?>
<?if $(var.platform)="arm" ?>
<?define Suffix="_ARM" ?>
<?define DeferredSuffix="_ARM" ?>
<?endif ?>
</Include>

Просмотреть файл

@ -4,12 +4,15 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<BindFiles>true</BindFiles>
<!-- <SuppressSpecificWarnings>1086</SuppressSpecificWarnings> -->
<SuppressSpecificWarnings>1086</SuppressSpecificWarnings>
<Cultures>en-us</Cultures>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ca\dependencyca.vcxproj" />
<ProjectReference Include="..\ca\dependencyca.vcxproj" Properties="Platform=ARM" />
<ProjectReference Include="..\ca\dependencyca.vcxproj" Properties="Platform=ARM64" />
<ProjectReference Include="..\ca\dependencyca.vcxproj" Properties="Platform=x86" />
<ProjectReference Include="..\ca\dependencyca.vcxproj" Properties="Platform=x64" />
</ItemGroup>
<ItemGroup>