, Version
@Override
public int compareTo(JreVersion aItem)
{
- JreVersion tmpVer;
-
// Note the natural ordering is from oldest version to most recent version
- tmpVer = JreVersion.getBetterVersion(this, aItem);
+ var tmpVer = JreVersion.getBetterVersion(this, aItem);
if (tmpVer == aItem)
return -1;
if (tmpVer == this)
diff --git a/src/distMaker/platform/PlatformUtils.java b/src/distMaker/platform/PlatformUtils.java
index 45d65fd..53db47c 100644
--- a/src/distMaker/platform/PlatformUtils.java
+++ b/src/distMaker/platform/PlatformUtils.java
@@ -34,7 +34,7 @@ public class PlatformUtils
*/
public static String getAppLauncherFileName(Version aVersion)
{
- if (aVersion.getMajorVersion() == 0 && aVersion.getMinorVersion() == 0)
+ if (aVersion.major() == 0 && aVersion.minor() == 0)
return "appLauncher.jar";
return "appLauncher-" + aVersion + ".jar";
diff --git a/src/distMaker/utils/ParseUtils.java b/src/distMaker/utils/ParseUtils.java
index 2bdeb9d..bbcb79b 100644
--- a/src/distMaker/utils/ParseUtils.java
+++ b/src/distMaker/utils/ParseUtils.java
@@ -14,7 +14,7 @@ public class ParseUtils
*
* Processing of the configuration file should exit if the specified needed version is not met or the version string
* could not be parsed into major minor components.
- *
+ *
* @param aTargName
* The target component whose version will be evaluated. Current supported values are one of the following:
* [AppLauncher, DistMaker]
@@ -39,25 +39,22 @@ public class ParseUtils
int needMinorVer = Integer.MAX_VALUE;
try
{
- String[] versionArr;
-
- versionArr = aNeededVer.split("\\.");
+ var versionArr = aNeededVer.split("\\.");
if (versionArr.length >= 1)
needMajorVer = Integer.parseInt(versionArr[0]);
if (versionArr.length >= 2)
needMinorVer = Integer.parseInt(versionArr[1]);
}
- catch(Throwable aExp)
+ catch (Throwable aExp)
{
// Ignore just assume version components are whatever we managed to parse
}
- Version needVer;
- needVer = new PlainVersion(needMajorVer, needMinorVer, 0);
+ var needVer = new PlainVersion(needMajorVer, needMinorVer, 0);
// Exit the logic if the needVer > evalVer
- if (needVer.getMajorVersion() > evalVer.getMajorVersion())
+ if (needVer.major() > evalVer.major())
return true;
- if (needVer.getMajorVersion() == needVer.getMajorVersion() && needVer.getMinorVersion() > evalVer.getMinorVersion())
+ if (needVer.major() == needVer.major() && needVer.minor() > evalVer.minor())
return true;
return false;
diff --git a/template/launch4j/launch4j-3.12-linux.tgz b/template/launch4j/launch4j-3.14-linux-x64.tgz
similarity index 50%
rename from template/launch4j/launch4j-3.12-linux.tgz
rename to template/launch4j/launch4j-3.14-linux-x64.tgz
index 516f678..8989973 100644
Binary files a/template/launch4j/launch4j-3.12-linux.tgz and b/template/launch4j/launch4j-3.14-linux-x64.tgz differ
diff --git a/template/launch4j/launch4j-3.12-linux-x64.tgz b/template/launch4j/launch4j-3.14-linux.tgz
similarity index 53%
rename from template/launch4j/launch4j-3.12-linux-x64.tgz
rename to template/launch4j/launch4j-3.14-linux.tgz
index 074dd08..6306b77 100644
Binary files a/template/launch4j/launch4j-3.12-linux-x64.tgz and b/template/launch4j/launch4j-3.14-linux.tgz differ
diff --git a/template/launch4j/launch4j-3.12-macosx-x86.tgz b/template/launch4j/launch4j-3.14-macosx-x86.tgz
similarity index 51%
rename from template/launch4j/launch4j-3.12-macosx-x86.tgz
rename to template/launch4j/launch4j-3.14-macosx-x86.tgz
index f525c0f..fec5dc5 100644
Binary files a/template/launch4j/launch4j-3.12-macosx-x86.tgz and b/template/launch4j/launch4j-3.14-macosx-x86.tgz differ
diff --git a/tools/build.xml b/tools/build.xml
new file mode 100644
index 0000000..cd309b8
--- /dev/null
+++ b/tools/build.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+ DistMaker Library
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/buildRelease b/tools/buildRelease
index 679d339..7828e03 100755
--- a/tools/buildRelease
+++ b/tools/buildRelease
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
import argparse
import glob
@@ -7,40 +7,147 @@ import shutil
import signal
import subprocess
import sys
+import traceback
-# Define the libraries the application depends on
-libList = ['glum-1.3.7.jar', 'guava-18.0.jar', 'distMaker.jar']
+# Define the (baseline) version
+baseVersion = "0.61"
+
+# Define relevant base names
+appBaseName = 'DistMaker'
+libBaseName = 'distMaker'
+
+# Define the libraries DistMaker depends on
+libList = ['glum-2.0.0-RC3.jar', 'guava-18.0.jar']
+#libList += ['commons-compress-1.15.jar']
+
+# Define the paths to various executables
+antPath = '/spare/apache/apache-ant-1.10.8'
+antExe = os.path.join(antPath, 'bin/ant')
+jdkPath = '/spare/jdk-11'
+jarExe = os.path.join(jdkPath, 'bin/jar')
+javaExe = os.path.join(jdkPath, 'bin/java')
-def buildRelease(aVersion, aDoNotClean=False):
- """Method that builds a release of DistMaker. Upon sucessful execution, a
- tar.gz archive will be generated named: 'DistMaker-.tar.gz'. Note
- that releases of DistMaker aVersion 0.50 or later (2018May01+) will no longer
- include static JREs."""
+def checkForInstalledApps():
+ """Checks for installed applications needed to build a release of the
+ DistMaker library / package.
+ """
+ # Ensure required applications are installed
+ errList = []
+ for aPath in [antExe, jarExe, javaExe]:
+ if os.path.exists(aPath) == False:
+ errList.append('System executable is missing: ' + aPath)
+ if len(errList) > 0:
+ print('There are configuration errors with the environment or system.')
+# print('System Path:' + str(sys.path))
+ print('Please correct the following:')
+ for aError in errList:
+ print('\t' + aError)
+ sys.exit(0)
+
+
+def buildLibraryJar(aVersion):
+ """Method that builds the library jars. Upon sucessful execution
+ jar files (binary + source) will be generated.
+ """
+ # Note it is assumed that this is run from the path /proj/glum/
+
+ # Compile the java files
+ # Run the Ant script to build the class files
+ os.environ["JAVA_HOME"] = jdkPath
+ exeCmd = [antExe, '-f', 'tools/build.xml', 'compile']
+ retCode = subprocess.call(exeCmd)
+ if retCode != 0:
+ print('Failed while trying to run ant script. Exiting...\n')
+ sys.exit(0)
+ print('Finished executing Ant script.\n')
+
+ # Generate the manifest file
+ manifestFN = 'release/Manifest.txt'
+# buildManifestFile(manifestFN)
+
+ # Build the (bin) jar file
+ jarBinFN = 'release/' + libBaseName + '-' + aVersion + '.jar'
+# exeCmd = [jarExe, 'cfm', jarBinFN, manifestFN, '-C', 'bin/classes', '.']
+ exeCmd = [jarExe, 'cfM', jarBinFN, '-C', 'bin/classes', '.']
+ retCode = subprocess.call(exeCmd)
+ if retCode != 0:
+ print('Failed to build jar file: ' + jarBinFN)
+ exit(-1)
+
+ # Build the (src) jar file
+ jarSrcFN = 'release/' + libBaseName + '-' + aVersion + '-src.jar'
+ exeCmd = ['zip', '-D9q', '../' + jarSrcFN, '-r', '.']
+ retCode = subprocess.call(exeCmd, cwd='./src')
+ if retCode != 0:
+ print('Failed to build jar file: ' + jarSrcFN)
+ exit(-1)
+
+ # Remove the manifest file
+# os.remove(manifestFN)
+
+def buildRelease(aExtraTag, aDoNotClean=False):
+ """Method that builds a release of DistMaker. Upon sucessful execution
+ the following will be created:
+ - distMaker-.jar
+ - distMaker--src.jar
+ - DistMaker-.tar.gz
+ """
+ # Define the version to build
+ version = baseVersion
+ if aExtraTag != None:
+ if aExtraTag.startswith('.') or aExtraTag.startswith('-'):
+ version = baseVersion + aExtraTag
+ else:
+ version = baseVersion + '-' + aExtraTag
+
# Retrieve the install path
installPath = getInstallRoot()
installPath = os.path.dirname(installPath)
- # Determine the workPath
- workPath = os.path.join(installPath, 'release', 'DistMaker-' + aVersion)
- destFileGZ = os.path.join(installPath, 'release', 'DistMaker-' + aVersion + '.tar.gz')
+ # Define the paths of interest
+ jarBinPathFN = os.path.join(installPath, 'release', libBaseName + '-' + version + '.jar')
+ jarSrcPathFN = os.path.join(installPath, 'release', libBaseName + '-' + version + '-src.jar')
- # Bail if the work folder for which we compose the release already exists
+ workPath = os.path.join(installPath, 'release', appBaseName + '-' + version)
+ destFileGZ = os.path.join(installPath, 'release', appBaseName + '-' + version + '.tar.gz')
+
+ # Let the user know of the version we are building
+ print('Building ' + appBaseName + ' release ' + version + '...\n')
+
+ # Bail if there is a prior build
+ failMsgL = []
+ if os.path.exists(jarBinPathFN) == True:
+ failMsgL += ['Library binary file already exists: ' + jarBinPathFN]
+ if os.path.exists(jarSrcPathFN) == True:
+ failMsgL += ['Library source file already exists: ' + jarSrcPathFN]
if os.path.exists(workPath) == True:
- errPrintln('\tAborting DistMaker release build. Release folder already exists: ' + workPath)
+ failMsgL += ['Release folder already exists: ' + workPath]
+ if os.path.exists(destFileGZ) == True:
+ failMsgL += ['Release package already exists: ' + destFileGZ]
+
+ if len(failMsgL) > 0:
+ errPrintln('Aborting ' + appBaseName + ' release build. Reasons:')
+ for aFailMsg in failMsgL:
+ errPrintln(' - ' + aFailMsg)
+ errPrintln('')
exit(-1)
- # Bail if the release already exists
- if os.path.exists(destFileGZ) == True:
- errPrintln('\tAborting DistMaker release build. Release already exists. File: ' + destFileGZ)
+ # Build the library jars
+ buildLibraryJar(version)
+
+ # Confirm that we have built the class files properly by retrieving the
+ # version from the built application jar and comparing it to our version.
+ tmpVersion = getLibraryBinVersion(jarBinPathFN)
+ if tmpVersion != version:
+ print('Failure: Embedded release: {} Expected: {}\n\tAborting...'.format(tmpVersion, version))
exit(-1)
# Laydown the structure, and let the user know of the version we are building
- print('Building DistMaker release ' + aVersion + '...')
os.mkdir(workPath)
- # Copy the regular docs
+ # Copy the regular documents
dstPath = os.path.join(workPath, 'doc')
os.mkdir(dstPath)
for aFile in ['QuickStartGuide.pdf', 'ReadMe.txt']:
@@ -61,6 +168,9 @@ def buildRelease(aVersion, aDoNotClean=False):
srcPath = os.path.join(installPath, 'lib', aLib)
shutil.copy2(srcPath, dstPath)
+ # Copy the (newly) built DistMaker (binary) library
+ shutil.copy2(jarBinPathFN, dstPath)
+
# Copy the scripts
dstPath = os.path.join(workPath, 'script')
os.mkdir(dstPath)
@@ -73,7 +183,7 @@ def buildRelease(aVersion, aDoNotClean=False):
os.makedirs(dstPath + '/apple')
os.makedirs(dstPath + '/background')
os.makedirs(dstPath + '/launch4j')
- for aFile in ['appLauncher.jar', 'JreCatalog.txt', 'apple/.DS_Store.template', 'apple/JavaAppLauncher', 'background/background.png', 'launch4j/launch4j-3.12-linux-x64.tgz', 'launch4j/launch4j-3.12-linux.tgz', 'launch4j/launch4j-3.12-macosx-x86.tgz']:
+ for aFile in ['appLauncher.jar', 'JreCatalog.txt', 'apple/.DS_Store.template', 'apple/JavaAppLauncher', 'background/background.png', 'launch4j/launch4j-3.14-linux-x64.tgz', 'launch4j/launch4j-3.14-linux.tgz', 'launch4j/launch4j-3.14-macosx-x86.tgz']:
srcPath = os.path.join(installPath, 'template', aFile)
shutil.copy2(srcPath, dstPath + '/' + aFile)
@@ -88,7 +198,10 @@ def buildRelease(aVersion, aDoNotClean=False):
if aDoNotClean == False:
shutil.rmtree(workPath)
- print('DistMaker release ' + aVersion + ' built.')
+ print(appBaseName + ' release ' + version + ' built. Assets:')
+ for aFilePath in [jarBinPathFN, jarSrcPathFN, destFileGZ]:
+ print(' - ' + aFilePath)
+ print('')
def errPrintln(aMessage=''):
@@ -98,31 +211,20 @@ def errPrintln(aMessage=''):
sys.stderr.write(aMessage + '\n')
-def getDistMakerVersion():
- """Method that will return the version of the distMaker.jar file that resides
- in the library path. The version of the DistMaker release is defined by the
- value associated with the disMaker.jar file. Any failures will result in the
- abrupt exit of this script."""
- # Retrieve the install path
- installPath = getInstallRoot()
- installPath = os.path.dirname(installPath)
-
- # Check for distMaker.jar library prerequisite
- testPath = os.path.join(installPath, 'lib', 'distMaker.jar')
- if os.path.exists(testPath) == False:
- errPrintln('\tAborting DistMaker release build. The file ' + testPath + ' does not exist.')
- errPrintln('\tPlease run the buildDistMakerBin.jardesc from your workspace.')
- exit(-1)
-
+def getLibraryBinVersion(aJarBinPath):
+ """Method that will return the version of the specified binary jar file.
+ The binary jar file will be queried (package distmaker.DistApp) and the
+ output will be parsed. Any failures will result in the abrupt exit of this
+ script."""
try:
- cpStr = ':lib/'.join(libList)
- cpStr = 'lib/' + cpStr
- exeCmd = ['java', '-cp', cpStr, 'distMaker.DistApp', '--version']
+ cpStr = aJarBinPath
+ cpStr += ':lib/' + ':lib/'.join(libList)
+ exeCmd = [javaExe, '-cp', cpStr, 'distMaker.DistApp', '--version']
output = subprocess.check_output(exeCmd).decode('utf-8')
- version = output.split()[1]
+ version = output.split()[1].strip()
return version
- except:
- errPrintln('\tPlease run the buildDistMakerBin.jardesc from your workspace.')
+ except Exception as aExp:
+ traceback.print_exc()
exit(-1)
@@ -144,19 +246,20 @@ if __name__ == "__main__":
# Logic to capture Ctrl-C and bail
signal.signal(signal.SIGINT, handleSignal)
- # Require python version 2.7 or later
- targVer = (2, 7)
+ # Require python version 3.6 or later
+ targVer = (3, 6)
if sys.version_info < targVer:
print('The installed version of python is too old. Please upgrade.')
print(' Current version: ' + '.'.join(str(i) for i in sys.version_info))
print(' Require version: ' + '.'.join(str(i) for i in targVer))
sys.exit(-1)
- tmpDescr = 'Utility to build a DistMaker release\n'
+ tmpDescr = 'Utility to build a ' + appBaseName + ' release\n'
parser = argparse.ArgumentParser(prefix_chars='-', description=tmpDescr, add_help=False, fromfile_prefix_chars='@')
parser.add_argument('--help', '-h', help='Show this help message and exit.', action='help')
parser.add_argument('--doNotClean', default=False, action='store_true', help='Do NOT remove temporary work folder created while generating release.')
parser.add_argument('--doFullBuild', default=False, action='store_true', help='Force a full build of the main jar file. (Unsupported action)')
+ parser.add_argument('--extraTag', default=None, action='store', help='Specify an extra tag for to the version.')
# Intercept any request for a help message and bail
argv = sys.argv;
@@ -168,12 +271,11 @@ if __name__ == "__main__":
parser.formatter_class.max_help_position = 50
args = parser.parse_args()
- # Get the version of DistMaker we are building
- version = getDistMakerVersion()
- print('DistMaker version: ' + version)
-
# TODO: Finish this functionality
if args.doFullBuild == True:
print("Unsupported action: [--doFullBuild]. Skipping...")
- buildRelease(version, args.doNotClean)
+ # Ensure required applications are installed
+ checkForInstalledApps()
+
+ buildRelease(args.extraTag, args.doNotClean)