2022-08-31 01:45:22 +03:00
|
|
|
<#
|
2022-11-23 23:46:52 +03:00
|
|
|
This script is to build the Foundation transport package that will be used to generate the windows app sdk package.
|
2022-08-31 01:45:22 +03:00
|
|
|
This script is called from BuildAll.ps1 from the aggregator repo and should not be called directly.
|
|
|
|
|
2022-11-23 23:46:52 +03:00
|
|
|
PackageVersion: NuGet Package Version that will be used in the packing of Foundation Transport Package
|
2022-08-31 01:45:22 +03:00
|
|
|
Platform: Comma delimited string of platforms to run.
|
|
|
|
Configuration: Comma delimited string of configurations to run.
|
2022-11-23 23:46:52 +03:00
|
|
|
AzureBuildStep: Only used by the pipeline to perform tasks such as signing in between the steps
|
|
|
|
OutputDirectory: Pack Location of the Nuget Package
|
2022-08-31 01:45:22 +03:00
|
|
|
UpdateVersionDetailsPath: Path to a ps1 or cmd that updates version.details.xml.
|
2022-11-23 23:46:52 +03:00
|
|
|
Clean: Performs a clean on BuildOutput, Obj, and build\override
|
2022-08-31 01:45:22 +03:00
|
|
|
|
|
|
|
Note about building in different environments.
|
2023-03-24 00:57:29 +03:00
|
|
|
The feed the NuGet.config points to changes depending on the branch.
|
2022-08-31 01:45:22 +03:00
|
|
|
Develop branch points to the internal feed.
|
|
|
|
Main branch points to the external feed.
|
|
|
|
#>
|
|
|
|
|
|
|
|
Param(
|
2022-10-20 22:31:25 +03:00
|
|
|
[string]$PackageVersion = "1.1.1.1",
|
|
|
|
[string]$Platform = "x64",
|
|
|
|
[string]$Configuration = "Release",
|
|
|
|
[string]$AzureBuildStep = "all",
|
2024-01-05 21:18:42 +03:00
|
|
|
[string]$OutputDirectory = (Split-Path $MyInvocation.MyCommand.Path) + "\BuildOutput",
|
2022-10-20 22:31:25 +03:00
|
|
|
[string]$PGOBuildMode = "Optimize",
|
2022-11-23 23:46:52 +03:00
|
|
|
[string]$UpdateVersionDetailsPath = $null,
|
|
|
|
[switch]$Clean = $false
|
2022-08-31 01:45:22 +03:00
|
|
|
)
|
|
|
|
|
2024-07-03 05:54:46 +03:00
|
|
|
Set-StrictMode -Version 3.0
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
|
2022-11-23 23:46:52 +03:00
|
|
|
$env:Build_SourcesDirectory = (Split-Path $MyInvocation.MyCommand.Path)
|
|
|
|
$buildOverridePath = "build\override"
|
|
|
|
$BasePath = "BuildOutput/FullNuget"
|
|
|
|
|
|
|
|
# FUTURE(YML2PS): Update build to no longer place generated files in sources directory
|
2023-05-06 03:18:45 +03:00
|
|
|
if ($Clean)
|
2022-11-23 23:46:52 +03:00
|
|
|
{
|
|
|
|
$CleanTargets = @(
|
|
|
|
"BuildOutput",
|
|
|
|
"obj",
|
2023-05-06 03:18:45 +03:00
|
|
|
".user",
|
2022-11-23 23:46:52 +03:00
|
|
|
$buildOverridePath
|
|
|
|
)
|
2023-05-06 03:18:45 +03:00
|
|
|
|
2022-11-23 23:46:52 +03:00
|
|
|
foreach ($CleanTarget in $CleanTargets)
|
|
|
|
{
|
|
|
|
$CleanTargetPath = (Join-Path $env:Build_SourcesDirectory $CleanTarget)
|
2023-05-06 03:18:45 +03:00
|
|
|
|
2022-11-23 23:46:52 +03:00
|
|
|
if (Test-Path ($CleanTargetPath)) {
|
|
|
|
Remove-Item $CleanTargetPath -recurse
|
|
|
|
}
|
|
|
|
}
|
2023-05-06 03:18:45 +03:00
|
|
|
|
2022-11-23 23:46:52 +03:00
|
|
|
Exit
|
|
|
|
}
|
|
|
|
|
2022-10-07 02:30:19 +03:00
|
|
|
# Make sure nuget directory exists.
|
2022-08-31 01:45:22 +03:00
|
|
|
if(-not (test-path ".nuget"))
|
|
|
|
{
|
|
|
|
new-item -path ".nuget" -itemtype directory
|
|
|
|
}
|
|
|
|
|
2022-10-07 02:30:19 +03:00
|
|
|
# Make sure nuget is on the system
|
2022-08-31 01:45:22 +03:00
|
|
|
if(-not (test-path ".nuget\nuget.exe"))
|
|
|
|
{
|
|
|
|
Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile .nuget\nuget.exe
|
|
|
|
}
|
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
$configurationForMrtAndAnyCPU = "Release"
|
|
|
|
$MRTSourcesDirectory = "dev\MRTCore"
|
2022-10-07 02:30:19 +03:00
|
|
|
|
2023-05-30 22:15:45 +03:00
|
|
|
$VCToolsInstallDir = . "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -Latest -prerelease -requires Microsoft.Component.MSBuild -property InstallationPath
|
2022-10-07 02:30:19 +03:00
|
|
|
write-host "VCToolsInstallDir: $VCToolsInstallDir"
|
|
|
|
|
|
|
|
$msBuildPath = "$VCToolsInstallDir\MSBuild\Current\Bin\msbuild.exe"
|
|
|
|
write-host "msBuildPath: $msBuildPath"
|
|
|
|
|
|
|
|
|
|
|
|
# Generate overrides
|
|
|
|
# Make sure override directory exists.
|
2022-08-31 01:45:22 +03:00
|
|
|
if(-not (test-path "$buildOverridePath"))
|
|
|
|
{
|
|
|
|
new-item -path "$buildOverridePath" -itemtype "directory"
|
|
|
|
}
|
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
Try {
|
|
|
|
$WindowsAppSDKBuildPipeline = 0
|
2022-11-23 23:46:52 +03:00
|
|
|
|
|
|
|
.\tools\GenerateDynamicDependencyOverrides.ps1 -Path "$buildOverridePath"
|
|
|
|
.\tools\GeneratePushNotificationsOverrides.ps1 -Path "$buildOverridePath"
|
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
if ($AzureBuildStep -ne "all")
|
|
|
|
{
|
2023-05-06 03:18:45 +03:00
|
|
|
# Some builds have "-branchname" appended, but when this happens the environment variable
|
2022-10-20 22:31:25 +03:00
|
|
|
# TFS_BUILDNUMBER has the un-modified version.
|
|
|
|
if ($env:TFS_BUILDNUMBER)
|
|
|
|
{
|
|
|
|
$env:BUILD_BUILDNUMBER = $env:TFS_BUILDNUMBER
|
|
|
|
}
|
|
|
|
Write-Host "BuildNumber : " $env:BUILD_BUILDNUMBER
|
|
|
|
$yymm = $env:BUILD_BUILDNUMBER.substring($env:BUILD_BUILDNUMBER.length - 10, 4)
|
|
|
|
$dd = $env:BUILD_BUILDNUMBER.substring($env:BUILD_BUILDNUMBER.length - 5, 2)
|
|
|
|
$revision = $env:BUILD_BUILDNUMBER.substring($env:BUILD_BUILDNUMBER.length - 3, 3)
|
2023-05-06 03:18:45 +03:00
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
$WindowsAppSDKVersionProperty = "/p:WindowsAppSDKVersionBuild=$yymm /p:WindowsAppSDKVersionRevision=$dd$revision"
|
2023-05-06 03:18:45 +03:00
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
# If $AzureBuildStep is not "all", that means we are in the pipeline
|
|
|
|
$WindowsAppSDKBuildPipeline = 1
|
|
|
|
}
|
2023-05-06 03:18:45 +03:00
|
|
|
# PreFastSetup is specifically for use when preparing for PREFast scans. It triggers the same actions below as BuildBinaries or BuildMRT, except
|
|
|
|
# PreFastSetup stops short of calling msBuild.exe to build the target, which the Guardian:PREFast task does _not_ support, so the caller of this
|
|
|
|
# script needs to resort to calling the MSBuild/VSBuild task later to build the target, which the Guardian:PREFast task does support. Structuring
|
2023-03-24 00:57:29 +03:00
|
|
|
# the code this way allows minimally diveraging the flow while supporting building the target both via this script and the VSBuild/MSBuild task.
|
2023-05-06 03:18:45 +03:00
|
|
|
if (($AzureBuildStep -eq "all") -Or (($AzureBuildStep -eq "BuildBinaries") -Or ($AzureBuildStep -eq "BuildMRT") -Or ($AzureBuildStep -eq "PreFastSetup")))
|
2022-10-20 22:31:25 +03:00
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
& .\.nuget\nuget.exe restore WindowsAppRuntime.sln -configfile NuGet.config
|
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
|
|
|
write-host "ERROR: restore WindowsAppRuntime.sln FAILED."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
& .\.nuget\nuget.exe restore "dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" -configfile NuGet.config
|
2022-10-07 02:30:19 +03:00
|
|
|
|
2022-12-07 02:01:27 +03:00
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "ERROR: restore Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj FAILED."
|
2022-12-07 02:01:27 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2022-12-03 00:43:52 +03:00
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
$srcPath = Get-Childitem -Path 'dev\WindowsAppRuntime_Insights\packages' -File 'MicrosoftTelemetry.h' -Recurse
|
2022-10-07 02:30:19 +03:00
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
if (($srcPath -ne $null)){
|
|
|
|
$destinationPaths = Get-Childitem -Path 'packages' -File 'Traceloggingconfig.h' -Recurse
|
2022-10-07 02:30:19 +03:00
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
if (($destinationPaths -ne $null)) {
|
|
|
|
foreach ($destPath in $destinationPaths) {
|
|
|
|
Write-Host 'SourcePath:' $srcPath.FullName
|
|
|
|
Write-Host 'DestinationPath:' $destPath.FullName
|
|
|
|
Copy-Item -Force $srcPath.FullName $destPath.FullName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-07 02:01:27 +03:00
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "ERROR: Copy-Item -Force $srcPath.FullName $destPath.FullName FAILED."
|
2022-12-07 02:01:27 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2022-10-20 22:31:25 +03:00
|
|
|
}
|
2023-03-24 00:57:29 +03:00
|
|
|
# PreFastSetup intentionally skips the call to MSBuild.exe below.
|
2023-05-06 03:18:45 +03:00
|
|
|
if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "BuildBinaries"))
|
2022-10-07 02:30:19 +03:00
|
|
|
{
|
2022-10-20 22:31:25 +03:00
|
|
|
foreach($configurationToRun in $configuration.Split(","))
|
|
|
|
{
|
|
|
|
foreach($platformToRun in $platform.Split(","))
|
|
|
|
{
|
|
|
|
write-host "Building WindowsAppRuntime.sln for configuration $configurationToRun and platform:$platformToRun"
|
|
|
|
& $msBuildPath /restore `
|
|
|
|
WindowsAppRuntime.sln `
|
|
|
|
/p:Configuration=$configurationToRun,Platform=$platformToRun `
|
|
|
|
/binaryLogger:"BuildOutput/WindowsAppRuntime.$platformToRun.$configurationToRun.binlog" `
|
|
|
|
$WindowsAppSDKVersionProperty `
|
|
|
|
/p:PGOBuildMode=$PGOBuildMode `
|
|
|
|
/p:WindowsAppSDKCleanIntermediateFiles=true `
|
|
|
|
/p:AppxSymbolPackageEnabled=false `
|
|
|
|
/p:WindowsAppSDKBuildPipeline=$WindowsAppSDKBuildPipeline
|
2022-12-07 02:01:27 +03:00
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "ERROR: msbuild.exe /restore WindowsAppRuntime.sln FAILED."
|
2022-12-07 02:01:27 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2022-10-20 22:31:25 +03:00
|
|
|
}
|
|
|
|
}
|
2022-10-07 02:30:19 +03:00
|
|
|
}
|
2023-05-06 03:18:45 +03:00
|
|
|
if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "BuildMRT") -Or ($AzureBuildStep -eq "PreFastSetup"))
|
2022-10-07 02:30:19 +03:00
|
|
|
{
|
2022-10-20 22:31:25 +03:00
|
|
|
#------------------
|
|
|
|
# Build mrtcore.sln and move output to staging.
|
|
|
|
#------------------
|
|
|
|
|
|
|
|
#Restore packages from mrt.
|
2023-03-24 00:57:29 +03:00
|
|
|
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\MrtCore.sln" -ConfigFile NuGet.config
|
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
|
|
|
write-host "ERROR: restore MrtCore.sln FAILED."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\Microsoft.Windows.ApplicationModel.Resources\src\packages.config" -ConfigFile NuGet.config
|
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
|
|
|
write-host "ERROR: restore Microsoft.Windows.ApplicationModel.Resources\src\packages.config FAILED."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\mrm\mrmex\packages.config" -ConfigFile NuGet.config
|
2022-10-20 22:31:25 +03:00
|
|
|
|
2022-12-07 02:01:27 +03:00
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "ERROR: restore mrm\mrmex\packages.config FAILED."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\mrm\mrmmin\packages.config" -ConfigFile NuGet.config
|
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
|
|
|
write-host "ERROR: restore mrmmin\packages.config FAILED."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\mrm\unittests\packages.config" -ConfigFile NuGet.config
|
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
|
|
|
write-host "ERROR: restore unittests\packages.config FAILED."
|
2022-12-07 02:01:27 +03:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
# Init mrtcore
|
|
|
|
foreach($platformToRun in $platform.Split(","))
|
|
|
|
{
|
|
|
|
& $MRTSourcesDirectory\build\init.cmd /envonly $platformToRun\fre
|
2023-03-24 00:57:29 +03:00
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
|
|
|
write-host "ERROR: init.cmd /envonly $platformToRun\fre FAILED."
|
|
|
|
}
|
2022-10-20 22:31:25 +03:00
|
|
|
}
|
|
|
|
|
2023-03-24 00:57:29 +03:00
|
|
|
# PreFastSetup intentionally skips the call to MSBuild.exe below.
|
2023-05-06 03:18:45 +03:00
|
|
|
if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "BuildMRT"))
|
2022-10-20 22:31:25 +03:00
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
# Build mrt core.
|
|
|
|
foreach($configurationToRun in $configuration.Split(","))
|
2022-10-20 22:31:25 +03:00
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
foreach($platformToRun in $platform.Split(","))
|
2022-12-07 02:01:27 +03:00
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "Building MrtCore.sln for configuration $configurationToRun and platform:$platformToRun"
|
|
|
|
& $msBuildPath /restore "$MRTSourcesDirectory\mrt\MrtCore.sln" `
|
|
|
|
/p:Configuration=$configurationToRun,Platform=$platformToRun `
|
|
|
|
/p:PGOBuildMode=$PGOBuildMode `
|
|
|
|
/binaryLogger:"BuildOutput/mrtcore.$platformToRun.$configurationToRun.binlog"
|
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-12-15 19:45:57 +03:00
|
|
|
write-host "ERROR: Building '$MRTSourcesDirectory\mrt\MrtCore.sln' FAILED."
|
2023-03-24 00:57:29 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2022-12-07 02:01:27 +03:00
|
|
|
}
|
2022-10-20 22:31:25 +03:00
|
|
|
}
|
|
|
|
}
|
2022-10-07 02:30:19 +03:00
|
|
|
}
|
2023-05-06 03:18:45 +03:00
|
|
|
if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "BuildAnyCPU"))
|
2022-08-31 01:45:22 +03:00
|
|
|
{
|
2022-10-20 22:31:25 +03:00
|
|
|
#------------------
|
|
|
|
# Build windowsAppRuntime.sln (anyCPU) and move output to staging.
|
|
|
|
#------------------
|
|
|
|
# build AnyCPU
|
|
|
|
& $msBuildPath /restore "dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" /p:Configuration=$configurationForMrtAndAnyCPU,Platform=AnyCPU
|
2022-12-07 02:01:27 +03:00
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "ERROR: msbuild restore Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj FAILED."
|
2022-12-07 02:01:27 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2022-08-31 01:45:22 +03:00
|
|
|
}
|
2024-01-05 21:18:42 +03:00
|
|
|
|
2023-05-06 03:18:45 +03:00
|
|
|
if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "StageFiles"))
|
2022-08-31 01:45:22 +03:00
|
|
|
{
|
2022-10-20 22:31:25 +03:00
|
|
|
#------------------
|
|
|
|
# Stage files for Packing
|
2023-05-06 03:18:45 +03:00
|
|
|
#------------------
|
2022-10-20 22:31:25 +03:00
|
|
|
if(-not (test-path "$BasePath"))
|
2023-05-06 03:18:45 +03:00
|
|
|
{
|
2022-10-20 22:31:25 +03:00
|
|
|
new-item -path "$BasePath" -itemtype "directory"
|
|
|
|
}
|
|
|
|
|
|
|
|
if(-not (test-path "$BasePath\build\native"))
|
|
|
|
{
|
|
|
|
new-item -path "$BasePath\build\native" -itemtype "directory"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Copy WindowsAppRuntime.sln files
|
|
|
|
foreach($configurationToRun in $configuration.Split(","))
|
|
|
|
{
|
|
|
|
foreach($platformToRun in $platform.Split(","))
|
|
|
|
{
|
2024-07-03 05:54:46 +03:00
|
|
|
# TODO: $windowsAppSdkBinariesPath may not be defined. Remove the temp downgrade to 1.0 once this issue has been fixed (b#52130179).
|
|
|
|
Set-StrictMode -Version 1.0
|
2022-10-20 22:31:25 +03:00
|
|
|
.\build\CopyFilesToStagingDir.ps1 -BuildOutputDir 'BuildOutput' -OverrideDir "$buildOverridePath" -PublishDir "$windowsAppSdkBinariesPath" -NugetDir "$BasePath" -Platform $PlatformToRun -Configuration $ConfigurationToRun
|
2024-07-03 05:54:46 +03:00
|
|
|
Set-StrictMode -Version 3.0
|
2022-12-07 02:01:27 +03:00
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "ERROR: msCopyFilesToStagingDir.ps1 FAILED."
|
2022-12-07 02:01:27 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2022-10-20 22:31:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$nuSpecsPath = "build\NuSpecs"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\WindowsAppSDK-Nuget-Native.targets" -Destination "$BasePath\build\native\Microsoft.WindowsAppSDK.Foundation.targets"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\WindowsAppSDK-Nuget-Native.props" -Destination "$BasePath\build\native\Microsoft.WindowsAppSDK.Foundation.props"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\WindowsAppSDK-Nuget-Native.C.props" -Destination "$BasePath\build\native"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\WindowsAppSDK-Nuget-Native.WinRt.props" -Destination "$BasePath\build\native"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\WindowsAppSDK-Nuget-Native.Bootstrap.targets" -Destination "$BasePath\build\native"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\WindowsAppSDK-Nuget-Native.DeploymentManager.targets" -Destination "$BasePath\build\native"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\WindowsAppSDK-Nuget-Native.UndockedRegFreeWinRT.targets" -Destination "$BasePath\build\native"
|
|
|
|
|
|
|
|
Copy-Item -Path "$nuSpecsPath\Microsoft.WindowsAppSDK.Foundation.targets" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\Microsoft.WindowsAppSDK.Foundation.props" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\Microsoft.WindowsAppSDK.Bootstrap.CS.targets" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\Microsoft.WindowsAppSDK.BootstrapCommon.targets" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\Microsoft.WindowsAppSDK.DeploymentManager.CS.targets" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\Microsoft.WindowsAppSDK.DeploymentManagerCommon.targets" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\Microsoft.WindowsAppSDK.UndockedRegFreeWinRT.CS.targets" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$nuSpecsPath\Microsoft.WindowsAppSDK.UndockedRegFreeWinRTCommon.targets" -Destination "$BasePath\build"
|
|
|
|
|
|
|
|
Copy-Item -Path "$nuSpecsPath\AppxManifest.xml" -Destination "$BasePath\AppxManifest.xml"
|
|
|
|
|
|
|
|
# Copy over mrt files
|
|
|
|
foreach($platformToRun in $platform.Split(","))
|
|
|
|
{
|
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\$platformToRun\mrm\MRM.dll" -destination "$BasePath\runtimes\win10-$platformToRun\native" -force
|
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\$platformToRun\mrm\MRM.pdb" -destination "$BasePath\runtimes\win10-$platformToRun\native" -force
|
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\$platformToRun\Microsoft.Windows.ApplicationModel.Resources\Microsoft.Windows.ApplicationModel.Resources.pdb" -destination "$BasePath\runtimes\win10-$platformToRun\native" -force
|
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\$platformToRun\Microsoft.Windows.ApplicationModel.Resources\Microsoft.Windows.ApplicationModel.Resources.dll" -destination "$BasePath\runtimes\win10-$platformToRun\native" -force
|
2023-05-06 03:18:45 +03:00
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\$platformToRun\mrm\MRM.lib" -destination "$BasePath\lib\win10-$platformToRun" -force
|
|
|
|
|
|
|
|
if($platformToRun -eq "x86")
|
|
|
|
{
|
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\$platformToRun\Microsoft.Windows.ApplicationModel.Resources.Projection\Microsoft.Windows.ApplicationModel.Resources.Projection.dll" -destination "$BasePath\lib\net6.0-windows10.0.17763.0" -force
|
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\$platformToRun\Microsoft.Windows.ApplicationModel.Resources.Projection\Microsoft.Windows.ApplicationModel.Resources.Projection.pdb" -destination "$BasePath\lib\net6.0-windows10.0.17763.0" -force
|
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\$platformToRun\Microsoft.Windows.ApplicationModel.Resources\Microsoft.Windows.ApplicationModel.Resources.winmd" -destination "$BasePath\lib\uap10.0" -force
|
2024-06-29 00:13:25 +03:00
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\$platformToRun\Microsoft.Windows.ApplicationModel.Resources\Microsoft.Windows.Globalization.winmd" -destination "$BasePath\lib\uap10.0" -force
|
2022-10-20 22:31:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# copy MRT IDL over.
|
|
|
|
Copy-Item -path "$MRTSourcesDirectory\mrt\Microsoft.Windows.ApplicationModel.Resources\src\Microsoft.Windows.ApplicationModel.Resources.idl" -destination "$BasePath\include" -force
|
|
|
|
|
|
|
|
# Copy MRT metadata files.
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\packaging\MrtCore.props" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\packaging\MrtCore.PriGen.targets" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\packaging\MrtCore.References.targets" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\packaging\MrtCore.targets" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\packaging\native\MrtCore.C.props" -Destination "$BasePath\build\native"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\packaging\native\MrtCore.props" -Destination "$BasePath\build\native"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\packaging\native\MrtCore.targets" -Destination "$BasePath\build\native"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\packaging\ProjectItemsSchema.xaml" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\packaging\README.md" -Destination "$BasePath\build"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\mrt\core\src\MRM.h" -Destination "$BasePath\include"
|
|
|
|
Copy-Item -Path "$MRTSourcesDirectory\mrt\Microsoft.Windows.ApplicationModel.Resources\src\Microsoft.Windows.ApplicationModel.Resources.idl" -Destination "$BasePath\include"
|
|
|
|
|
|
|
|
# If AnyCPU generates another dll it needs to be added here.
|
|
|
|
Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\anycpu\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.dll" -destination "$BasePath\lib\net6.0-windows10.0.17763.0"
|
|
|
|
|
|
|
|
#------------------
|
|
|
|
# Move other files and prepare manifest and appxmanifest.xml
|
|
|
|
#------------------
|
|
|
|
|
|
|
|
Copy-Item -Path "$nuSpecsPath\AppxManifest.xml" -Destination "$BasePath"
|
2023-03-24 00:57:29 +03:00
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
|
|
|
write-host "ERROR: Copy-Item -Path AppxManifest.xml FAILED."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
Copy-Item -Path "LICENSE" -Destination "$BasePath" -force
|
|
|
|
|
2022-12-07 02:01:27 +03:00
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "ERROR: Copy-Item -Path LICENSE FAILED."
|
2022-12-07 02:01:27 +03:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
# for some reason xslt.load changes the working directory to C:\windows\system32.
|
|
|
|
# store the current working directory here.
|
|
|
|
$workingDirectory = get-location
|
|
|
|
$manifestPath = "$BasePath\manifests"
|
|
|
|
|
|
|
|
# Make Microsoft.WindowsAppSDK.Foundation.manifest.
|
|
|
|
$newitem = New-Item -ItemType Directory -Force -Path $manifestPath
|
|
|
|
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform
|
|
|
|
$xslt.Load("$workingDirectory\build\TransformAppxManifest.xslt")
|
|
|
|
$xslt.Transform("$workingDirectory\$BasePath\AppxManifest.xml", "$workingDirectory\$manifestPath\Microsoft.WindowsAppSdk.Foundation.manifest")
|
2022-12-07 02:01:27 +03:00
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "ERROR: xslt.Transform FAILED."
|
2022-12-07 02:01:27 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2022-08-31 01:45:22 +03:00
|
|
|
}
|
2023-05-06 03:18:45 +03:00
|
|
|
if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "PackNuget"))
|
2022-10-20 22:31:25 +03:00
|
|
|
{
|
2023-05-06 03:18:45 +03:00
|
|
|
$nuspecPath = "BuildOutput\Microsoft.WindowsAppSDK.Foundation.nuspec"
|
2022-10-20 22:31:25 +03:00
|
|
|
Copy-Item -Path ".\build\NuSpecs\Microsoft.WindowsAppSDK.Foundation.nuspec" -Destination $nuspecPath
|
2022-08-31 01:45:22 +03:00
|
|
|
|
2022-10-20 22:31:25 +03:00
|
|
|
# Add the version to the nuspec.
|
|
|
|
[xml]$publicNuspec = Get-Content -Path $nuspecPath
|
|
|
|
$publicNuspec.package.metadata.version = $PackageVersion
|
|
|
|
Set-Content -Value $publicNuspec.OuterXml $nuspecPath
|
|
|
|
|
|
|
|
# Make the foundation transport package.
|
|
|
|
& .\.nuget\nuget.exe pack $nuspecPath -BasePath $BasePath -OutputDirectory $OutputDirectory
|
2022-12-07 02:01:27 +03:00
|
|
|
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
2023-03-24 00:57:29 +03:00
|
|
|
write-host "ERROR: nuget.exe pack $nuspecPath FAILED."
|
2022-12-07 02:01:27 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2022-10-20 22:31:25 +03:00
|
|
|
}
|
2024-01-12 01:56:16 +03:00
|
|
|
# if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "BuildMock"))
|
|
|
|
# {
|
|
|
|
# $transportPackagepath = (Join-Path $OutputDirectory "Microsoft.WindowsAppSDK.Foundation.TransportPackage.$PackageVersion.nupkg")
|
|
|
|
# . eng\common\Scripts\buildMockWinAppSdkPackage.ps1 -TransportPackageName "Foundation" -TransportPackagePath $transportPackagepath -RepoRoot $env:Build_SourcesDirectory -Output $OutputDirectory -Platform $Platform -Configuration $Configuration -TransportPackageVersion $PackageVersion -CleanOutput
|
|
|
|
# }
|
2024-01-05 21:18:42 +03:00
|
|
|
|
|
|
|
$files = Get-ChildItem $OutputDirectory -File -Filter "*.nupkg"
|
|
|
|
foreach ($file in $files)
|
|
|
|
{
|
|
|
|
Write-Host $file.FullName
|
|
|
|
}
|
2023-05-06 03:18:45 +03:00
|
|
|
}
|
|
|
|
Catch
|
2022-10-07 02:30:19 +03:00
|
|
|
{
|
2022-10-20 22:31:25 +03:00
|
|
|
$formatstring = "`n{0}`n`n{1}`n`n"
|
|
|
|
$fields = $_, $_.ScriptStackTrace
|
|
|
|
|
|
|
|
Write-Host ($formatstring -f $fields) -ForegroundColor RED
|
|
|
|
exit 1
|
|
|
|
}
|