faster -PspotlessIdeHook with configure-on-demand
- 主要言語
- Java
- スター
- 5.6k
- フォーク
- 559
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 43
説明
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.
コントリビューションガイド
調査の方向性
plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessExtensionImpl.java の参照された行から開始し、Gradle の設定評価とプロジェクト記述子がネストされた子プロジェクトをどのように表現しているかを確認します。現在の spotlessApply -PspotlessIdeHook の呼び出しを、先頭にコロンを付けた --configure-on-demand 形式の提案と比較します。IDE フックがルートと対象ファイルを所有するプロジェクトだけを、ネストされたプロジェクトも含めて評価すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- build-system
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100