From 260072425b496405abc11c418974a0ff8543eb12 Mon Sep 17 00:00:00 2001 From: miozune Date: Thu, 23 Nov 2023 23:16:20 +0900 Subject: [PATCH] Exclude -snapshot releases from updateDependencies task --- .../retrofuturagradle/modutils/UpdateDependenciesTask.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/com/gtnewhorizons/retrofuturagradle/modutils/UpdateDependenciesTask.java b/plugin/src/main/java/com/gtnewhorizons/retrofuturagradle/modutils/UpdateDependenciesTask.java index 31fb2305..a91679d6 100644 --- a/plugin/src/main/java/com/gtnewhorizons/retrofuturagradle/modutils/UpdateDependenciesTask.java +++ b/plugin/src/main/java/com/gtnewhorizons/retrofuturagradle/modutils/UpdateDependenciesTask.java @@ -8,6 +8,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -28,6 +29,8 @@ public class UpdateDependenciesTask extends DefaultTask { private static final Pattern GTNH_DEPENDENCY = Pattern .compile("com\\.github\\.GTNewHorizons:([^:]+):([^:'\"]+)(:[^:'\"]+)?"); + private static final List TAG_SUFFIX_DENYLIST = Arrays.asList("-pre", "-snapshot"); + @Inject public UpdateDependenciesTask() { this.getOutputs().upToDateWhen(Specs.SATISFIES_NONE); @@ -70,7 +73,7 @@ public void updateDependencies() throws IOException { if (currentVersionIndex == -1 && versionCandidate.equals(currentVersion)) { currentVersionIndex = i; } - if (latestVersionIndex == -1 && !versionCandidate.endsWith("-pre")) { + if (latestVersionIndex == -1 && TAG_SUFFIX_DENYLIST.stream().noneMatch(versionCandidate::endsWith)) { latestVersionIndex = i; } }