2019-04-04 11:33:38 +03:00
|
|
|
|
Set-StrictMode -Version latest
|
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
|
|
2019-04-05 16:37:42 +03:00
|
|
|
|
.\dev-env\windows\bin\dadew.ps1 install
|
|
|
|
|
.\dev-env\windows\bin\dadew.ps1 sync
|
|
|
|
|
.\dev-env\windows\bin\dadew.ps1 enable
|
|
|
|
|
|
2019-04-25 14:10:13 +03:00
|
|
|
|
if (!(Test-Path .\.bazelrc.local)) {
|
|
|
|
|
Set-Content -Path .\.bazelrc.local -Value 'build --config windows'
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-26 13:23:13 +03:00
|
|
|
|
$ARTIFACT_DIRS = if ("$env:BUILD_ARTIFACTSTAGINGDIRECTORY") { $env:BUILD_ARTIFACTSTAGINGDIRECTORY } else { Get-Location }
|
|
|
|
|
|
2019-11-22 17:24:08 +03:00
|
|
|
|
# If a previous build was forcefully terminated, then stack's lock file might
|
|
|
|
|
# not have been cleaned up properly leading to errors of the form
|
|
|
|
|
#
|
|
|
|
|
# user error (hTryLock: lock already exists: C:\Users\VssAdministrator\AppData\Roaming\stack\pantry\hackage\hackage-security-lock)
|
|
|
|
|
#
|
|
|
|
|
# The package cache might be corrupted and just removing the lock might lead to
|
|
|
|
|
# errors as below, so we just nuke the entire stack cache.
|
|
|
|
|
#
|
|
|
|
|
# Failed populating package index cache
|
|
|
|
|
# IncompletePayload 56726464 844
|
|
|
|
|
#
|
|
|
|
|
if (Test-Path -Path $env:appdata\stack\pantry\hackage\hackage-security-lock) {
|
|
|
|
|
Write-Output ">> Nuking stack directory"
|
|
|
|
|
Remove-Item -ErrorAction Continue -Force -Recurse -Path $env:appdata\stack
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-04 11:33:38 +03:00
|
|
|
|
function bazel() {
|
|
|
|
|
Write-Output ">> bazel $args"
|
|
|
|
|
$global:lastexitcode = 0
|
2019-04-11 15:26:55 +03:00
|
|
|
|
$backupErrorActionPreference = $script:ErrorActionPreference
|
|
|
|
|
$script:ErrorActionPreference = "Continue"
|
2019-04-18 15:04:23 +03:00
|
|
|
|
& bazel.exe @args 2>&1 | %{ "$_" }
|
2019-04-11 15:26:55 +03:00
|
|
|
|
$script:ErrorActionPreference = $backupErrorActionPreference
|
|
|
|
|
if ($global:lastexitcode -ne 0 -And $args[0] -ne "shutdown") {
|
2019-04-05 16:37:42 +03:00
|
|
|
|
Write-Output "<< bazel $args (failed, exit code: $global:lastexitcode)"
|
2019-04-04 11:33:38 +03:00
|
|
|
|
throw ("Bazel returned non-zero exit code: $global:lastexitcode")
|
|
|
|
|
}
|
2019-04-05 16:37:42 +03:00
|
|
|
|
Write-Output "<< bazel $args (ok)"
|
2019-04-04 11:33:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-10 15:13:30 +03:00
|
|
|
|
# ScalaCInvoker, a Bazel worker, created by rules_scala opens some of the bazel execroot's files,
|
|
|
|
|
# which later causes issues on Bazel init (source forest creation) on Windows. A shutdown closes workers,
|
|
|
|
|
# which is a workaround for this problem.
|
|
|
|
|
bazel shutdown
|
2019-04-17 23:37:35 +03:00
|
|
|
|
|
2019-11-13 14:47:07 +03:00
|
|
|
|
# Prefetch nodejs_dev_env to avoid permission denied errors on external/nodejs_dev_env/nodejs_dev_env/node.exe
|
|
|
|
|
# It isn’t clear where exactly those errors are coming from.
|
|
|
|
|
bazel fetch @nodejs_dev_env//...
|
|
|
|
|
|
2020-02-14 16:34:01 +03:00
|
|
|
|
bazel build //...
|
2019-04-04 11:33:38 +03:00
|
|
|
|
|
2019-05-10 15:13:30 +03:00
|
|
|
|
bazel shutdown
|
2019-04-11 15:26:55 +03:00
|
|
|
|
|
2019-06-28 13:55:31 +03:00
|
|
|
|
bazel test `-`-experimental_execution_log_file ${ARTIFACT_DIRS}/test_execution_windows.log //...
|