
pl.allegro.tech.build.axion.release.domain.PredefinedSnapshotCreator.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of axion-release-plugin Show documentation
Show all versions of axion-release-plugin Show documentation
Gradle release and version management plugin
The newest version!
package pl.allegro.tech.build.axion.release.domain
import pl.allegro.tech.build.axion.release.domain.properties.VersionProperties
import pl.allegro.tech.build.axion.release.domain.scm.ScmPosition
import java.util.function.BiFunction
enum PredefinedSnapshotCreator {
SIMPLE('simple', { String version, ScmPosition position ->
return "-SNAPSHOT";
}),
UNCLEAN('unclean', { String version, ScmPosition position ->
if (!position.isClean) {
return "-unclean-SNAPSHOT"
} else {
return "-SNAPSHOT";
};
}),
private final String type
final VersionProperties.Creator snapshotCreator
private PredefinedSnapshotCreator(String type, Closure c) {
this.type = type
this.snapshotCreator = c
}
static VersionProperties.Creator snapshotCreatorFor(String type) {
PredefinedSnapshotCreator creator = values().find { it.type == type }
if (creator == null) {
throw new IllegalArgumentException("There is no predefined snapshot creator with $type type. " +
"You can choose from: ${values().collect { it.type }}");
}
return creator.snapshotCreator
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy