Skip to content

Commit

Permalink
Merge pull request #118 from ourPLCC/classpath
Browse files Browse the repository at this point in the history
refactor: use CLASSPATH
  • Loading branch information
StoneyJackson authored Apr 20, 2024
2 parents 62227a6 + ad0619b commit f773580
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
13 changes: 10 additions & 3 deletions src/parse
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ JACKSON_CORE="${LIBPLCC_LIB}/lib/jackson/jackson-core-${JACKSON_VERSION}.jar"
JACKSON_DATABIND="${LIBPLCC_LIB}/lib/jackson/jackson-databind-${JACKSON_VERSION}.jar"
CP="${JACKSON_ANNOTATIONS}:${JACKSON_CORE}:${JACKSON_DATABIND}"

if [[ -z "${CLASSPATH:-}" ]] ; then
CLASSPATH="./Java:${CP}"
export CLASSPATH
else
CLASSPATH="./Java:${CLASSPATH}:${CP}"
fi

[ -d Java ] || {
echo "Java directory missing" >&2
exit 1
Expand All @@ -33,10 +40,10 @@ then
esac
done

if ! java -cp "./Java:${CP}" ParseJsonAst "${ARGS[@]}" ; then
if ! java ParseJsonAst "${ARGS[@]}" ; then
>&2 echo "Did you forget to pass --json_ast to plccmk?"
exit 1
fi
else
java -cp ./Java Parse $*
else
java Parse $*
fi
9 changes: 7 additions & 2 deletions src/plccmk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ JACKSON_ANNOTATIONS="${LIBPLCC_LIB}/lib/jackson/jackson-annotations-${JACKSON_VE
JACKSON_CORE="${LIBPLCC_LIB}/lib/jackson/jackson-core-${JACKSON_VERSION}.jar"
JACKSON_DATABIND="${LIBPLCC_LIB}/lib/jackson/jackson-databind-${JACKSON_VERSION}.jar"
CP="${JACKSON_ANNOTATIONS}:${JACKSON_CORE}:${JACKSON_DATABIND}"
export CLASSPATH=".:${CP}"

if [[ -z "${CLASSPATH:-}" ]] ; then
CLASSPATH="${CP}"
export CLASSPATH
else
CLASSPATH="${CLASSPATH}:${CP}"
fi

if [ "$1" = "-c" ];
then
Expand Down Expand Up @@ -43,4 +49,3 @@ $PYTHON3 "$PLCC" $FILES || {
}

(cd ./Java ; javac *.java)

9 changes: 8 additions & 1 deletion src/rep
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

if [[ -z "${CLASSPATH:-}" ]] ; then
CLASSPATH="./Java"
export CLASSPATH
else
CLASSPATH="./Java:${CLASSPATH}"
fi

[ -d "${PWD}/Java" ] || {
echo "Java directory missing" >&2
exit 1
Expand All @@ -10,4 +17,4 @@
exit 2
}

java -cp ./Java Rep $*
java Rep $*
10 changes: 9 additions & 1 deletion src/scan
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

if [[ -z "${CLASSPATH:-}" ]] ; then
CLASSPATH="./Java"
export CLASSPATH
else
CLASSPATH="./Java:${CLASSPATH}"
fi


[ -d Java ] || {
echo "Java directory missing" >&2
exit 1
Expand All @@ -10,4 +18,4 @@
exit 2
}

java -cp ./Java Scan
java Scan

0 comments on commit f773580

Please sign in to comment.