Add in build versioning for beta testing
This commit is contained in:
parent
fcf784639d
commit
288d526020
4 changed files with 46 additions and 16 deletions
|
@ -13,4 +13,5 @@ Changelog
|
|||
- Fix issue with themes with invalid font's causing halts
|
||||
- Change themes to use zip files for more control. Existing themes will no longer work
|
||||
- New logging system, logs are now stored in baseDir/Logs/ with an option to only keep X days worth (defaults to 7)
|
||||
- Enter button now edits/adds an account in the Account tab
|
||||
- Enter button now edits/adds an account in the Account tab
|
||||
- Add in build versioning for beta testing
|
|
@ -59,7 +59,7 @@ To get started with the code and plug in your own data, you need to create a src
|
|||
|
||||
public class Constants {
|
||||
|
||||
public static final LauncherVersion VERSION = new LauncherVersion(1, 0, 0, 0);
|
||||
public static final LauncherVersion VERSION = new LauncherVersion(1, 0, 0, 0, 1);
|
||||
public static final String API_BASE_URL = "";
|
||||
public static final String PASTE_CHECK_URL = "";
|
||||
public static final String PASTE_API_URL = "";
|
||||
|
@ -92,9 +92,9 @@ To make the data the Launcher needs you will need to figure out your own server
|
|||
|
||||
Starting with version 3.2.1.0 a new versioning system was put into place. It works off the following:
|
||||
|
||||
Reserved.Major.Minor.Revision
|
||||
Reserved.Major.Minor.Revision.Build
|
||||
|
||||
So for 3.2.1.0 the major number is 2 and minor number is 1 and revision number is 0. Reserved is used as a base, only incremented on complete rewrites.
|
||||
So for 3.2.1.0.0 the major number is 2 and minor number is 1 and revision number is 0. Reserved is used as a base, only incremented on complete rewrites. The build number is optional and should be 0 on releases.
|
||||
|
||||
Major should be incremented when large changes/features are made.
|
||||
|
||||
|
@ -102,6 +102,8 @@ Minor should be incremented when small changes/features are made.
|
|||
|
||||
Revision should be incremented when there are no new features and only contains bug fixes for the previous minor.
|
||||
|
||||
Build is used for beta releases allowing you to have higher version numbers but force users to update when the real release comes.
|
||||
|
||||
### Need Help/Have Questions?
|
||||
|
||||
If you have questions please don't hesitate to [contact us](http://www.atlauncher.com/contactus/)
|
||||
|
|
|
@ -25,12 +25,14 @@ public class LauncherVersion {
|
|||
private int major;
|
||||
private int minor;
|
||||
private int revision;
|
||||
private int build = 0;
|
||||
|
||||
public LauncherVersion(int reserved, int major, int minor, int revision) {
|
||||
public LauncherVersion(int reserved, int major, int minor, int revision, int build) {
|
||||
this.reserved = reserved;
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.revision = revision;
|
||||
this.build = build;
|
||||
}
|
||||
|
||||
public int getReserved() {
|
||||
|
@ -49,6 +51,10 @@ public class LauncherVersion {
|
|||
return this.revision;
|
||||
}
|
||||
|
||||
public int getBuild() {
|
||||
return this.build;
|
||||
}
|
||||
|
||||
public boolean needsUpdate(LauncherVersion toThis) {
|
||||
if (this.reserved > toThis.getReserved()) {
|
||||
return false;
|
||||
|
@ -70,7 +76,9 @@ public class LauncherVersion {
|
|||
} else if (this.revision < toThis.getRevision()) {
|
||||
return true;
|
||||
} else {
|
||||
return false; // Same version so doesn't need to update
|
||||
return (toThis.getBuild() == 0 ? this.build != 0 : this.build < toThis.getBuild()); // Only
|
||||
// update if the build is lower unless the version to update to is a 0 build which means it's
|
||||
// official and should be updated to
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +87,11 @@ public class LauncherVersion {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%d.%d.%d.%d", this.reserved, this.major, this.minor, this.revision);
|
||||
if (this.build == 0) {
|
||||
return String.format("%d.%d.%d.%d", this.reserved, this.major, this.minor, this.revision);
|
||||
} else {
|
||||
return String.format("%d.%d.%d.%d Beta %d", this.reserved, this.major, this.minor, this.revision, this
|
||||
.build);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,47 +20,61 @@ public class TestLauncherVersion {
|
|||
// Test same version - no update
|
||||
assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision())));
|
||||
Constants.VERSION.getRevision(), Constants.VERSION.getBuild())));
|
||||
|
||||
// Test older Reserved - launcher had a big update
|
||||
assertTrue(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved() + 1, Constants.VERSION.getMajor(), Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision())));
|
||||
Constants.VERSION.getRevision(), Constants.VERSION.getBuild())));
|
||||
|
||||
// Test older Major - launcher had major update
|
||||
assertTrue(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor() + 1, Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision())));
|
||||
Constants.VERSION.getRevision(), Constants.VERSION.getBuild())));
|
||||
|
||||
// Test older Minor - launcher had minor update
|
||||
assertTrue(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor() + 1,
|
||||
Constants.VERSION.getRevision())));
|
||||
Constants.VERSION.getRevision(), Constants.VERSION.getBuild())));
|
||||
|
||||
// Test older Revision - launcher had a bug fix
|
||||
assertTrue(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision() + 1)));
|
||||
Constants.VERSION.getRevision() + 1, Constants.VERSION.getBuild())));
|
||||
|
||||
// Test older Build - launcher had a beta update
|
||||
assertTrue(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision(), Constants.VERSION.getBuild() + 1)));
|
||||
|
||||
// Test user has a beta build but the real build comes out
|
||||
LauncherVersion testBuild = new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision(), Constants.VERSION.getBuild() + 6);
|
||||
LauncherVersion actualBuild = new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision(), 0);
|
||||
assertTrue(testBuild.needsUpdate(actualBuild));
|
||||
|
||||
// Test newer Reserved - launcher dev version
|
||||
assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved() - 1, Constants.VERSION.getMajor(), Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision())));
|
||||
Constants.VERSION.getRevision(), Constants.VERSION.getBuild())));
|
||||
|
||||
// Test newer Major - launcher dev version
|
||||
assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor() - 1, Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision())));
|
||||
Constants.VERSION.getRevision(), Constants.VERSION.getBuild())));
|
||||
|
||||
// Test newer Minor - launcher dev version
|
||||
assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor() - 1,
|
||||
Constants.VERSION.getRevision())));
|
||||
Constants.VERSION.getRevision(), Constants.VERSION.getBuild())));
|
||||
|
||||
// Test newer Revision - launcher dev version
|
||||
assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION
|
||||
.getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor(),
|
||||
Constants.VERSION.getRevision() - 1)));
|
||||
Constants.VERSION.getRevision() - 1, Constants.VERSION.getBuild())));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue