faster -PspotlessIdeHook with configure-on-demand
- Langage dominant
- Java
- Étoiles
- 5.6k
- Forks
- 559
- Merge moyen
- 1 j 14 h
- PR mergées (30 j)
- 43
Description
Right now, the IDE hook works like this
```
spotlessApply -PspotlessIdeHook=${ABSOLUTE_PATH_TO_FILE}
```
But for large multiproject projects we could make it significantly faster with (note the leading colon)
```
:spotlessApply -PspotlessIdeHook=${ABSOLUTE_PATH_TO_FILE} --configure-on-demand
```
but only if we modified this code https://github.com/diffplug/spotless/blob/48723eb15b3e6b0ada0841bd78e4dd271af9507f/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessExtensionImpl.java#L54-L56
by adding something like:
```java
if (project == rootProject) {
String ideHookPath = (String) project.property(IdeHook.PROPERTY);
project.gradle.settingsEvaluated { settings ->
// the code below works only for root with children, needs to also handle children with children
ProjectDescriptor owningProject = null;
ProjectDescriptor rootDescriptor = settings.rootProject
for (ProjectDescriptor child : rootDescriptor.children) {
if (ideHookPath.startsWith(child.projectDir.absolutePath)) {
owningProject = child;
}
}
if (owningProject != null) {
project.evaluationDependsOn(owningProject.path)
}
}
}
```
In this way we can avoid evaluating all the `spotlessApply` tasks and instead only evaluate the root project and, if necessary, the project which contains the file in question.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez dans plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessExtensionImpl.java, aux lignes référencées, puis examinez comment l’évaluation des paramètres Gradle et les descripteurs de projet représentent les projets enfants imbriqués. Comparez l’invocation actuelle de spotlessApply -PspotlessIdeHook avec la forme proposée comportant un deux-points initial et --configure-on-demand. Le travail est terminé lorsque le hook de l’IDE n’évalue que le projet racine et le projet auquel appartient le fichier cible, y compris les projets imbriqués.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- build-system
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100