Skip to content

Commit 62ad63c

Browse files
committed
better wrapper scripts, get rid of executables
1 parent f8a8c53 commit 62ad63c

6 files changed

Lines changed: 73 additions & 5 deletions

File tree

Wurstpack/wurstscript/grill.exe

-1.56 MB
Binary file not shown.

Wurstpack/wurstscript/wurstscript

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
RUNTIME="$HOME/.wurst/wurst-runtime/bin/java"
5+
6+
# Resolve script dir (absolute)
7+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
JAR="$DIR/wurst-compiler/wurstscript.jar"
10+
if [[ ! -f "$JAR" ]]; then
11+
JAR="$DIR/../wurst-compiler/wurstscript.jar"
12+
fi
13+
14+
if [[ ! -f "$JAR" ]]; then
15+
echo "[wurstscript] ERROR: Missing jar. Searched:"
16+
echo " $DIR/wurst-compiler/wurstscript.jar"
17+
echo " $DIR/../wurst-compiler/wurstscript.jar"
18+
exit 2
19+
fi
20+
21+
if [[ ! -x "$RUNTIME" ]]; then
22+
echo "[wurstscript] ERROR: Bundled runtime not found or not executable at:"
23+
echo " $RUNTIME"
24+
echo "Please reinstall wurstscript via the VSCode extension."
25+
exit 3
26+
fi
27+
28+
exec "$RUNTIME" -jar "$JAR" "$@"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@echo off
2+
setlocal EnableExtensions
3+
4+
rem ---- shared slim runtime ----
5+
set "RUNTIME=%USERPROFILE%\.wurst\wurst-runtime\bin\java.exe"
6+
7+
rem script directory (trailing backslash)
8+
set "DIR=%~dp0"
9+
10+
if not exist "%RUNTIME%" (
11+
echo [wurstscript] ERROR: Runtime not found:
12+
echo(%RUNTIME%
13+
echo Reinstall Wurstscript via the VSCode extension.
14+
exit /b 1
15+
)
16+
17+
rem ---- fixed jar location(s), no wildcards ----
18+
set "JAR=%DIR%wurst-compiler\wurstscript.jar"
19+
if not exist "%JAR%" set "JAR=%DIR%..\wurst-compiler\wurstscript.jar"
20+
if not exist "%JAR%" (
21+
echo [wurstscript] ERROR: Missing jar:
22+
echo(%DIR%wurst-compiler\wurstscript.jar
23+
echo or
24+
echo(%DIR%..\wurst-compiler\wurstscript.jar
25+
exit /b 1
26+
)
27+
28+
rem Optional JVM flags via env var, e.g. set WURST_JAVA_OPTS=-Xmx1g
29+
"%RUNTIME%" %WURST_JAVA_OPTS% -jar "%JAR%" %*
30+
endlocal
-1.56 MB
Binary file not shown.

de.peeeq.wurstscript/build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ buildscript {
88

99
plugins {
1010
id 'java'
11-
id 'application'
1211
id 'antlr'
1312
id 'eclipse'
1413
id 'idea'
@@ -27,9 +26,7 @@ import org.eclipse.jgit.lib.ObjectId
2726

2827
import java.util.regex.Pattern
2928

30-
application {
31-
mainClass = "de.peeeq.wurstio.Main"
32-
}
29+
ext.mainClassName = "de.peeeq.wurstio.Main"
3330

3431
version = "1.8.1.0"
3532

@@ -229,7 +226,9 @@ shadowJar {
229226
archiveBaseName.set('wurstscript')
230227
archiveClassifier.set('')
231228
archiveVersion.set('')
232-
manifest { attributes 'Main-Class': application.mainClass.get() }
229+
manifest {
230+
attributes 'Main-Class': mainClassName
231+
}
233232
}
234233

235234
def fatJar = shadowJar.archiveFile.map { it.asFile }

de.peeeq.wurstscript/deploy.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,17 @@ tasks.register("assembleSlimCompilerDist", Copy) {
167167
}
168168
}
169169

170+
tasks.named("assembleSlimCompilerDist", Copy) { t ->
171+
if (os.isWindows()) {
172+
from("../Wurstpack/wurstscript/wurstscript.cmd") { into(".") }
173+
} else {
174+
from("../Wurstpack/wurstscript/wurstscript") {
175+
into(".")
176+
fileMode = 0755
177+
}
178+
}
179+
}
180+
170181
// 4a) Package ZIP on Windows
171182
tasks.register("packageSlimCompilerDistZip", Zip) {
172183
description = "Packages slim dist as a ZIP archive (Windows)."

0 commit comments

Comments
 (0)