Skip to content

Instantly share code, notes, and snippets.

@MiloszKrajewski
Last active February 9, 2024 12:04
Show Gist options
  • Save MiloszKrajewski/e11643ab398f45fdb83f69ad552306a5 to your computer and use it in GitHub Desktop.
Save MiloszKrajewski/e11643ab398f45fdb83f69ad552306a5 to your computer and use it in GitHub Desktop.
Bootstrap script for ANTLR 4
$dp0 = $PSScriptRoot
$version = '4.13.1'
$jar = "antlr-$version-complete.jar"
$url = "https://www.antlr.org/download/$jar"
if (-not (Test-Path "$dp0/$jar")) {
Invoke-WebRequest -Uri $url -OutFile "$dp0/$jar"
}
$JAVA_PATH = $env:JAVA_HOME_11 ?? $env:JAVA_HOME
$JAVA_EXEC = ($null -eq $JAVA_PATH) ? "java" : "$JAVA_PATH\bin\java.exe"
Write-Host -ForegroundColor Green ">>> $JAVA_EXEC -jar $dp0/$jar $args"
& "$JAVA_EXEC" "-version"
& "$JAVA_EXEC" "-jar" "$dp0/$jar" $args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment