-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathantlrworks.cmd
executable file
·52 lines (41 loc) · 1.42 KB
/
antlrworks.cmd
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
::/*#! 2> /dev/null #
@ 2>/dev/null # 2>nul & echo off & goto BOF #
export SIREUM_HOME=$(cd -P "$(dirname "$0")/../.." && pwd -P) #
exec "${SIREUM_HOME}/bin/sireum" slang run "$0" "$@" #
:BOF
setlocal
set SIREUM_HOME=%~dp0..\..
"%SIREUM_HOME%\bin\sireum.bat" slang run %0 %*
exit /B %errorlevel%
::!#*/
// #Sireum
import org.sireum._
val version = "1.5.6"
val homeBin = Os.slashDir.up.canon
val ver = homeBin / ".antlrworks.jar.ver"
if (ver.exists && ver.read == version) {
Os.exit(0)
}
val bundle = s"antlrworks.jar"
val url = s"https://github.com/sireum/antlrworks/releases/download/$version/$bundle"
val cacheDir: Os.Path = Os.env("SIREUM_CACHE") match {
case Some(dir) => Os.path(dir)
case _ => Os.home / "Downloads" / "sireum"
}
val cache: Os.Path = cacheDir / bundle
if (!cache.exists) {
cache.up.mkdirAll()
println(s"ANTLRWorks v$version ...")
cache.downloadFrom(url)
println()
}
cache.copyOverTo(homeBin / bundle)
val java: Os.Path = Os.kind match {
case Os.Kind.Mac => homeBin / "mac" / "java" / "bin" / "java"
case Os.Kind.Linux => homeBin / "linux" / "java" / "bin" / "java"
case Os.Kind.LinuxArm => homeBin / "linux" / "arm" / "java" / "bin" / "java"
case Os.Kind.Win => homeBin / "win" / "java" / "bin" / "java.exe"
case _ => Os.path("java")
}
println(s"To launch ANTLRWorks: $java -jar ${homeBin / bundle}")
ver.writeOver(version)