Skip to content

Commit

Permalink
ci: Added option to specify MSBuild exe path to build.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
Giang Nguyen committed Mar 15, 2024
1 parent 3fe2a26 commit 30b64ac
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,36 @@ param (

[Parameter()]
[switch]
$Test
$Test,

[Parameter()]
$MsBuildExe
)

. "$PSScriptRoot\common.ps1"

$msBuildPath = Resolve-MsBuildPath -ErrorAction Stop
# if (!$MsBuildExe) {
# $MsBuildExe = Resolve-MsBuildPath -ErrorAction Stop
# }
# else {
# $MsBuildExe = $MsBuildExe
# }

$MsBuildExe ??= (Resolve-MsBuildPath -ErrorAction Stop)

if (!$msBuildPath) {
if (!$MsBuildExe) {
throw "Could not resolve MSBuild path."
}

$null = Test-Path $msBuildPath -ErrorAction Stop
$null = Test-Path $MsBuildExe -ErrorAction Stop

$solution = Join-Path -Path $PSScriptRoot -ChildPath 'TwinGet.sln'

if (-not $NoRestore) {
dotnet restore $solution
}

& $msBuildPath $solution -p:Configuration=$Configuration
& $MsBuildExe $solution -p:Configuration=$Configuration

if ($Test) {
dotnet test --configuration $Configuration --no-build --no-restore --logger "trx;verbosity=detailed;LogFileName=test_results.trx" $PSScriptRoot\TwinGet.sln
Expand Down

0 comments on commit 30b64ac

Please sign in to comment.