From c134594328bd63fb19b88239694523f04108030e Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 6 Jul 2020 12:34:48 -0400 Subject: Add per-platform custom action support. --- Sql.wixext.sln | 5 +++-- src/ca/caDecor.h | 13 +++++++++++++ src/ca/precomp.h | 2 ++ src/ca/scadb.cpp | 6 +++--- src/ca/scasqlstr.cpp | 4 ++-- src/ca/sqlca.vcxproj | 26 ++++++++++++++++++++++++- src/wixext/SqlCompiler.cs | 5 +++-- src/wixlib/SqlExtension.wxi | 36 +++++++++++++++++++++++++++++++++++ src/wixlib/SqlExtension.wxs | 29 ---------------------------- src/wixlib/SqlExtension_arm.wxs | 8 ++++++++ src/wixlib/SqlExtension_arm64.wxs | 8 ++++++++ src/wixlib/SqlExtension_x64.wxs | 8 ++++++++ src/wixlib/SqlExtension_x86.wxs | 8 ++++++++ src/wixlib/caDecor.wxi | 40 +++++++++++++++++++++++++++++++++++++++ src/wixlib/sql.wixproj | 13 +++++++------ 15 files changed, 166 insertions(+), 45 deletions(-) create mode 100644 src/ca/caDecor.h create mode 100644 src/wixlib/SqlExtension.wxi create mode 100644 src/wixlib/SqlExtension_arm.wxs create mode 100644 src/wixlib/SqlExtension_arm64.wxs create mode 100644 src/wixlib/SqlExtension_x64.wxs create mode 100644 src/wixlib/SqlExtension_x86.wxs create mode 100644 src/wixlib/caDecor.wxi diff --git a/Sql.wixext.sln b/Sql.wixext.sln index f033987f..cfa9ad4f 100644 --- a/Sql.wixext.sln +++ b/Sql.wixext.sln @@ -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}") = "sqlca", "src\ca\sqlca.vcxproj", "{4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}" EndProject @@ -20,6 +20,7 @@ Global EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Debug|Any CPU.Build.0 = Debug|Win32 {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Debug|x86.ActiveCfg = Debug|Win32 {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Debug|x86.Build.0 = Debug|Win32 {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Release|Any CPU.ActiveCfg = Release|Win32 diff --git a/src/ca/caDecor.h b/src/ca/caDecor.h new file mode 100644 index 00000000..da274650 --- /dev/null +++ b/src/ca/caDecor.h @@ -0,0 +1,13 @@ +#pragma once +// 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. + + +#if defined(_M_ARM64) +#define CUSTOM_ACTION_DECORATION(f) L"Wix4" f L"_A64" +#elif defined(_M_AMD64) +#define CUSTOM_ACTION_DECORATION(f) L"Wix4" f L"_X64" +#elif defined(_M_ARM) +#define CUSTOM_ACTION_DECORATION(f) L"Wix4" f L"_ARM" +#else +#define CUSTOM_ACTION_DECORATION(f) L"Wix4" f L"_X86" +#endif diff --git a/src/ca/precomp.h b/src/ca/precomp.h index 08454d3a..266d543c 100644 --- a/src/ca/precomp.h +++ b/src/ca/precomp.h @@ -24,3 +24,5 @@ #include "sca.h" #include "scacost.h" #include "scasqlstr.h" + +#include "caDecor.h" diff --git a/src/ca/scadb.cpp b/src/ca/scadb.cpp index 9f9efca2..68f7b10b 100644 --- a/src/ca/scadb.cpp +++ b/src/ca/scadb.cpp @@ -385,7 +385,7 @@ static HRESULT SchedCreateDatabase( hr = SqlDatabaseExists(psd->wzServer, psd->wzInstance, psd->wzDatabase, psd->fUseIntegratedAuth, psd->scau.wzName, psd->scau.wzPassword, NULL); if (S_FALSE == hr) { - hr = WcaDoDeferredAction(L"RollbackCreateDatabase", pwzCustomActionData, COST_SQL_CREATEDB); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackCreateDatabase"), pwzCustomActionData, COST_SQL_CREATEDB); ExitOnFailure(hr, "Failed to schedule RollbackCreateDatabase action"); } @@ -444,7 +444,7 @@ static HRESULT SchedCreateDatabase( } // schedule the CreateDatabase action - hr = WcaDoDeferredAction(L"CreateDatabase", pwzCustomActionData, COST_SQL_CREATEDB); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"CreateDatabase"), pwzCustomActionData, COST_SQL_CREATEDB); ExitOnFailure(hr, "Failed to schedule CreateDatabase action"); LExit: @@ -491,7 +491,7 @@ HRESULT SchedDropDatabase( hr = WcaWriteStringToCaData(wzPassword, &pwzCustomActionData); ExitOnFailure(hr, "Failed to add user password to CustomActionData"); - hr = WcaDoDeferredAction(L"DropDatabase", pwzCustomActionData, COST_SQL_DROPDB); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"DropDatabase"), pwzCustomActionData, COST_SQL_DROPDB); ExitOnFailure(hr, "Failed to schedule DropDatabase action"); LExit: diff --git a/src/ca/scasqlstr.cpp b/src/ca/scasqlstr.cpp index 3108e307..6ac526a6 100644 --- a/src/ca/scasqlstr.cpp +++ b/src/ca/scasqlstr.cpp @@ -654,7 +654,7 @@ static HRESULT ExecuteStrings( { Assert(pwzCustomActionData && *pwzCustomActionData && uiCost); - hr = WcaDoDeferredAction(1 == iOldRollback ? L"RollbackExecuteSqlStrings" : L"ExecuteSqlStrings", pwzCustomActionData, uiCost); + hr = WcaDoDeferredAction(1 == iOldRollback ? CUSTOM_ACTION_DECORATION(L"RollbackExecuteSqlStrings") : CUSTOM_ACTION_DECORATION(L"ExecuteSqlStrings"), pwzCustomActionData, uiCost); ExitOnFailure(hr, "failed to schedule ExecuteSqlStrings action, rollback: %d", iOldRollback); iOldRollback = iRollback; @@ -714,7 +714,7 @@ static HRESULT ExecuteStrings( if (pwzCustomActionData && *pwzCustomActionData) { Assert(pwzCustomActionData && *pwzCustomActionData && uiCost); - hr = WcaDoDeferredAction(1 == iRollback ? L"RollbackExecuteSqlStrings" : L"ExecuteSqlStrings", pwzCustomActionData, uiCost); + hr = WcaDoDeferredAction(1 == iRollback ? CUSTOM_ACTION_DECORATION(L"RollbackExecuteSqlStrings") : CUSTOM_ACTION_DECORATION(L"ExecuteSqlStrings"), pwzCustomActionData, uiCost); ExitOnFailure(hr, "Failed to schedule ExecuteSqlStrings action"); *pwzCustomActionData = L'\0'; diff --git a/src/ca/sqlca.vcxproj b/src/ca/sqlca.vcxproj index 3c8c1a6c..e1c5beea 100644 --- a/src/ca/sqlca.vcxproj +++ b/src/ca/sqlca.vcxproj @@ -14,13 +14,37 @@ Release Win32 + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935} DynamicLibrary sqlca - v141 + v142 Unicode sqlca.def WiX Toolset Sql CustomAction diff --git a/src/wixext/SqlCompiler.cs b/src/wixext/SqlCompiler.cs index 2c0f914a..bbcdc87d 100644 --- a/src/wixext/SqlCompiler.cs +++ b/src/wixext/SqlCompiler.cs @@ -7,6 +7,7 @@ namespace WixToolset.Sql using System.Xml.Linq; using WixToolset.Data; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Sql.Symbols; /// @@ -797,8 +798,8 @@ namespace WixToolset.Sql private void AddReferenceToInstallSqlData(IntermediateSection section, SourceLineNumber sourceLineNumbers) { - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.CustomAction, "InstallSqlData"); - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.CustomAction, "UninstallSqlData"); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "InstallSqlData", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "UninstallSqlData", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64); } } } diff --git a/src/wixlib/SqlExtension.wxi b/src/wixlib/SqlExtension.wxi new file mode 100644 index 00000000..43b91fba --- /dev/null +++ b/src/wixlib/SqlExtension.wxi @@ -0,0 +1,36 @@ + + + + + + + + + !(loc.ConfigureSql) + !(loc.ConfigureSql) + !(loc.CreateDatabase) + !(loc.DropDatabase) + !(loc.ExecuteSqlStrings) + !(loc.RollbackExecuteSqlStrings) + + + + + + + + + + + + + NOT SKIPUNINSTALLSQLDATA AND VersionNT > 400 + NOT SKIPINSTALLSQLDATA AND VersionNT > 400 + + + + + + + + diff --git a/src/wixlib/SqlExtension.wxs b/src/wixlib/SqlExtension.wxs index 6e08b7fa..00a6edcb 100644 --- a/src/wixlib/SqlExtension.wxs +++ b/src/wixlib/SqlExtension.wxs @@ -1,12 +1,9 @@ - - - !(loc.msierrSQLFailedCreateDatabase) @@ -14,32 +11,6 @@ !(loc.msierrSQLFailedConnectDatabase) !(loc.msierrSQLFailedExecString) !(loc.msierrSQLDatabaseAlreadyExists) - - !(loc.ConfigureSql) - !(loc.ConfigureSql) - !(loc.CreateDatabase) - !(loc.DropDatabase) - !(loc.ExecuteSqlStrings) - !(loc.RollbackExecuteSqlStrings) - - - - - - - - - - - - NOT SKIPUNINSTALLSQLDATA AND VersionNT > 400 - NOT SKIPINSTALLSQLDATA AND VersionNT > 400 - - - - - - diff --git a/src/wixlib/SqlExtension_arm.wxs b/src/wixlib/SqlExtension_arm.wxs new file mode 100644 index 00000000..b5f903f6 --- /dev/null +++ b/src/wixlib/SqlExtension_arm.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/SqlExtension_arm64.wxs b/src/wixlib/SqlExtension_arm64.wxs new file mode 100644 index 00000000..08394685 --- /dev/null +++ b/src/wixlib/SqlExtension_arm64.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/SqlExtension_x64.wxs b/src/wixlib/SqlExtension_x64.wxs new file mode 100644 index 00000000..d7ba8e46 --- /dev/null +++ b/src/wixlib/SqlExtension_x64.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/SqlExtension_x86.wxs b/src/wixlib/SqlExtension_x86.wxs new file mode 100644 index 00000000..70aae67c --- /dev/null +++ b/src/wixlib/SqlExtension_x86.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/caDecor.wxi b/src/wixlib/caDecor.wxi new file mode 100644 index 00000000..1d00df8f --- /dev/null +++ b/src/wixlib/caDecor.wxi @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixlib/sql.wixproj b/src/wixlib/sql.wixproj index b4a37d6c..96673563 100644 --- a/src/wixlib/sql.wixproj +++ b/src/wixlib/sql.wixproj @@ -1,18 +1,19 @@ - Library true en-us - + - + + + + - + - - + \ No newline at end of file -- cgit v1.2.3-55-g6feb