43 lines
1.6 KiB
Bash
Executable File
43 lines
1.6 KiB
Bash
Executable File
#!/bin/zsh
|
||
# 手动重启编辑器(实验室版):
|
||
# ./viewpanel/run.sh # 打开默认样例
|
||
# ./viewpanel/run.sh <某个.spine> # 打开指定工程
|
||
#
|
||
# 做的事:①杀掉已在跑的实例(避免同时开好几个 Spine 窗口)
|
||
# ②源码比 class 新就自动 rebuild ③启动编辑器(后台,日志 /tmp/spineview.log)
|
||
set -e
|
||
|
||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||
ROOT="$(cd "$HERE/.." && pwd)"
|
||
JX="$ROOT/tools/jdk8u504-b01/Contents/Home/bin/java"
|
||
ASM="$ROOT/tools/asm/asm.jar:$ROOT/tools/asm/asm-tree.jar"
|
||
PAY="$ROOT/spine-lab/home/Library/Application Support/Spine/updates/3.8.99.orig"
|
||
PROJ="${1:-$ROOT/sample/3.8.99/3899.spine}"
|
||
LOG="${SPINEVIEW_LOG:-/tmp/spineview.log}"
|
||
|
||
echo "== 关掉旧实例"
|
||
pkill -f com.spineview.Launcher 2>/dev/null || true
|
||
sleep 1
|
||
|
||
if [[ ! -f "$HERE/build/classes/com/spineview/Launcher.class" ]] \
|
||
|| [[ -n "$(find "$HERE/src" -newer "$HERE/build/classes/com/spineview/Launcher.class" 2>/dev/null | head -1)" ]]; then
|
||
echo "== 源码有更新,先编译"
|
||
JAVA_HOME="${JAVA_HOME:-/tmp/jdk-17.0.20.1+1/Contents/Home}" "$HERE/build.sh" | tail -3
|
||
fi
|
||
|
||
echo "== 启动(工程 $PROJ)"
|
||
nohup "$JX" \
|
||
"-javaagent:$ROOT/tools/agent/view-agent.jar" \
|
||
-DSpineJava=1 \
|
||
"-Dspine.payload=$PAY" \
|
||
"-Dspine.resources=$HERE/resources" \
|
||
"-Dspine.compat=$HERE/compat-classes" \
|
||
"-Dspine.classes=$HERE/build/classes" \
|
||
"-Duser.home=$ROOT/spine-lab/home" \
|
||
-cp "$HERE/build/classes:$ASM" com.spineview.Launcher "$PROJ" \
|
||
>"$LOG" 2>&1 &
|
||
|
||
sleep 2
|
||
echo "== 已启动:pid $(pgrep -f com.spineview.Launcher | tr '\n' ' ')"
|
||
echo " 日志:tail -f $LOG"
|