Skip to content

Commit

Permalink
Add DeploymentRepairOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Santosh Chintalapati committed Sep 28, 2022
1 parent 5124606 commit 38cacca
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/NuSpecs/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManager" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentResult" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentInitializeOptions" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentRepairOptions" ThreadingModel="both" />

<!-- VersionInfo -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.ReleaseInfo" ThreadingModel="both" />
Expand Down
24 changes: 24 additions & 0 deletions dev/Deployment/Deployment.idl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
PackageInstallFailed,

[contract(DeploymentContract, 3)]
PackageRepairRequired,
PackageRepairFailed,
};

Expand Down Expand Up @@ -49,6 +50,22 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
Boolean OnErrorShowUI;
};

/// This object is used to specify deployment options to apply when using DeploymentManager's
/// Repair method
[contract(DeploymentContract, 3)]
runtimeclass DeploymentRepairOptions
{
DeploymentRepairOptions();

/// Gets or sets a value that indicates whether the processes associated with the
/// WinAppSDK Main and Singleton packages will be shut down forcibly if they are
/// currently in use, when repairing the WindowsAppRuntime.
Boolean ForceDeployment;

/// If not successful show UI
Boolean OnErrorShowUI;
};

/// Used to query deployment information for WindowsAppRuntime
[contract(DeploymentContract, 1)]
static runtimeclass DeploymentManager
Expand All @@ -72,5 +89,12 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
/// repair already installed WinAppSDK packages.
[contract(DeploymentContract, 3)]
static DeploymentResult Repair();

/// Checks the status of the WindowsAppRuntime of the current package and attempts to
/// repair already installed WinAppSDK packages, while applying the DeploymentRepairOptions
/// passed in.
[contract(DeploymentContract, 3)]
[overload("Repair")]
static DeploymentResult Repair(Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentRepairOptions deploymentRepairOptions);
};
}
2 changes: 2 additions & 0 deletions dev/Deployment/Deployment.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<Midl Include="$(MSBuildThisFileDirectory)Deployment.idl" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(MSBuildThisFileDirectory)DeploymentRepairOptions.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)DeploymentTraceLogging.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)DeploymentInitializeOptions.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)DeploymentManager.h" />
Expand All @@ -29,6 +30,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)PackageDefinitions.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)DeploymentRepairOptions.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)DeploymentTraceLogging.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)DeploymentInitializeOptions.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)DeploymentManager.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions dev/Deployment/DeploymentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem
return Initialize(GetCurrentFrameworkPackageFullName(), options, true);
}

winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::DeploymentResult DeploymentManager::Repair(
winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::DeploymentRepairOptions const& deploymentRepairOptions)
{
return Initialize(GetCurrentFrameworkPackageFullName(), options, true);
}

winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::DeploymentResult DeploymentManager::GetStatus(hstring const& packageFullName)
{
// Get PackageInfo for WinAppSDK framework package
Expand Down
1 change: 1 addition & 0 deletions dev/Deployment/DeploymentManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem
static WindowsAppRuntime::DeploymentResult Initialize();
static WindowsAppRuntime::DeploymentResult Initialize(WindowsAppRuntime::DeploymentInitializeOptions const& deploymentInitializeOptions);
static WindowsAppRuntime::DeploymentResult Repair();
static WindowsAppRuntime::DeploymentResult Repair(WindowsAppRuntime::DeploymentRepairOptions const& deploymentRepairOptions);

private:
static WindowsAppRuntime::DeploymentResult GetStatus(hstring const& packageFullName);
Expand Down
25 changes: 25 additions & 0 deletions dev/Deployment/DeploymentRepairOptions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.
#include <pch.h>
#include <DeploymentRepairOptions.h>
#include <Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentRepairOptions.g.cpp>

namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implementation
{
bool DeploymentRepairOptions::ForceDeployment()
{
return m_ForceDeployment;
}
void DeploymentRepairOptions::ForceDeployment(bool value)
{
m_ForceDeployment = value;
}
bool DeploymentRepairOptions::OnErrorShowUI()
{
return m_OnErrorShowUI;
}
void DeploymentRepairOptions::OnErrorShowUI(bool value)
{
m_OnErrorShowUI = value;
}
}
29 changes: 29 additions & 0 deletions dev/Deployment/DeploymentRepairOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once

#include "Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentRepairOptions.g.h"

namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implementation
{
struct DeploymentRepairOptions : DeploymentRepairOptionsT<DeploymentRepairOptions>
{
DeploymentRepairOptions() = default;

bool ForceDeployment();
void ForceDeployment(bool value);
bool OnErrorShowUI();
void OnErrorShowUI(bool value);

private:
bool m_ForceDeployment{};
bool m_OnErrorShowUI{};
};
}
namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::factory_implementation
{
struct DeploymentRepairOptions : DeploymentRepairOptionsT<DeploymentRepairOptions, implementation::DeploymentRepairOptions>
{
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManager" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentResult" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentInitializeOptions" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentRepairOptions" ThreadingModel="both" />
</InProcessServer>
</Extension>
<Extension Category="windows.activatableClass.inProcessServer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManager" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentResult" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentInitializeOptions" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentRepairOptions" ThreadingModel="both" />
</InProcessServer>
</Extension>
<Extension Category="windows.activatableClass.inProcessServer">
Expand Down

0 comments on commit 38cacca

Please sign in to comment.