Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions WindowsAppRuntime.sln
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Framework.Widgets", "test\D
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DynamicDependencyLifetimeManagerShadow", "dev\DynamicDependency\DynamicDependencyLifetimeManagerShadow\DynamicDependencyLifetimeManagerShadow.vcxproj", "{6539E9E1-BF36-40E5-86BC-070E99DB7B7B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Licensing", "Licensing", "{34671779-4A4D-4D0E-B259-CD0F14D4F6D4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Licensing", "dev\Licensing\Licensing.vcxitems", "{885A43FA-052D-4B0D-A2DC-13EE15796435}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
test\inc\inc.vcxitems*{0a5fee93-48b7-40ec-bb9a-b27d11060da9}*SharedItemsImports = 4
Expand All @@ -251,10 +255,12 @@ Global
dev\UndockedRegFreeWinRT\UndockedRegFreeWinRT.vcxitems*{56371ca6-144b-4989-a4e9-391ad4fa7651}*SharedItemsImports = 9
test\inc\inc.vcxitems*{56a1d696-feda-4333-bf37-772ebececb10}*SharedItemsImports = 4
test\inc\inc.vcxitems*{7c502995-59c3-483b-86ba-815985353633}*SharedItemsImports = 4
dev\Licensing\Licensing.vcxitems*{885a43fa-052d-4b0d-a2dc-13ee15796435}*SharedItemsImports = 9
test\inc\inc.vcxitems*{8e52d7ea-a200-4a6b-ba74-8efb49468caf}*SharedItemsImports = 4
test\inc\inc.vcxitems*{b567fe2e-3a03-48d0-b2b5-760cdec35891}*SharedItemsImports = 9
dev\Common\Common.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\DynamicDependency\API\DynamicDependency.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\Licensing\Licensing.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\PowerNotifications\PowerNotifications.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\UndockedRegFreeWinRT\UndockedRegFreeWinRT.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\PowerNotifications\PowerNotifications.vcxitems*{b75c1b22-553c-40e4-b38e-6ab4d01fdb9d}*SharedItemsImports = 9
Expand Down Expand Up @@ -985,6 +991,8 @@ Global
{D45D4170-E055-4926-8B03-04DAA5F02C6C} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{09DDAE21-397F-4263-8561-7F2FF28127CF} = {0C534F12-B076-47E5-A05B-2A711233AC6F}
{6539E9E1-BF36-40E5-86BC-070E99DB7B7B} = {6CD01EF6-D4A4-4801-ADCF-344CF87FF942}
{34671779-4A4D-4D0E-B259-CD0F14D4F6D4} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{885A43FA-052D-4B0D-A2DC-13EE15796435} = {34671779-4A4D-4D0E-B259-CD0F14D4F6D4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4B3D7591-CFEC-4762-9A07-ABE99938FB77}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
channel: 'experimental'
enableLicenseInstall: false

steps:
- template: WindowsAppSDK-BuildProject-Steps.yml
Expand All @@ -9,3 +10,4 @@ steps:
buildOutputDir: $(buildOutputDir)
publishDir: $(publishDir)
channel: ${{ parameters.channel }}
enableLicenseInstall: ${{ parameters.enableLicenseInstall }}
44 changes: 41 additions & 3 deletions build/AzurePipelinesTemplates/WindowsAppSDK-BuildProject-Steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,34 @@ parameters:
buildOutputDir: '$(Build.SourcesDirectory)\BuildOutput'
artifactName: 'drop'
channel: 'experimental'
enableLicenseInstall: false
# license installation assets are only accessible in internal builds, but are only
# needed in release-signed stable builds. Only enble this functionality in the private
# pipeline builds. Otherwise, defautl to an inert placeholder implementation.


steps:
- ${{ if eq(parameters.enableLicenseInstall, true) }}:
- task: NuGetAuthenticate@0
inputs:
nuGetServiceConnections: 'ProjectReunionInternal'

# Restore transport package dependencies. This is only enbaled in release-signed builds.
- task: PowerShell@2
name: ConvertVersionDetailsToPackageConfig
displayName: "Convert VersionDetails To PackageConfig"
inputs:
filePath: '$(Build.SourcesDirectory)\build\Scripts\ConvertVersionDetailsToPackageConfig.ps1'
arguments: -versionDetailsPath '$(Build.SourcesDirectory)\eng\Version.Details.xml' -packageConfigPath '$(Build.SourcesDirectory)\build\packages.config'

- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: RestoreNuGetPackages
inputs:
restoreSolution: build/packages.config
feedsToUse: config
nugetConfigPath: build/licensing.nuget.config
restoreDirectory: packages

- template: WindowsAppSDK-PopulateBuildDateAndRevision-Steps.yml

- script: |
Expand Down Expand Up @@ -91,22 +117,22 @@ steps:
filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1
arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-PushNotifications.xml -Channel ${{ parameters.channel }} -Language C++ -Namespace Microsoft.Windows.PushNotifications -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-PushNotifications.h
workingDirectory: '$(Build.SourcesDirectory)'

- task: powershell@2
displayName: 'Create EnvironmentManager TerminalVelocity features'
inputs:
targetType: filePath
filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1
arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-EnvironmentManager.xml -Channel ${{ parameters.channel }} -Language C++ -Namespace Microsoft.Windows.System -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-EnvironmentManager.h
workingDirectory: '$(Build.SourcesDirectory)'

- task: powershell@2
name: UpdateTraceloggingConfig
inputs:
targetType: 'inline'
script: |
$srcPath = Get-Childitem -Path 'dev\WindowsAppRuntime_Insights\packages' -File 'MicrosoftTelemetry.h' -Recurse

if (($srcPath -ne $null)){
$destinationPath = Get-Childitem -Path 'packages' -File 'Traceloggingconfig.h' -Recurse

Expand All @@ -116,6 +142,18 @@ steps:
}
}

# Copy MSIX license installation header into the correct source location.
- ${{ if eq(parameters.enableLicenseInstall, true) }}:
- task: CopyFiles@2
displayName: 'Extract license header to source location'
inputs:
SourceFolder: '$(Build.SourcesDirectory)\build\packages\$(AppLicensingInternalPackageName).$(AppLicensingInternalPackageVersion)\src'
Contents: |
*.h
TargetFolder: '$(Build.SourcesDirectory)\dev\Licensing'
flattenFolders: false
overWrite: true

- task: VSBuild@1
displayName: 'Build solution ${{ parameters.solutionPath }}'
inputs:
Expand Down
2 changes: 2 additions & 0 deletions build/ProjectReunion-BuildFoundation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
- template: AzurePipelinesTemplates\WindowsAppSDK-BuildDevProject-Steps.yml
parameters:
channel: ${{ variables.channel }}
enableLicenseInstall: true

- template: AzurePipelinesTemplates\WindowsAppSDK-PublishProjectOutput-Steps.yml

Expand Down Expand Up @@ -165,6 +166,7 @@ jobs:
buildOutputDir: $(buildOutputDir)
publishDir: $(publishDir)
channel: ${{ variables.channel }}
enableLicenseInstall: true

- task: CopyFiles@2
displayName: 'Copy AnyCpu-built binaries'
Expand Down
25 changes: 25 additions & 0 deletions build/licensing.nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<!--
Where packages should go. Visual Studio will provide a default value of $(SolutionDir) but command-line based
package restores could end up in a different location. Setting this value keeps Visual Studio and NuGet.exe
in sync for packages.config based restores.
-->
<add key="repositoryPath" value=".\packages" />
</config>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSources>
<clear />
<add key="Project.Reunion.nuget.internal" value="https://pkgs.dev.azure.com/microsoft/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>
40 changes: 40 additions & 0 deletions build/scripts/ConvertVersionDetailsToPackageConfig.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Param(
[Parameter(Position=0)]
[string]$versionDetailsPath = "",
[Parameter(Position=1)]
[string]$packageConfigPath = ""
)

[xml]$buildConfig = Get-Content -Path $versionDetailsPath

$packagesText =
@"
<?xml version="1.0" encoding="utf-8"?>
<packages>
<!-- Transport packages from the feeder repositories -->

"@
foreach ($dependency in $buildConfig.Dependencies.ProductDependencies.Dependency)
{
$name = $dependency.name
$ver = $dependency.version
Write-Host "id: " $name
Write-Host "ver: " $ver

if ($name -eq "Microsoft.WindowsAppSDK.AppLicensingInternal.TransportPackage")
{
Write-Host "##vso[task.setvariable variable=AppLicensingInternalPackageName;]$name"
Write-Host "##vso[task.setvariable variable=AppLicensingInternalPackageVersion;]$ver"
}

$packagesText += ' <package id="' + $name + '" version="' + $ver + '" targetFramework="native" />
'
}
$packagesText +=
@"
</packages>
"@

Write-Host $packagesText

Set-Content -Value $packagesText $packageConfigPath
59 changes: 53 additions & 6 deletions dev/Deployment/DeploymentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <TerminalVelocityFeatures-DeploymentAPI.h>
#include <Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManager.g.cpp>

#include "WindowsAppRuntime-License.h"

namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implementation
{

Expand Down Expand Up @@ -85,7 +87,7 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem
}

std::wstring frameworkPackageFullName{ packageFullName };
auto deployPackagesResult{ DeployPackages(frameworkPackageFullName) };
auto deployPackagesResult{ Deploy(frameworkPackageFullName) };
DeploymentStatus status{};
if (SUCCEEDED(deployPackagesResult))
{
Expand Down Expand Up @@ -193,23 +195,68 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem
CATCH_RETURN()

// Deploys all of the packages carried by the specified framework.
HRESULT DeploymentManager::DeployPackages(const std::wstring& frameworkPackageFullName) try
HRESULT DeploymentManager::Deploy(const std::wstring& frameworkPackageFullName) try
{
RETURN_IF_FAILED(InstallLicenses(frameworkPackageFullName));
RETURN_IF_FAILED(DeployPackages(frameworkPackageFullName));
return S_OK;
}
CATCH_RETURN()

HRESULT DeploymentManager::InstallLicenses(const std::wstring& frameworkPackageFullName)
{
// Build path for licenses
auto licensePath{ std::filesystem::path(GetPackagePath(frameworkPackageFullName)) };
licensePath /= WINDOWSAPPRUNTIME_FRAMEWORK_PACKAGE_FOLDER;
auto licenseFilespec{ licensePath };
licenseFilespec /= L"*_license.xml";

// Deploy the licenses (if any)
::Microsoft::Windows::ApplicationModel::Licensing::Installer licenseInstaller;
WIN32_FIND_DATA findFileData{};
wil::unique_hfind hfind{ FindFirstFileW(licenseFilespec.c_str(), &findFileData) };
if (!hfind)
{
const auto lastError{ GetLastError() };
RETURN_HR_IF_MSG(HRESULT_FROM_WIN32(lastError), (lastError != ERROR_FILE_NOT_FOUND) && (lastError != ERROR_PATH_NOT_FOUND),
"FindFirstFile:%ls", licenseFilespec.c_str());
return S_OK;
}
for (;;)
{
// Install the license file
auto licenseFilename{ licensePath };
licenseFilename /= findFileData.cFileName;
RETURN_IF_FAILED_MSG(licenseInstaller.InstallLicenseFile(licenseFilename.c_str()),
"LicenseFile:%ls", licenseFilename.c_str());

// Next! (if any)
if (!FindNextFileW(hfind.get(), &findFileData))
{
const auto lastError{ GetLastError() };
RETURN_HR_IF(HRESULT_FROM_WIN32(lastError), lastError != ERROR_NO_MORE_FILES);
break;
}
}
return S_OK;
}

HRESULT DeploymentManager::DeployPackages(const std::wstring& frameworkPackageFullName)
{
auto frameworkPath = std::filesystem::path(GetPackagePath(frameworkPackageFullName));
const auto frameworkPath{ std::filesystem::path(GetPackagePath(frameworkPackageFullName)) };
for (const auto& package : c_targetPackages)
{
// Build path for the packages.
auto packagePath{ frameworkPath };
packagePath /= WINDOWSAPPRUNTIME_FRAMEWORK_PACKAGE_FOLDER;
packagePath /= package.identifier + WINDOWSAPPRUNTIME_FRAMEWORK_PACKAGE_FILE_EXTENSION;

// Deploy package.
RETURN_IF_FAILED(AddPackage(packagePath));
}

return S_OK;
}
CATCH_RETURN()

hstring DeploymentManager::GetCurrentFrameworkPackageFullName()
{
Expand Down Expand Up @@ -254,7 +301,7 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem
continue;
}
}

return hstring(currentPackageInfo.Package(i).packageFullName);
}

Expand Down
2 changes: 2 additions & 0 deletions dev/Deployment/DeploymentManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem
static HRESULT VerifyPackage(const std::wstring& packageFamilyName, const PACKAGE_VERSION targetVersion);
static std::wstring GetPackagePath(std::wstring const& packageFullName);
static HRESULT AddPackage(const std::filesystem::path& packagePath);
static HRESULT Deploy(const std::wstring& frameworkPackageFullName);
static HRESULT DeployPackages(const std::wstring& frameworkPackageFullName);
static HRESULT InstallLicenses(const std::wstring& frameworkPackageFullName);
static hstring GetCurrentFrameworkPackageFullName();
};
}
Expand Down
27 changes: 27 additions & 0 deletions dev/Licensing/Licensing.vcxitems
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<ItemsProjectGuid>{885A43FA-052D-4b0d-A2DC-13EE15796435}</ItemsProjectGuid>
<ItemsProjectName>Licensing</ItemsProjectName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectCapability Include="SourceItemsFromImports" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(MSBuildThisFileDirectory)WindowsAppRuntime-License.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MsixLicensing.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)MsixLicensing.cpp" />
</ItemGroup>
<ItemGroup>
<PublicHeaders Include="$(MSBuildThisFileDirectory)MsixLicensing.h" />
</ItemGroup>
</Project>
16 changes: 16 additions & 0 deletions dev/Licensing/MsixLicensing.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.

#include "pch.h"

#include "msixlicensing.h"

#include <WindowsAppRuntime-License.h>

STDAPI MsixInstallLicenses() noexcept try
{
//TODO
// FOREACH file IN pkgdir\MSIX\*_license.xml
// InstallLicenseFile(file)
Comment thread
DrusTheAxe marked this conversation as resolved.
return S_OK;
}
CATCH_RETURN();
8 changes: 8 additions & 0 deletions dev/Licensing/MsixLicensing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.

#ifndef __MSIXLICENSING_H
#define __MSIXLICENSING_H

STDAPI MsixInstallLicenses() noexcept;

#endif // __MSIXLICENSING_H
Loading