Skip to content

Commit

Permalink
Add snapshot shorthand for version numbers in project
Browse files Browse the repository at this point in the history
  • Loading branch information
gbevin committed Oct 10, 2023
1 parent 76186c7 commit e6be211
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/main/java/rife/bld/BaseProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;

/**
Expand Down Expand Up @@ -684,6 +685,42 @@ public VersionNumber version(String description) {
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.
Expand Down

0 comments on commit e6be211

Please sign in to comment.