@@ -26,7 +26,6 @@ function Print-Usage() {
26
26
Write-Host " if it is set, will be used."
27
27
}
28
28
29
- function Global :prompt {" (dogfood) PS $PWD > " }
30
29
31
30
if ($help -or (($command -ne $null ) -and ($command.Contains (" /help" ) -or $command.Contains (" /?" )))) {
32
31
Print- Usage
@@ -38,10 +37,10 @@ try {
38
37
. $PSScriptroot \restore-toolset.ps1
39
38
40
39
$env: SDK_REPO_ROOT = $RepoRoot
41
-
42
40
$TestDotnetRoot = Join-Path $ArtifactsDir " bin\redist\$configuration \dotnet"
43
-
44
41
$testDotnetVersion = (Get-Childitem - Directory " $TestDotnetRoot \sdk" )[-1 ].Name
42
+
43
+ $env: TestDotnetSdkHash = Get-Content - Path (Join-Path $TestDotnetRoot " sdk\$testDotnetVersion \.version" ) - TotalCount 1
45
44
$env: DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR = Join-Path $TestDotnetRoot " sdk\$testDotnetVersion \Sdks"
46
45
$env: MicrosoftNETBuildExtensionsTargets = Join-Path $ArtifactsDir " bin\$configuration \Sdks\Microsoft.NET.Build.Extensions\msbuildExtensions\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.targets"
47
46
@@ -52,13 +51,25 @@ try {
52
51
# Locally built SDK package version is Major.Minor.0-dev, which won't be available.
53
52
$env: BuildWithNetFrameworkHostedCompiler = $false
54
53
54
+ # Prompt
55
+ function global :prompt {
56
+ # Run command agains $env:SDK_REPO_ROOT to see if there are any changes
57
+ $testDotnetSdkCurrentHash = git - C $env: SDK_REPO_ROOT rev- parse HEAD
58
+ $hasGitChanges = (git status - C $env: SDK_REPO_ROOT -- porcelain) -ne " " -or $testDotnetSdkCurrentHash -ne $env: TestDotnetSdkHash
59
+ if ($hasGitChanges ) {
60
+ " $ ( [char ]0x1b ) [0;35m(dotnet dogfood *)$ ( [char ]0x1b ) [0m $PWD > "
61
+ } else {
62
+ " $ ( [char ]0x1b ) [0;35m(dotnet dogfood)$ ( [char ]0x1b ) [0m $PWD > "
63
+ }
64
+ }
65
+
55
66
if ($command -eq $null -and $env: DOTNET_SDK_DOGFOOD_SHELL -ne $null ) {
56
67
$command = , $env: DOTNET_SDK_DOGFOOD_SHELL
57
68
}
58
69
59
70
if ($command -ne $null ) {
60
71
$Host.UI.RawUI.WindowTitle = " SDK Test ($RepoRoot ) ($configuration )"
61
- & $command [0 ] $command [1 .. ($command.Length - 1 )]
72
+ & $command [0 ] $command [1 .. ($command.Length - 1 )]
62
73
}
63
74
}
64
75
catch {
0 commit comments