hilla icon indicating copy to clipboard operation
hilla copied to clipboard

Reduce plugin configuration complexity

Open Lodin opened this issue 3 years ago • 1 comments
trafficstars

For now, we have some unnecessary complexity for the plugin configuration. E.g., if you want to change the default configuration of NonnullPlugin, you write something like the following Maven configuration:

<plugin>
    <groupId>dev.hilla</groupId>
    <artifactId>hilla-maven-plugin</artifactId>
    <version>${hilla.version}</version>
    <configuration>
        <parser>
            <use>
                <plugin>
                    <name>dev.hilla.parser.plugins.nonnull.NonnullPlugin</name>
                    <configuration implementation="dev.hilla.parser.plugins.nonnull.NonnullPluginConfig">
                        <use>
                            <annotation>
                                <name>com.example.application.Nonnull</name>
                                <makesNullable>false</makesNullable>
                                <score>30</score>
                            </annotation>
                        </use>
                    </configuration>
                </plugin>
            </use>
        </parser>
    </configuration>
    ...
</plugin>

Here you see the usage of the <use> tag. However, if you want to disable some default plugin, you still need to write something like that:

<plugin>
    <groupId>dev.hilla</groupId>
    <artifactId>hilla-maven-plugin</artifactId>
    <version>${hilla.version}</version>
    <configuration>
        <parser>
            <disable>
                <plugin>
                    <name>dev.hilla.parser.plugins.nonnull.NonnullPlugin</name>
                </plugin>
            </disable>
        </parser>
    </configuration>
    ...
</plugin>

I assume it is unnecessary and should be simplified to the following:

<plugin>
    <groupId>dev.hilla</groupId>
    <artifactId>hilla-maven-plugin</artifactId>
    <version>${hilla.version}</version>
    <configuration>
        <parser>
            <disable>
                <plugin>dev.hilla.parser.plugins.nonnull.NonnullPlugin</plugin>
            </disable>
        </parser>
    </configuration>
    ...
</plugin>

We need to use only the specific ID (class name) to disable an element instead of using the fully capable class that allows user to specify configuration etc.

P.S. It also affects everything that extends dev.hilla.parser.utils.ConfigList from parser-jvm-utils package.

Lodin avatar Sep 07 '22 21:09 Lodin

I would suggest that the configuration complexity should be completely moved somewhere else so that we would have a configuration mechanism that would work the same also with Gradle.

Legioth avatar Sep 28 '22 06:09 Legioth