Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dev Environments feature into main from feature branch #2346

Merged
merged 32 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
970a573
add initial SDK changes (#2209)
bbonaby Feb 9, 2024
482d529
Merge branch 'main' into microsoftfeature/dev-environments
bbonaby Feb 9, 2024
36dd23d
Add UX code from private ADO branch to public feature branch (#2241)
bbonaby Feb 9, 2024
2e9c120
Move Hyper-V extension code from private repository to public dev env…
bbonaby Feb 12, 2024
ca94296
Merge branch 'main' into microsoftfeature/dev-environments
bbonaby Feb 13, 2024
eec8889
Initial implementation of IComputeSystem::ApplyConfiguration for Hype…
sshilov7 Feb 14, 2024
2f4186a
Add environments to experimentation (#2260)
bbonaby Feb 15, 2024
cef8480
Add PowerShell script and a helper class to deploy DevSetupAgent serv…
sshilov7 Feb 16, 2024
caa2a92
Hyper-V extension: Add "Ask for VM credentials" and "Wait for logon" …
sshilov7 Feb 25, 2024
1c4127c
Changes to make DevSetupEngine work with .NET 8 (#2308)
sshilov7 Feb 27, 2024
4eed026
Merge branch 'main' into microsoftfeature/dev-environments
bbonaby Feb 29, 2024
8353204
Build DevSetupAgent separately from the main Dev Home solution and ad…
sshilov7 Feb 29, 2024
d0634aa
Merge branch 'microsoftfeature/dev-environments' of https://github.co…
bbonaby Feb 29, 2024
c4c71cf
Update setup target flow to allow for configuration of a dev environm…
bbonaby Mar 1, 2024
1bb1d15
update dev environments feature branch with latest idl changes (#2334)
bbonaby Mar 1, 2024
031c4d2
Update environments page UX (#2320)
bbonaby Mar 4, 2024
075af1f
Update build scripts to build DevSetupAgent in Azure official build. …
sshilov7 Mar 4, 2024
4ec9e02
Merge branch 'main' into microsoftfeature/dev-environments
bbonaby Mar 4, 2024
532e26a
Merge branch 'main' into microsoftfeature/dev-environments
bbonaby Mar 4, 2024
5ad9d74
update dev home to use new SDK version and other projects to use win …
bbonaby Mar 4, 2024
a72e7ea
Fix PS DevSetupAgent deployment script. (#2345)
sshilov7 Mar 5, 2024
3271804
Merge branch 'main' into microsoftfeature/dev-environments
bbonaby Mar 5, 2024
60a9139
remove classes that don't need to be added
bbonaby Mar 5, 2024
e0c0a00
Change all tabs to spaces
krschau Mar 5, 2024
94d116b
Update tools directory to use crlf
krschau Mar 5, 2024
79baa9d
Update HyperVExtension directory to use crlf
krschau Mar 5, 2024
7d8c2ee
Update common/Environments directory to use crlf
krschau Mar 5, 2024
15af544
Update more in common directory to use crlf
krschau Mar 5, 2024
0c11642
[Hyper-V extension]: Fixes for DevSetupEngine registration, Configure…
sshilov7 Mar 6, 2024
b2bb209
remove s that was added from a previous commit causing build to fail
bbonaby Mar 6, 2024
433ebe9
fix tests for build
bbonaby Mar 6, 2024
fe542ed
update malformed configuration string to allow arm64 to build
bbonaby Mar 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 18 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
281 changes: 281 additions & 0 deletions DevHome.sln

Large diffs are not rendered by default.

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%
109 changes: 109 additions & 0 deletions HyperVExtension/BuildDevSetupAgentHelper.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
Param(
[string]$Platform = "x64",
[string]$Configuration = "debug",
[string]$VersionOfSDK,
[string]$SDKNugetSource,
[string]$Version,
[string]$BuildStep = "all",
[string]$AzureBuildingBranch = "main",
[switch]$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 @"
Copy link
Collaborator

@krschau krschau Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an FYI (I looked this up recently) powershell scripts conventionally have 4 space indents (not blocking)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Number of spaces per intent is a religion, we just need to agree what we believe in 😄. The existing Build.ps1 and BuildSDKHelper.ps1 have 2 space intents. This script follows what we already have.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We updated Build.ps1 recently to have 4, but I understand we're quite inconsistent now. This was more of a "we came to a conclusion that we'll try to follow going forward" note. (Not that everyone's happy with that conclusion 😄 )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's 4 now, then this one can be changed. I have no problem with any reasonable number (I worked for a company where it was 3).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 is simply ridiculous :) I'm the one that doesn't like 4 spaces, but I concede it's become the standard.

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"
}

$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\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
Loading