Skip to content

Commit

Permalink
Cache artifact version in QuiltMavenQuiltflowerSource
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed May 28, 2023
1 parent cba8845 commit 823b1ef
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public final class QuiltMavenQuiltflowerSource implements QuiltflowerSource {
private static final String SNAPSHOT_VERSION_XPATH = "/metadata/versioning/snapshotVersions/snapshotVersion[not(classifier) and extension=\"jar\"]/value/text()";
private final Provider<String> version;
private final Repository repository;
private @Nullable String artifactVersion;

public QuiltMavenQuiltflowerSource(Provider<String> version, Repository repository) {
this.version = version;
Expand All @@ -49,6 +50,14 @@ public String getProvidedVersion() {

@Override
public String getResolvedVersion() throws IOException {
if (artifactVersion == null) {
return artifactVersion = computeArtifactVersion();
}

return artifactVersion;
}

private String computeArtifactVersion() throws IOException {
String baseVersion = version.get();

if (baseVersion.endsWith("-SNAPSHOT")) {
Expand Down

0 comments on commit 823b1ef

Please sign in to comment.