zserio
zserio copied to clipboard
Consider to implement custom loading of extensions
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:
- To set variable
java.ext.dirs
in case of Java version <= 1.8.
java -Djava.ext.dirs=EXTENSION_DIR -jar zserio_core.jar
- 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
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.