zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Consider to implement custom loading of extensions

Open mikir opened this issue 4 years ago • 1 comments

Zserio uses Java Extension Mechanism to load all extensions. This implies that all extensions must be available at Java classpath.

There are the following possibilities how to run external independent extension:

  1. To set variable java.ext.dirs in case of Java version <= 1.8.
java -Djava.ext.dirs=EXTENSION_DIR -jar zserio_core.jar
  1. To set Java classpath. In this case, -jar argument cannot be used.
java -cp zserio_core.jar:EXTENSION.JAR zserio.tools.ZserioTool

Both possibilities are not handy or intuitive.

Therefore, consider to implement custom loading of extensions by new zserio command line argument, e..g

java -jar zserio_core.jar -extension EXTENSION.JAR

This will allow considering implementation of custom extension command line arguments which can clash:

java -jar zserio_core.jar -extension zserio_cpp -withoutSourcesAmalgamation -extension zserio_cpp98 -withSourcesAmalgamation

mikir avatar Apr 17 '20 05:04 mikir

The similar problem is with options -withoutSqlCode, -withoutPubsubCode and -withoutServiceCode. These options do make sense only for code extensions not for documentation or XML extension. So, these options should be implemented by extensions not by core. However, it is not possible now to have the same options in different extensions. This will lead again to have flexible command line which allows the same options for multiple extensions:

java -jar zserio_core.jar -cpp -withoutSqlCode -java -withSqlCode -python -withoutSqlCode

The help could be improved as well. It will be more readable if options will be shown per extension to indicate if the corresponding option is supported by extension or not.

mikir avatar Nov 19 '20 07:11 mikir