diffplug / diffplug/spotless

Support build agnostic external plugin SPI with dynamic lookups

Offen
#2,288 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Java
Sterne
5.6k
Forks
559
Ø Merge
1 T. 14 Std.
Gemergte PRs (30 T.)
43

Beschreibung

Currently adding a [custom plugin](https://github.com/diffplug/spotless/blob/main/CONTRIBUTING.md#how-to-add-a-new-plugin-for-a-build-system) requires adaptations to the Maven/Gradle plugin as
a) [FormatterStepFactory](https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/FormatterStepFactory.java#L22) and
b) [FormatterFactory](https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/FormatterFactory.java#L52) or [FormatExtension](https://github.com/diffplug/spotless/blob/b2a2cbb8b6026397c0adb8cb8b3571e399276f9b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FormatExtension.java#L79)

are
a) not build system agnostic and
b) are not dynamically looked up

It would be beneficial to have a build-agnostic plugin SPI which allows to
a) load dependencies
b) pass configuration
c) dynamically lookup services from classpath (e.g. with https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ServiceLoader.html)

For Maven the mechanism for adding additional classes to the plugin classpath is via [plugin dependencies](https://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_.3Cdependencies.3E_Tag). I hope that Gradle provides something similar.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit dem Lesen von CONTRIBUTING.md und den darin verlinkten Einstiegspunkten FormatterStepFactory, FormatterFactory und FormatExtension in den Maven- und Gradle-Plugins. Vergleiche, wie jedes derzeit benutzerdefinierte Plugins hinzufügt, und untersuche die im Issue genannten Verweise auf ServiceLoader und Maven-Plugin-Abhängigkeiten. Als abgeschlossen gilt die Arbeit, wenn ein build-agnostisches SPI Abhängigkeiten laden, Konfiguration akzeptieren und für beide Integrationen externe Services dynamisch erkennen kann.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
build-system, tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.