forked from microsoft/WindowsAppSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DeploymentManager auto-initializer (microsoft#2835)
* 40724739: DeploymentManagerAutoInitializer. Added auto-initializer, inspired by Bootstrapper's auto-initializer. Split test\Deployment into subdirs. Working through build-isms Add an auto-initializer for DeploymentManager (very similar to the Bootstrapper's auto-initializer). If DeploymentManager Initialize fails... ...Write to the eventlog ...Optionally * DebugBreak * DebugBreak if a debugger is attached to the process * FailFast * MessageBox (modeled after .NET's) asking if you'd like to install the WindowsAppRuntime and if so, ShellExecute(url) to the download page The optional behavior is triggered by new `DeploymentInitializeOptions` properties or by environment variables ``` SET MICROSOFT_WINDOWSAPPRUNTIME_DEPLOYMENTMANAGER_INITIALIZE_DEBUGBREAK=1 SET MICROSOFT_WINDOWSAPPRUNTIME_DEPLOYMENTMANAGER_INITIALIZE_SHOWUI=1 SET MICROSOFT_WINDOWSAPPRUNTIME_DEPLOYMENTMANAGER_INITIALIZE_FAILFAST=1 ``` Testing partial but incomplete as I need a real build (franken-hacking has been too messy to finish E2E testing). The DeploymentManager auto-initializer is inert/unused unless WindowsAppSdkDeploymentManagerInitialize=true and the default to enable that is commented out for now, making this PR functional but inert so I can get a build turned with real packages for further testing. *.targets updated to provide build-time control. * **To disable the auto-initializer** the auto-initialize set the property `WindowsAppSDKDeploymentManagerAutoInitialize`=`false` * **If the auto-initalizer is enabled** you can define properties to control the options passed via `DeploymentInitializeOptions` to `DeploymentManager.Initialize()` * **WindowsAppSDKDeploymentManagerAutoInitializeOptions_Default=true** -- use the default options (OnError_ShowUI) * **WindowsAppSDKDeploymentManagerAutoInitializeOptions_None=true** -- use no options (None) * **WindowsAppSDKDeploymentManagerAutoInitializeOptions_*=true** -- enable the option where * is one or more of the following * OnError_DebugBreak * OnError_DebugBreak_IfDebuggerAttached * OnError_FailFast * OnError_ShowUI * OnNoPackageIdentity_NoOp For example, to disable the auto-initializer add to your *proj file: ```xml <PropertyGroup> <WindowsAppSDKDeploymentManagerAutoInitialize>false</WindowsAppSDKDeploymentManagerAutoInitialize> </PropertyGroup> ``` or to enable the auto-initializer (default) but use the DebugBreak+FailFast options (instead of the default) ```xml <PropertyGroup> <WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_DebugBreak>true</WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_DebugBreak> <WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_ShowUI>true</WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_ShowUI> </PropertyGroup> ``` https://task.ms/40724739 * Added VerifyCopyrightHeaders.cmd and tweaked error message about it
- Loading branch information
1 parent
5372c81
commit 344d07b
Showing
54 changed files
with
1,722 additions
and
51 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
build/NuSpecs/Microsoft.WindowsAppSDK.DeploymentManager.CS.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<PropertyGroup> | ||
<DefineConstants Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_Default)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_DEFAULT</DefineConstants> | ||
<DefineConstants Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_None)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_NONE</DefineConstants> | ||
<DefineConstants Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_DebugBreak)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK</DefineConstants> | ||
<DefineConstants Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_DebugBreak_IfDebuggerAttached)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK_IFDEBUGGERATTACHED</DefineConstants> | ||
<DefineConstants Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_FailFast)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERROR_FAILFAST</DefineConstants> | ||
<DefineConstants Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnNoMatch_ShowUI)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONNOMATCH_SHOWUI</DefineConstants> | ||
<DefineConstants Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnPackageIdentity_NoOp)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONPACKAGEIDENTITY_NOOP</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<Target Name="GenerateDeploymentManagerCS" BeforeTargets="BeforeCompile"> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildThisFileDirectory)..\include\DeploymentManagerAutoInitializer.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)..\include\WindowsAppSDK-VersionInfo.cs" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> |
21 changes: 21 additions & 0 deletions
21
build/NuSpecs/Microsoft.WindowsAppSDK.DeploymentManagerCommon.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<!-- Targets file common to both managed and native projects --> | ||
|
||
<PropertyGroup Condition="'$(WindowsAppSdkDeploymentManagerInitialize)'=='' and '$(WindowsAppSDKSelfContained)'!='true' and '$(WindowsPackageType)'=='None' and ('$(OutputType)'=='Exe' or '$(OutputType)'=='Winexe')"> | ||
<!--Allows GenerateDeploymentManagerCS/GenerateDeploymentManagerCpp to run--> | ||
<!-- | ||
TODO Uncomment when ready to enable default | ||
Franken-builds giving weird results after way too much manual hackery | ||
so can't get a reliable read on if it's good or what's wrong. Enable | ||
it all but inert unless explicitly requested (which no one does today) | ||
to have viable packages for testing. | ||
<WindowsAppSdkDeploymentManagerInitialize>true</WindowsAppSdkDeploymentManagerInitialize> | ||
--> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(WindowsAppSdkDeploymentManagerInitialize)'== 'true'"> | ||
<PublishAppxPackage>false</PublishAppxPackage> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
build/NuSpecs/WindowsAppSDK-Nuget-Native.DeploymentManager.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<Target Name="GenerateDeploymentManagerCpp" BeforeTargets="ClCompile"> | ||
<ItemGroup> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\include\DeploymentManagerAutoInitializer.cpp"> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
<PreprocessorDefinitions Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_Default)'=='true'">MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_DEFAULT;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PreprocessorDefinitions Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_None)'=='true'">MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_NONE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PreprocessorDefinitions Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_DebugBreak)'=='true'">MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PreprocessorDefinitions Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_DebugBreak_IfDebuggerAttached)'=='true'">MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK_IFDEBUGGERATTACHED;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PreprocessorDefinitions Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_FailFast)'=='true'">MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERROR_FAILFAST;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PreprocessorDefinitions Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnNoMatch_ShowUI)'=='true'">MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONNOMATCH_SHOWUI;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PreprocessorDefinitions Condition="'$(WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnPackageIdentity_NoOp)'=='true'">MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONPACKAGEIDENTITY_NOOP;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
#ifndef __MICROSOFT_CONFIGURATION_H | ||
#define __MICROSOFT_CONFIGURATION_H | ||
|
||
namespace Microsoft::Configuration | ||
{ | ||
inline bool IsOptionEnabled(PCWSTR name) | ||
{ | ||
WCHAR value[1 + 1]{}; | ||
if (::GetEnvironmentVariableW(name, value, ARRAYSIZE(value)) == 1) | ||
{ | ||
if (*value == L'0') | ||
{ | ||
return false; | ||
} | ||
else if (*value == L'1') | ||
{ | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} | ||
|
||
#endif // __MICROSOFT_CONFIGURATION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.