-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_preprocessor.ps1
More file actions
37 lines (27 loc) · 852 Bytes
/
run_preprocessor.ps1
File metadata and controls
37 lines (27 loc) · 852 Bytes
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
param(
[Parameter(Mandatory = $true)][string]$PrName,
[switch]$StripSingleLineComments
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$projectRoot = (Get-Location).Path
$pre = Join-Path $projectRoot "scripts\PS\CodexPreprocessor.ps1"
$argList = @(
"-ExecutionPolicy","Bypass",
"-File",$pre,
"-ProjectFolder",$projectRoot,
"-Task",$PrName
)
if ($StripSingleLineComments) {
$argList += "-StripSingleLineComments"
}
& powershell @argList
if ($LASTEXITCODE -ne 0) {
throw "Preprocessor failed"
}
$tmp = Join-Path $projectRoot "tmp"
New-Item -ItemType Directory -Force -Path $tmp | Out-Null
$zip = Join-Path $tmp ($PrName + ".zip")
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path (Join-Path $projectRoot ($PrName + "\*")) -DestinationPath $zip -Force
Write-Host "ZIP:" $zip