-
Notifications
You must be signed in to change notification settings - Fork 40
/
test.ps1
executable file
·50 lines (40 loc) · 1.45 KB
/
test.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#requires -version 4
[CmdletBinding(PositionalBinding = $false)]
param(
[Parameter()]
[string]$Command = 'default-build',
[Parameter(Mandatory = $true)]
[string]$RepoPath,
[switch]$NoBuild = $false,
[switch]$CI = $false,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$Arguments
)
$ErrorActionPreference = 'Stop'
# Don't not use this to not build first
if (-not $NoBuild) {
& git clean .\artifacts -xdf
& .\build.ps1 '-p:SkipTests=true'
}
[xml] $versionProps = Get-Content "$PSScriptRoot/version.props"
$channel = $versionProps.Project.PropertyGroup.KoreBuildChannel
$toolsSource = "$PSScriptRoot/artifacts/"
$latestFile = Join-Path $toolsSource "korebuild/channels/$channel/latest.txt"
$toolsVersion = $null
foreach ($line in Get-Content $latestFile) {
$toolsVersion = $line.Split(":")[1]
break
}
$packageDir = Join-Path $toolsSource "build\"
$Arguments += , "/p:InternalAspNetCoreSdkPackageVersion=$toolsVersion"
$Arguments += , "/p:DotNetRestoreSources=$packageDir"
foreach ($pkg in @(
"Internal.AspNetCore.Sdk",
"Internal.AspNetCore.SiteExtension.Sdk",
"Microsoft.AspNetCore.BuildTools.ApiCheck")) {
$pkgRoot = "${env:USERPROFILE}/.nuget/packages/$pkg/$toolsVersion/"
if (Test-Path $pkgRoot) {
Remove-Item -Recurse -Force $pkgRoot
}
}
& .\scripts\bootstrapper\run.ps1 -Update -Reinstall -Command $Command -Path $RepoPath -ToolsSource $toolsSource -Ci:$CI @Arguments