lgrignon/jsweet-maven-plugin

Differentiate default value and user values

Opened this issue · 0 comments

JSweet v2 should support passing parameters to the transpiler defined within jsweetconfig.json. These parameters will be overridden by local parameters, such as command-line parameters and Maven pom.xml parameters.

The problem with the current implementation is that the Maven plugin forces the transpiler's options with the Mojo's parameters. However these parameters can be user-defined or default values as specified in the Mojo (in the annotations). Problem is: default values should not override the values defined in jsweetconfig.json. Only user-defined values should. As a consequence, we need a way to differentiate user-defined values and default values in the Mojo, in order to avoid overriding pre-existing JSweet configuration with default values. From a brief search, I did not find a way to do this with the Maven MOJO API (??).

If this feature does not exist, we need to change our strategy: all default values should be null, and we should force the value of the option only when the value is not null (i.e. user-defined). It is actually better because the Maven plugin will then rely on JSweet transpiler default values, which will probably be more consistent with other launchers.

The same issue needs to be handled by other launchers (the command line launcher is easy because JSAP provides an API to know if the option is user-defined or not).