-
Notifications
You must be signed in to change notification settings - Fork 50
/
build.ps1
30 lines (26 loc) · 947 Bytes
/
build.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
param(
[string] $port="8080",
[Switch] $cleanMetadata=$false,
[Switch] $cleanOnly=$false
)
if(-not (($strategyType -ne 0) -band(($strategyType -band ($strategyType - 1)) -eq 0))) { throw "Strategy type argument must be a power of 2!" }
$global:ProgressPreference='SilentlyContinue'
$BRANCH=$(git rev-parse --abbrev-ref HEAD)
$REPO="altmp/altv-docs"
$RAWGIT="https://raw.githubusercontent.com"
Invoke-WebRequest -UseBasicParsing -Headers @{"Cache-Control"="no-cache"} "$RAWGIT/$REPO/$BRANCH/build.psm1" -OutFile "./build.psm1" 2>&1 >$null
$global:ProgressPreference='Continue'
if($err -ne $null -or -not (Test-Path "./build.psm1")) { throw "Script build.psm1 not found." }
$module=Import-Module "./build.psm1" -PassThru -Force
$strategy=[StrategyType]::Core
try
{
$cwd=(Get-Location).Path
. $pipeline
}
finally
{
Set-Location $cwd
PostCleanup $cleanMetadata
Remove-Module $module
}