2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 00:07:12 -07:00

Add snapshot shorthand for version numbers in project

This commit is contained in:
Geert Bevin 2023-10-10 11:56:39 -04:00
parent 76186c78db
commit e6be211d73

View file

@ -19,6 +19,7 @@ import java.util.*;
import java.util.regex.Pattern;
import static rife.bld.dependencies.Scope.runtime;
import static rife.bld.dependencies.VersionNumber.SNAPSHOT_QUALIFIER;
import static rife.tools.FileUtils.JAR_FILE_PATTERN;
/**
@ -684,6 +685,42 @@ public class BaseProject extends BuildExecutor {
return VersionNumber.parse(description);
}
/**
* Creates a new snapshot version instance.
*
* @param major the major component of the snapshot version number
* @return a newly created snapshot {@code VersionNumber} instance
* @since 1.7.4
*/
public VersionNumber snapshot(int major) {
return new VersionNumber(major, null, null, SNAPSHOT_QUALIFIER);
}
/**
* Creates a new snapshot version instance.
*
* @param major the major component of the snapshot version number
* @param minor the minor component of the snapshot version number
* @return a newly created snapshot {@code VersionNumber} instance
* @since 1.7.4
*/
public VersionNumber snapshot(int major, int minor) {
return new VersionNumber(major, minor, null, SNAPSHOT_QUALIFIER);
}
/**
* Creates a new snapshot version instance.
*
* @param major the major component of the snapshot version number
* @param minor the minor component of the snapshot version number
* @param revision the revision component of the snapshot version number
* @return a newly created snapshot {@code VersionNumber} instance
* @since 1.7.4
*/
public VersionNumber snapshot(int major, int minor, int revision) {
return new VersionNumber(major, minor, revision, SNAPSHOT_QUALIFIER);
}
/**
* Retrieves the dependency set for a particular scope, initializing it
* if it doesn't exist yet.