-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate-sysml
More file actions
executable file
·40 lines (35 loc) · 1.26 KB
/
validate-sysml
File metadata and controls
executable file
·40 lines (35 loc) · 1.26 KB
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
#!/bin/sh
# SysML v2 Validator wrapper script
# Validates .sysml files using the SysML v2 Pilot Implementation
set -e
# Find the validator installation directory (resolve symlinks)
SCRIPT="$0"
while [ -L "$SCRIPT" ]; do
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd)"
SCRIPT="$(readlink "$SCRIPT")"
[ "${SCRIPT%"${SCRIPT#?}"}" != "/" ] && SCRIPT="$SCRIPT_DIR/$SCRIPT"
done
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd)"
# Use the Maven build output relative to this script's repository location
if [ -f "$SCRIPT_DIR/target/sysmlv2-validator-1.0.0-SNAPSHOT.jar" ] &&
[ -d "$SCRIPT_DIR/target/sysml-download/sysml/sysml.library" ]; then
JAR="$SCRIPT_DIR/target/sysmlv2-validator-1.0.0-SNAPSHOT.jar"
SYSML_LIBRARY="$SCRIPT_DIR/target/sysml-download/sysml/sysml.library"
else
echo "Error: sysmlv2-validator not found." >&2
echo "Run these commands in $SCRIPT_DIR:" >&2
echo " mvn -Psetup-dependency initialize" >&2
echo " mvn package" >&2
exit 1
fi
# Find Java 21+
if command -v java >/dev/null 2>&1; then
JAVA=java
elif [ -x /usr/local/jdk-21/bin/java ]; then
JAVA=/usr/local/jdk-21/bin/java
else
echo "Error: Java 21+ not found" >&2
exit 1
fi
# Run validator
exec "$JAVA" -Dsysml.library="$SYSML_LIBRARY" -jar "$JAR" "$@"