Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add means to check if version is a snapshot programatically. #749

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ abstract class VersionConfig extends BaseExtension {
return uncachedVersionProvider().get()
}

@Nested
VersionService.DecoratedVersion getDecoratedVersion() {
return versionProvider().get()
}

@Input
String getVersion() {
return versionProvider().map({ it.decoratedVersion }).get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,23 @@ public DecoratedVersion currentDecoratedVersion(VersionProperties versionPropert
}

return new DecoratedVersion(versionContext.getVersion().toString(), finalVersion, versionContext.getPosition(),
versionContext.getPreviousVersion().toString());
versionContext.getPreviousVersion().toString(), versionContext.isSnapshot());
}

public static class DecoratedVersion {
private final String undecoratedVersion;
private final String decoratedVersion;
private final ScmPosition position;
private final String previousVersion;
private final boolean snapshot;

public DecoratedVersion(String undecoratedVersion, String decoratedVersion, ScmPosition position,
String previousVersion) {
String previousVersion, boolean snapshot) {
this.undecoratedVersion = undecoratedVersion;
this.decoratedVersion = decoratedVersion;
this.position = position;
this.previousVersion = previousVersion;
this.snapshot = snapshot;
}

@Input
Expand All @@ -73,5 +75,10 @@ public final ScmPosition getPosition() {
public final String getPreviousVersion() {
return previousVersion;
}

@Input
public boolean isSnapshot() {
return snapshot;
}
}
}