diffplug / diffplug/spotless

Implement a global non-maven download policy

Aperta
#1,669 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Java
Stelle
5.6k
Fork
559
Merge medio
1g 14h
PR unite (30g)
43

Descrizione

The Spotless core has few dependencies. During plugin configuration, we add maven dependencies which get downloaded in the normal way.

There are some exceptions where we use non-maven formatters. For example

- npm-based formatters which grab dependencies using npm install
- eclipse-based formatters which download dependencies from p2 update sites
- #1629
- #1658

There are other cases we are considering, such as

- #1663
- #674
- #673

A very good thing about Spotless is that it "just works". Search the docs for the kind of formatter you want, specify that formatter, and you're ready to go. But for these non-maven-based formatters, I think it's fair for users to be surprised that their build plugin is making network requests and caching artifacts outside of the expected maven channel.

I'm proposing something like this:

```gradle
spotless {
allowDownloadsFrom('https://download.eclipse.org/')
```

As a user, it would work like this:

- I add Eclipse CDT to my spotless configuration
- I get an error like so

> Eclipse CDT is not available in a maven repository, it must be downloaded from a p2 repository. You can allow this download by adding a block like this to your spotless configuration
>
> spotless {
>   allowDownloadsFrom('https://download.eclipse.org/')
>
> This will allow Spotless to download p2 metadata and jar files using the Equo p2 client. The metadata and jar files will be cached at ~/.equo. Alternatively, you can specify an alternative p2 update site, and add that URL to your allowDownloadsFrom.

It's not a perfect mechanism, it relies on our own diligence in making sure that PR's such as the Rome PR follow the rules about checking the allowed URLs. But it takes away the surprise, which is important. Users might choose a different formatter based on whether it is available through a standard maven proxy or not.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con il percorso di configurazione del plugin di Spotless core e con i casi di formatter non-Maven descritti in #1629 e #1658. Esamina la policy allowDownloadsFrom proposta insieme agli esempi di npm install e p2 update-site; il lavoro è completo quando i download non-Maven sono esplicitamente consentiti oppure, in caso contrario, rifiutati con indicazioni operative, e tutti i casi considerati sono coperti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
build-system, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.