Skip to content

Commit

Permalink
Merge pull request #2429 from microsoft/staging
Browse files Browse the repository at this point in the history
Release - 3/18/24
  • Loading branch information
EricJohnson327 committed Mar 18, 2024
2 parents bff3409 + ad5c00d commit 227009e
Show file tree
Hide file tree
Showing 771 changed files with 27,828 additions and 1,909 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/DevHome-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ jobs:
- name: Build_SDK
run: cmd /c "$env:VSDevCmd" "&" msbuild /p:Configuration=Release,Platform=${{ matrix.platform }} extensionsdk\\DevHomeSDK.sln

- name: Build_DevSetupAgent_x86
if: ${{ matrix.platform != 'arm64' }}
run: cmd /c "$env:VSDevCmd" "&" msbuild /p:Configuration=${{ matrix.configuration }},Platform=x86 HyperVExtension\\DevSetupAgent.sln

- name: Compress_DevSetupAgent_x86
if: ${{ matrix.platform != 'arm64' }}
shell: pwsh
run: Compress-Archive -Force -Path HyperVExtension\src\DevSetupAgent\bin\x86\${{ matrix.configuration }}\net8.0-windows10.0.22000.0\win10-x86\* -DestinationPath "HyperVExtension\src\DevSetupAgent\bin\x86\${{ matrix.configuration }}\DevSetupAgent_x86.zip"

- name: Build_DevSetupAgent_arm64
if: ${{ matrix.platform == 'arm64' }}
run: cmd /c "$env:VSDevCmd" "&" msbuild /p:Configuration=${{ matrix.configuration }},Platform=arm64 HyperVExtension\\DevSetupAgent.sln

- name: Compress_DevSetupAgent_arm64
if: ${{ matrix.platform == 'arm64' }}
shell: pwsh
run: Compress-Archive -Force -Path HyperVExtension\src\DevSetupAgent\bin\arm64\${{ matrix.configuration }}\net8.0-windows10.0.22000.0\win10-arm64\* -DestinationPath "HyperVExtension\src\DevSetupAgent\bin\arm64\${{ matrix.configuration }}\DevSetupAgent_arm64.zip"

- name: Build_DevHome
run: cmd /c "$env:VSDevCmd" "&" msbuild /p:Configuration=${{ matrix.configuration }},Platform=${{ matrix.platform }} DevHome.sln

Expand Down
23 changes: 21 additions & 2 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Description:
Options:
-Platform <platform>
Only buil the selected platform(s)
Only build the selected platform(s)
Example: -Platform x64
Example: -Platform "x86,x64,arm64"
Expand Down Expand Up @@ -61,6 +61,22 @@ if (($BuildStep -ieq "all") -Or ($BuildStep -ieq "sdk")) {
}
}

if (($BuildStep -ieq "all") -Or ($BuildStep -ieq "DevSetupAgent") -Or ($BuildStep -ieq "fullMsix")) {
foreach ($configuration in $env:Build_Configuration.Split(",")) {
# We use x86 DevSetupAgent for x64 and x86 Dev Home build. Only need to build it once if we are building multiple platforms.
$builtX86 = $false
foreach ($platform in $env:Build_Platform.Split(",")) {
if ($Platform -ieq "arm64") {
HyperVExtension\BuildDevSetupAgentHelper.ps1 -Platform $Platform -Configuration $configuration -VersionOfSDK $env:sdk_version -SDKNugetSource $SDKNugetSource -AzureBuildingBranch $AzureBuildingBranch -IsAzurePipelineBuild $IsAzurePipelineBuild -BypassWarning
}
elseif (-not $builtX86) {
HyperVExtension\BuildDevSetupAgentHelper.ps1 -Platform "x86" -Configuration $configuration -VersionOfSDK $env:sdk_version -SDKNugetSource $SDKNugetSource -AzureBuildingBranch $AzureBuildingBranch -IsAzurePipelineBuild $IsAzurePipelineBuild -BypassWarning
$builtX86 = $true
}
}
}
}

$msbuildPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
if ($IsAzurePipelineBuild) {
$nugetPath = "nuget.exe";
Expand All @@ -79,7 +95,7 @@ if (-not([string]::IsNullOrWhiteSpace($SDKNugetSource))) {
. build\Scripts\CertSignAndInstall.ps1

Try {
if (($BuildStep -ieq "all") -Or ($BuildStep -ieq "msix")) {
if (($BuildStep -ieq "all") -Or ($BuildStep -ieq "msix") -Or ($BuildStep -ieq "fullMsix")) {
$buildRing = "Dev"
$newPackageName = $null
$newPackageDisplayName = $null
Expand Down Expand Up @@ -140,6 +156,9 @@ Try {
}
$appxmanifest.Save($appxmanifestPath)

# This is needed for vcxproj
& $nugetPath restore

foreach ($platform in $env:Build_Platform.Split(",")) {
foreach ($configuration in $env:Build_Configuration.Split(",")) {
$appxPackageDir = (Join-Path $env:Build_RootDirectory "AppxPackages\$configuration")
Expand Down
Binary file not shown.
295 changes: 290 additions & 5 deletions DevHome.sln

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<Compile Include="$(MSBuildThisFileDirectory)\codeAnalysis\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
</PackageReference>
<Compile Condition="$(MSBuildProjectName) != 'DevHomeStub'" Include="$(MSBuildThisFileDirectory)\codeAnalysis\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
<Compile Condition="$(MSBuildProjectName) == 'DevHomeStub'" Include="$(MSBuildThisFileDirectory)\codeAnalysis\StubSuppressions.cs" Link="GlobalSuppressions.cs" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)\codeAnalysis\StyleCop.json" Link="StyleCop.json" />
</ItemGroup>
<!-- Needed for reverting back to pre-.NET 8 method of Host using the RID graph to determine assets -->
Expand All @@ -43,6 +44,6 @@
<UseRidGraph>true</UseRidGraph>
</PropertyGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Runtime.Loader.UseRidGraph" Value="true" />
<RuntimeHostConfigurationOption Include="System.Runtime.Loader.UseRidGraph" Value="true" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions HyperVExtension/BuildDevSetupAgentHelper.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off

powershell -ExecutionPolicy Unrestricted -NoLogo -NoProfile -File %~dp0\BuildDevSetupAgentHelper.ps1 %*

exit /b %ERRORLEVEL%
113 changes: 113 additions & 0 deletions HyperVExtension/BuildDevSetupAgentHelper.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
Param(
[string]$Platform = "x64",
[string]$Configuration = "debug",
[string]$VersionOfSDK,
[string]$SDKNugetSource,
[string]$Version,
[string]$BuildStep = "all",
[string]$AzureBuildingBranch = "main",
[bool]$IsAzurePipelineBuild = $false,
[switch]$BypassWarning = $false,
[switch]$Help = $false
)

$StartTime = Get-Date

if ($Help) {
Write-Host @"
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.
Syntax:
BuildDevSetupAgentHelper.cmd [options]
Description:
Builds DevSetupAgent.
Options:
-Platform <platform>
Only build the selected platform(s)
Example: -Platform x64
Example: -Platform "x86,x64,arm64"
-Configuration <configuration>
Only build the selected configuration(s)
Example: -Configuration Release
Example: -Configuration "Debug,Release"
-Help
Display this usage message.
"@
Exit
}

if (-not $BypassWarning) {
Write-Host @"
This script is not meant to be run directly. To build DevSetupAgent, please run the following from the root directory:
build -BuildStep "DevSetupAgent"
"@ -ForegroundColor RED
Exit
}

$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')

$ErrorActionPreference = "Stop"

$msbuildPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
if ($IsAzurePipelineBuild) {
$nugetPath = "nuget.exe";
} else {
$nugetPath = (Join-Path $env:Build_RootDirectory "build\NugetWrapper.cmd")
}

if (-not([string]::IsNullOrWhiteSpace($SDKNugetSource))) {
& $nugetPath sources add -Source $SDKNugetSource
}

Try {
$buildRing = "Dev"

if ($AzureBuildingBranch -ieq "release") {
$buildRing = "Stable"
} elseif ($AzureBuildingBranch -ieq "staging") {
$buildRing = "Canary"
}

Write-Host $nugetPath

& $nugetPath restore

$msbuildArgs = @(
("HyperVExtension\DevSetupAgent.sln"),
("/p:Platform="+$platform),
("/p:Configuration="+$configuration),
("/restore"),
("/binaryLogger:DevSetupAgent.$platform.$configuration.binlog"),
("/p:BuildRing=$buildRing")
)
if (-not([string]::IsNullOrWhiteSpace($VersionOfSDK))) {
$msbuildArgs += ("/p:DevHomeSDKVersion="+$env:sdk_version)
}

& $msbuildPath $msbuildArgs

$binariesOutputPath = (Join-Path $env:Build_RootDirectory "HyperVExtension\src\DevSetupAgent\bin\$Platform\$Configuration\net8.0-windows10.0.22000.0\win10-$Platform\*")
$zipOutputPath = (Join-Path $env:Build_RootDirectory "HyperVExtension\src\DevSetupAgent\bin\$Platform\$Configuration\DevSetupAgent_$Platform.zip")

Compress-Archive -Force -Path $binariesOutputPath $zipOutputPath
} Catch {
$formatString = "`n{0}`n`n{1}`n`n"
$fields = $_, $_.ScriptStackTrace
Write-Host ($formatString -f $fields) -ForegroundColor RED
Exit 1
}

$TotalTime = (Get-Date)-$StartTime
$TotalMinutes = [math]::Floor($TotalTime.TotalMinutes)
$TotalSeconds = [math]::Ceiling($TotalTime.TotalSeconds)

Write-Host @"
Total Running Time:
$TotalMinutes minutes and $TotalSeconds seconds
"@ -ForegroundColor CYAN
Loading

0 comments on commit 227009e

Please sign in to comment.