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 1 commit 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 @@ -224,6 +224,11 @@
return uncachedVersionProvider().get()
}

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

Check warning on line 229 in src/main/groovy/pl/allegro/tech/build/axion/release/domain/VersionConfig.groovy

View check run for this annotation

Codecov / codecov/patch

src/main/groovy/pl/allegro/tech/build/axion/release/domain/VersionConfig.groovy#L229

Added line #L229 was not covered by tests
}

@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 @@
}

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 String getPreviousVersion() {
return previousVersion;
}

@Input
public boolean isSnapshot() {
return snapshot;

Check warning on line 81 in src/main/java/pl/allegro/tech/build/axion/release/domain/VersionService.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/pl/allegro/tech/build/axion/release/domain/VersionService.java#L81

Added line #L81 was not covered by tests
}
}
}