-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix
generateDiff
task when target version doesn't exist (#671)
* rename task generateDiff -> diffTarget make diffTarget a TargetVersionConsumingTask * add lazilyDiffTarget task * make DiffTargetTask and DecompileTargetVineflowerTask implement UnpickVersionsMatchConsumingTask as they depend on other UnpickVersionsMatchConsumingTasks give lazilyDiffTarget a custom type that implements UnpickVersionsMatchConsumingTask make lazilyDiffTarget's conditional dependency use a provider to make it lazier use try-with-resources when writing the output in DiffDirectoriesTask --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
960316d
commit c37469f
Showing
6 changed files
with
79 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
buildSrc/src/main/java/quilt/internal/task/diff/DiffTargetTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package quilt.internal.task.diff; | ||
|
||
import org.gradle.api.tasks.TaskContainer; | ||
import quilt.internal.plugin.TargetDiffPlugin; | ||
|
||
public abstract class DiffTargetTask extends DiffDirectoriesTask implements UnpickVersionsMatchConsumingTask { | ||
/** | ||
* {@linkplain TaskContainer#register Registered} by {@link TargetDiffPlugin}. | ||
*/ | ||
public static final String DIFF_TARGET_TASK_NAME = "diffTarget"; | ||
} |
25 changes: 25 additions & 0 deletions
25
buildSrc/src/main/java/quilt/internal/task/diff/LazilyDiffTargetTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package quilt.internal.task.diff; | ||
|
||
import org.gradle.api.DefaultTask; | ||
import org.gradle.api.provider.Provider; | ||
import org.gradle.api.tasks.TaskContainer; | ||
import quilt.internal.constants.Groups; | ||
import quilt.internal.plugin.TargetDiffPlugin; | ||
|
||
public abstract class LazilyDiffTargetTask extends DefaultTask implements UnpickVersionsMatchConsumingTask { | ||
/** | ||
* {@linkplain TaskContainer#register Registered} by {@link TargetDiffPlugin}. | ||
* <p> | ||
* A wrapper for {@value DiffTargetTask#DIFF_TARGET_TASK_NAME} that conditionally depends on | ||
* {@value DiffTargetTask#DIFF_TARGET_TASK_NAME} only if its | ||
* {@link TargetVersionConsumingTask#getTargetVersion() targetVersion} {@link Provider#isPresent() isPresent}. | ||
* <p> | ||
* This is a hack to prevent unnecessarily generating sources using local mappings when | ||
* {@link TargetVersionConsumingTask#getTargetVersion() targetVersion} isn't present. | ||
*/ | ||
public static final String LAZILY_DIFF_TARGET_TASK_NAME = "lazilyDiffTarget"; | ||
|
||
public LazilyDiffTargetTask() { | ||
this.setGroup(Groups.DIFF); | ||
} | ||
} |
c37469f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No difference between head and target.