split plugins to subpkgs and adapted launchers

procyon crashes without warning, asmtool8 packed in bad, old version
This commit is contained in:
Jiri 2023-03-18 09:19:14 +01:00
commit 3ddebd0508
4 changed files with 128 additions and 47 deletions

View file

@ -16,41 +16,35 @@ function warning() {
fi
}
# identify directory tree
JRD=`basename $0`
# the launcher is reused uder different name, hardcoding name
JRD=java-runtime-decompiler
CONF_HOME=$XDG_CONFIG_HOME
if [ "$CONF_HOME" = "" ] ; then
CONF_HOME=$HOME/.config/$JRD
else
CONF_HOME=$CONF_HOME/$JRD
fi
LOG_DIR=$CONF_HOME/logs
CONF_DIR=$CONF_HOME/conf
# create directory tree
PLUGIN_HOME=$CONF_HOME/plugins
PLUGIN_HOME_LEGACY=$CONF_HOME/plugins-legacy
mkdir -p $LOG_DIR
mkdir -p $CONF_DIR
mkdir -p $PLUGIN_HOME
: ${MAIN_CLASS:=org.jrd.backend.data.Main}
# set java and jvm arguments
export _prefer_jre=false
export _prefer_jre=false #although java moved compiler classes to jre, PREFERING jdk should not hurt
_set_java_home
set_jvm
# all dependencies must be on classpath
set_classpath java-runtime-decompiler rsyntaxtextarea byteman google-gson classpathless-compiler objectweb-asm
set_classpath java-runtime-decompiler rsyntaxtextarea byteman google-gson classpathless-compiler objectweb-asm java-diff-utils
CLASSPATH=$CLASSPATH:${JAVA_HOME}/lib/tools.jar
# set path to agent automatically
@ -60,16 +54,19 @@ AGENT_PREFIX="AGENT_PATH==="
AGENT_STRING=$AGENT_PREFIX$AGENT
# copy json wrappers information to home so the users can edit
CP_FILES="$(ls /etc/$JRD/plugins/*.json)"
for cpfile in $CP_FILES; do
FILE_NAME="$(basename -- $cpfile)"
if [ ! -e "$PLUGIN_HOME/$FILE_NAME" ]
then
cp $cpfile $PLUGIN_HOME
else
warning "Configuration files were not copied for $FILE_NAME - the existing configuration would be overwritten."
fi
done
if [ ! -e "$PLUGIN_HOME_LEGACY" -a -e "$PLUGIN_HOME" ] ; then
mv "$PLUGIN_HOME" "$PLUGIN_HOME_LEGACY"
echo "jrd no longer handles custom plugins for you. Your's "
echo "$PLUGIN_HOME was moved to $PLUGIN_HOME_LEGACY"
echo "You can play with custom plugins in $PLUGIN_HOME"
echo "but keep $PLUGIN_HOME_LEGACY created, so it is not renamed again"
fi
mkdir -p $PLUGIN_HOME_LEGACY
warning "jrd no longer handles custom plugins for you. Your's "
warning echo "$PLUGIN_HOME was moved to $PLUGIN_HOME_LEGACY"
warning "You can play with custom plugins in $PLUGIN_HOME"
warning "but keep $PLUGIN_HOME_LEGACY created, so it is not renamed again"
# create config file and add agent default path
touch $CONFIG_FILE
@ -92,4 +89,4 @@ else
fi
export FLAGS="$FLAGS -Djdk.attach.allowAttachSelf=true --add-exports jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED" # jdk11+ do not allow attach by default; jdk17 is hiding javap api
run "$@"
run "$@"