Determining version based on manifest file

This allowing Gradle to manage the versions and share them across both
build and runtime environments.
This commit is contained in:
Rob Greene 2018-03-02 12:47:06 -06:00
parent 47dc4038f3
commit 4541f38eb1
3 changed files with 14 additions and 3 deletions

View File

@ -19,7 +19,7 @@ ext {
}
mainClassName = 'com.webcodepro.applecommander.ui.AppleCommander'
version '1.3.6-BETA'
version "${version}"
// Disable default JAR creation
jar {
@ -33,7 +33,9 @@ tasks.withType(Javadoc) {
tasks.withType(Jar) {
manifest {
attributes 'Main-Class': 'com.webcodepro.applecommander.ui.AppleCommander'
}
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': version
}
from('LICENSE', 'CONTRIB', 'TODO', 'VERSIONS')
}

4
gradle.properties Normal file
View File

@ -0,0 +1,4 @@
# Universal AppleCommander version number. Used for:
# - Naming JAR file.
# - The build will insert this into a file that is read at run time as well.
version=1.4.0-BETA

View File

@ -40,8 +40,13 @@ import com.webcodepro.applecommander.util.TextBundle;
* @author Rob Greene
*/
public class AppleCommander {
public static final String VERSION = "1.4.0-BETA"; //$NON-NLS-1$
public static final String VERSION;
private static TextBundle textBundle = UiBundle.getInstance();
static {
VERSION = AppleCommander.class.getPackage().getImplementationVersion();
}
/**
* Launch AppleCommander.
*/