faster -PspotlessIdeHook with configure-on-demand
- Ngôn ngữ chính
- Java
- Star
- 5.6k
- Fork
- 559
- Merge trung bình
- 1 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 43
Mô tả
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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu trong plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessExtensionImpl.java tại các dòng được tham chiếu, sau đó xem xét cách việc đánh giá các thiết lập Gradle và các bộ mô tả project biểu diễn các project con lồng nhau. So sánh lệnh gọi spotlessApply -PspotlessIdeHook hiện tại với dạng được đề xuất có dấu hai chấm ở đầu và --configure-on-demand. Hoàn tất khi hook của IDE chỉ đánh giá root và project sở hữu tệp đích, bao gồm cả các project lồng nhau.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- build-system
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100