Changes associated with version 0.61:

[1] Updated to Java version 11.
[2] Updated to Python 3.6.
[3] Updated Glum library version 2.0.0-RC3.
[4] Updated Launch4J to version 3.14.
[5] Updated DistMaker build scripts.
This commit is contained in:
Norberto Lopez
2022-11-18 12:00:00 +00:00
committed by lopeznr1
parent a66a5d0f29
commit 6c565557ca
28 changed files with 755 additions and 564 deletions

View File

@@ -2,16 +2,7 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="script"/> <classpathentry kind="src" path="script"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/glum-1.3.7.jar" sourcepath="lib/glum-1.3.7-src.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/guava-18.0.jar" sourcepath="lib/guava-18.0-sources.jar"> <classpathentry kind="lib" path="lib/guava-18.0.jar" sourcepath="lib/guava-18.0-sources.jar">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="module" value="true"/>
@@ -23,5 +14,6 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="lib/miglayout-3.7.2-swing.jar"/> <classpathentry kind="lib" path="lib/miglayout-3.7.2-swing.jar"/>
<classpathentry kind="lib" path="lib/glum-2.0.0-RC3.jar" sourcepath="lib/glum-2.0.0-RC3-src.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@@ -1,15 +1,18 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false

View File

@@ -0,0 +1,63 @@
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_NobesFormat-2019Aug
formatter_settings_version=16
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=true
sp_cleanup.format_source_code=false
sp_cleanup.format_source_code_changes_only=false
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=true
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_modifiers=false
sp_cleanup.remove_redundant_semicolons=false
sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=false
sp_cleanup.remove_unused_imports=false
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_lambda=true
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true

Binary file not shown.

Binary file not shown.

BIN
lib/glum-2.0.0-RC3-src.jar Normal file

Binary file not shown.

BIN
lib/glum-2.0.0-RC3.jar Normal file

Binary file not shown.

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env python3
import copy import copy
import math import math
@@ -224,9 +224,8 @@ def buildDistTree(aBuildPath, aRootPath, aArgs, aJreNode):
# Write out the PkgInfo file # Write out the PkgInfo file
dstPath = os.path.join(aRootPath, appName + '.app', 'Contents', "PkgInfo") dstPath = os.path.join(aRootPath, appName + '.app', 'Contents', "PkgInfo")
f = open(dstPath, 'wb') with open(dstPath, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
f.write('APPL????') tmpFO.write('APPL????')
f.close()
# Define the payloadPath for where to store the appLauncher # Define the payloadPath for where to store the appLauncher
payloadPath = os.path.join(aRootPath, appName + '.app', 'Contents') payloadPath = os.path.join(aRootPath, appName + '.app', 'Contents')
@@ -284,14 +283,14 @@ def buildDistTree(aBuildPath, aRootPath, aArgs, aJreNode):
# Update the .DS_Store file to reflect the new volume name # Update the .DS_Store file to reflect the new volume name
srcPath = os.path.join(aRootPath, '.DS_Store') srcPath = os.path.join(aRootPath, '.DS_Store')
classPath = appInstallRoot + '/lib/glum-1.3.7.jar:' + appInstallRoot + '/lib/distMaker.jar:' + appInstallRoot + '/lib/guava-18.0.jar' classPath = appInstallRoot + '/lib/glum-2.0.0-RC3.jar:' + appInstallRoot + '/lib/distMaker-0.61.jar:' + appInstallRoot + '/lib/guava-18.0.jar'
cmd = ['java', '-cp', classPath, 'dsstore.MainApp', srcPath, appName] cmd = ['java', '-cp', classPath, 'dsstore.MainApp', srcPath, appName]
proc = miscUtils.executeAndLog(cmd, "\t\tdsstore.MainApp: ") proc = miscUtils.executeAndLog(cmd, "\t\tdsstore.MainApp: ")
if proc.returncode != 0: if proc.returncode != 0:
print('\tError: Failed to update .DS_Store. Return code: ' + str(proc.returncode)) print('\tError: Failed to update .DS_Store. Return code: ' + str(proc.returncode))
def buildPListInfo(aDestFile, aArgs, aJreNode): def buildPListInfo(aDstFile, aArgs, aJreNode):
"""Method that will construct and populate the Info.plist file. This file """Method that will construct and populate the Info.plist file. This file
defines the attributes associated with the (Apple) app.""" defines the attributes associated with the (Apple) app."""
# Retrieve vars of interest # Retrieve vars of interest
@@ -299,84 +298,82 @@ def buildPListInfo(aDestFile, aArgs, aJreNode):
if aArgs.icnsFile != None: if aArgs.icnsFile != None:
icnsStr = os.path.basename(aArgs.icnsFile) icnsStr = os.path.basename(aArgs.icnsFile)
f = open(aDestFile, 'wb') with open(aDstFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
# writeln(f, 0, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>') # writeln(tmpFO, 0, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>')
writeln(f, 0, '<?xml version="1.0" ?>') writeln(tmpFO, 0, '<?xml version="1.0" ?>')
writeln(f, 0, '<plist version="1.0">') writeln(tmpFO, 0, '<plist version="1.0">')
writeln(f, 1, '<dict>') writeln(tmpFO, 1, '<dict>')
tupL = [] tupL = []
tupL.append(('CFBundleDevelopmentRegion', 'English')) tupL.append(('CFBundleDevelopmentRegion', 'English'))
tupL.append(('CFBundleExecutable', 'JavaAppLauncher')) tupL.append(('CFBundleExecutable', 'JavaAppLauncher'))
tupL.append(('CFBundleGetInfoString', aArgs.company)) tupL.append(('CFBundleGetInfoString', aArgs.company))
tupL.append(('CFBundleInfoDictionaryVersion', 6.0)) tupL.append(('CFBundleInfoDictionaryVersion', 6.0))
tupL.append(('CFBundleIconFile', icnsStr)) tupL.append(('CFBundleIconFile', icnsStr))
tupL.append(('CFBundleIdentifier', aArgs.name.lower())) tupL.append(('CFBundleIdentifier', aArgs.name.lower()))
tupL.append(('CFBundleDisplayName', aArgs.name)) tupL.append(('CFBundleDisplayName', aArgs.name))
tupL.append(('CFBundleName', aArgs.name)) tupL.append(('CFBundleName', aArgs.name))
tupL.append(('CFBundlePackageType', 'APPL')) tupL.append(('CFBundlePackageType', 'APPL'))
tupL.append(('CFBundleSignature', '????')) tupL.append(('CFBundleSignature', '????'))
tupL.append(('CFBundleVersion', aArgs.version)) tupL.append(('CFBundleVersion', aArgs.version))
tupL.append(('NSHighResolutionCapable', 'true')) tupL.append(('NSHighResolutionCapable', 'true'))
tupL.append(('NSHumanReadableCopyright', '')) tupL.append(('NSHumanReadableCopyright', ''))
# Define the JVM that is to be uesd # Define the JVM that is to be uesd
if aJreNode != None: if aJreNode != None:
jrePath = jreUtils.getBasePathFor(aJreNode) jrePath = jreUtils.getBasePathFor(aJreNode)
tupL.append(('JVMRuntime', jrePath)) tupL.append(('JVMRuntime', jrePath))
else: else:
# tupL.append(('JVMVersion', '1.7+')) # tupL.append(('JVMVersion', '1.7+'))
raise Exception('Support for utilizing the system JRE has not been added yet.') raise Exception('Support for utilizing the system JRE has not been added yet.')
# Define the main entry point (AppLauncher) and the working directory # Define the main entry point (AppLauncher) and the working directory
tupL.append(('JVMMainClassName', 'appLauncher.AppLauncher')) tupL.append(('JVMMainClassName', 'appLauncher.AppLauncher'))
cwdPath = os.path.join('$APP_ROOT', 'Contents', 'app') cwdPath = os.path.join('$APP_ROOT', 'Contents', 'app')
tupL.append(('WorkingDirectory', cwdPath)) tupL.append(('WorkingDirectory', cwdPath))
# Application configuration # Application configuration
for (key, val) in tupL: for (key, val) in tupL:
writeln(f, 2, '<key>' + key + '</key>') writeln(tmpFO, 2, '<key>' + key + '</key>')
writeln(f, 2, '<string>' + str(val) + '</string>') writeln(tmpFO, 2, '<string>' + str(val) + '</string>')
# JVM options # JVM options
jvmArgs = list(aArgs.jvmArgs) jvmArgs = list(aArgs.jvmArgs)
if any(aStr.startswith('-Dapple.laf.useScreenMenuBar') == False for aStr in jvmArgs) == True: if any(aStr.startswith('-Dapple.laf.useScreenMenuBar') == False for aStr in jvmArgs) == True:
jvmArgs.append('-Dapple.laf.useScreenMenuBar=true') jvmArgs.append('-Dapple.laf.useScreenMenuBar=true')
if any(aStr.startswith('-Dcom.apple.macos.useScreenMenuBar') == False for aStr in jvmArgs) == True: if any(aStr.startswith('-Dcom.apple.macos.useScreenMenuBar') == False for aStr in jvmArgs) == True:
jvmArgs.append('-Dcom.apple.macos.useScreenMenuBar=true') jvmArgs.append('-Dcom.apple.macos.useScreenMenuBar=true')
if any(aStr.startswith('-Dcom.apple.macos.use-file-dialog-packages') == False for aStr in jvmArgs) == True: if any(aStr.startswith('-Dcom.apple.macos.use-file-dialog-packages') == False for aStr in jvmArgs) == True:
jvmArgs.append('-Dcom.apple.macos.use-file-dialog-packages=true') jvmArgs.append('-Dcom.apple.macos.use-file-dialog-packages=true')
jvmArgs.append('-Dcom.apple.mrj.application.apple.menu.about.name=' + aArgs.name) jvmArgs.append('-Dcom.apple.mrj.application.apple.menu.about.name=' + aArgs.name)
jvmArgs.append('-Dapple.awt.application.name=' + aArgs.name) jvmArgs.append('-Dapple.awt.application.name=' + aArgs.name)
jvmArgs.append('-Djava.system.class.loader=appLauncher.RootClassLoader') jvmArgs.append('-Djava.system.class.loader=appLauncher.RootClassLoader')
# if icnsStr != None: # if icnsStr != None:
# jvmArgs.append('-Xdock:icon=Contents/Resources/' + icnsStr) # jvmArgs.append('-Xdock:icon=Contents/Resources/' + icnsStr)
writeln(f, 2, '<key>JVMOptions</key>') writeln(tmpFO, 2, '<key>JVMOptions</key>')
writeln(f, 2, '<array>') writeln(tmpFO, 2, '<array>')
for aStr in jvmArgs: for aStr in jvmArgs:
writeln(f, 3, '<string>' + aStr + '</string>') writeln(tmpFO, 3, '<string>' + aStr + '</string>')
writeln(f, 2, '</array>') writeln(tmpFO, 2, '</array>')
# # ClassPath: AppLauncher # # ClassPath: AppLauncher
# writeln(f, 2, '<key>Java</key>') # writeln(tmpFO, 2, '<key>Java</key>')
# writeln(f, 2, '<dict>') # writeln(tmpFO, 2, '<dict>')
# #
# classPathStr = '$JAVAROOT/' + deployJreDist.getAppLauncherFileName() # classPathStr = '$JAVAROOT/' + deployJreDist.getAppLauncherFileName()
# #
# tupL = [] # tupL = []
# tupL.append(('ClassPath', classPathStr)) # tupL.append(('ClassPath', classPathStr))
# #
# for (key, val) in tupL: # for (key, val) in tupL:
# writeln(f, 3, '<key>' + key + '</key>') # writeln(tmpFO, 3, '<key>' + key + '</key>')
# writeln(f, 3, '<string>' + str(val) + '</string>') # writeln(tmpFO, 3, '<string>' + str(val) + '</string>')
# #
# writeln(f, 2, '</dict>') # writeln(tmpFO, 2, '</dict>')
writeln(f, 1, '</dict>') writeln(tmpFO, 1, '</dict>')
writeln(f, 0, '</plist>') writeln(tmpFO, 0, '</plist>')
f.close()
def checkSystemEnvironment(): def checkSystemEnvironment():
@@ -386,9 +383,9 @@ def checkSystemEnvironment():
return True return True
def writeln(f, tabL, aStr, tabStr=' '): def writeln(aFO, tabL, aStr, tabStr=' '):
tStr = '' tStr = ''
for i in range(tabL): for i in range(tabL):
tStr += tabStr tStr += tabStr
f.write(tStr + aStr + '\n') aFO.write(tStr + aStr + '\n')

View File

@@ -1,6 +1,5 @@
#! /usr/bin/env python #! /usr/bin/env python3
from __future__ import print_function
import argparse import argparse
import os import os
import platform import platform
@@ -11,7 +10,6 @@ import subprocess
import sys import sys
import tempfile import tempfile
import distutils.spawn
import jreUtils import jreUtils
import miscUtils import miscUtils
import appleUtils import appleUtils
@@ -73,12 +71,11 @@ def buildCatalogFile(aArgs, aDeltaPath):
# Save the records to the catalog file # Save the records to the catalog file
dstPath = os.path.join(aDeltaPath, "catalog.txt") dstPath = os.path.join(aDeltaPath, "catalog.txt")
f = open(dstPath, 'wb') with open(dstPath, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
for aRecord in records: for aRecord in records:
f.write(','.join(aRecord) + '\n') tmpFO.write(','.join(aRecord) + '\n')
f.write('exit\n') tmpFO.write('exit\n')
f.close()
def checkForRequiredApplicationsAndExit(): def checkForRequiredApplicationsAndExit():
@@ -87,26 +84,29 @@ def checkForRequiredApplicationsAndExit():
The current set of required applications are: The current set of required applications are:
java, jar, (genisoimage or hdiutil)""" java, jar, (genisoimage or hdiutil)"""
# Check for java (version 1.8 or later) # Check for java (version 1.8 or later)
evalPath = distutils.spawn.find_executable('java') evalPath = shutil.which('java')
errL = [] errL = []
if evalPath == None: if evalPath == None:
errL.append('Failed while trying to locate java. Please install Java') errL.append('Failed while trying to locate java. Please install Java')
else: else:
tmpStr = subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT) verStrRaw = subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT)
pattern = '\"(\d+\.\d+).*\"' verStrRaw = verStrRaw.decode("utf-8")
verStr = re.search(pattern, tmpStr).groups()[0] pattern = '\"(\d+)(\.\d+)*.*\"'
verVal = float(verStr) verStrFull = re.search(pattern, verStrRaw).group().strip('"')
if verVal < 1.8: pattern = '(\d+)(\.\d+){0,1}'
verStrPart = re.search(pattern, verStrFull).group()
javaVer = float(verStrPart)
if javaVer < 1.8:
errL.append('Installed version of Java is too old. Require Java 1.8. Installed version: {}'.format(verVal)) errL.append('Installed version of Java is too old. Require Java 1.8. Installed version: {}'.format(verVal))
# Check for jar # Check for jar
evalPath = distutils.spawn.find_executable('jar') evalPath = shutil.which('jar')
if evalPath == None: if evalPath == None:
errL.append('Failed while trying to locate jar. Please install jar (typically included with Java)') errL.append('Failed while trying to locate jar. Please install jar (typically included with Java)')
# Check for genisoimage or hdiutil # Check for genisoimage or hdiutil
genisoimagePath = distutils.spawn.find_executable('genisoimage') genisoimagePath = shutil.which('genisoimage')
hdiutilPath = distutils.spawn.find_executable('hdiutil') hdiutilPath = shutil.which('hdiutil')
if genisoimagePath == None and hdiutilPath == None: if genisoimagePath == None and hdiutilPath == None:
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
errL.append('Failed while trying to locate executable hdiutil. Please install hdiutil') errL.append('Failed while trying to locate executable hdiutil. Please install hdiutil')
@@ -137,7 +137,7 @@ def checkForSuggestedApplications():
The current set of suggested applications are: The current set of suggested applications are:
ImageMagick:convert""" ImageMagick:convert"""
retL = [] retL = []
evalPath = distutils.spawn.find_executable('convert') evalPath = shutil.which('convert')
if evalPath == None: if evalPath == None:
retL.append('Application \'convert\' was not found. Please install (ImageMagick) convert') retL.append('Application \'convert\' was not found. Please install (ImageMagick) convert')
retL.append('\tWindows icons will not be supported when using argument: -iconFile.') retL.append('\tWindows icons will not be supported when using argument: -iconFile.')
@@ -293,6 +293,22 @@ if __name__ == "__main__":
if args.javaCode != None and len(args.classPath) == 0: if args.javaCode != None and len(args.classPath) == 0:
args.classPath = getClassPath(args.javaCode) args.classPath = getClassPath(args.javaCode)
# Ensure all specified classPath files exist
errMsgL = []
for aPath in args.classPath:
fullPath = os.path.join(args.javaCode, aPath)
if os.path.exists(fullPath) == False:
errMsgL += ['Specified file does not exist: ' + aPath]
elif os.path.isfile(fullPath) == False:
errMsgL += ['Specified path is not a regular file: ' + aPath]
if len(errMsgL) > 0:
print('There are issues with the --classPath argument.')
print('Utilized --javaCode argument: ' + args.javaCode)
for aErrMsg in errMsgL:
print(' ' + aErrMsg)
exit()
# Clean up the jvmArgs to replace the escape sequence '\-' to '-' # Clean up the jvmArgs to replace the escape sequence '\-' to '-'
# and to ensure that all the args start with the '-' character # and to ensure that all the args start with the '-' character
newJvmArgs = [] newJvmArgs = []
@@ -377,7 +393,11 @@ if __name__ == "__main__":
exit(-1) exit(-1)
dstPath = deltaCodePath; dstPath = deltaCodePath;
try: try:
shutil.copytree(srcPath, dstPath, symlinks=False, ignore=checkReadable) os.makedirs(deltaCodePath)
for aPath in args.classPath:
fullSrcPath = os.path.join(args.javaCode, aPath)
dstPath = os.path.join(deltaCodePath, os.path.basename(fullSrcPath))
shutil.copy(fullSrcPath, dstPath)
except (ErrorDM, shutil.Error) as aExp: except (ErrorDM, shutil.Error) as aExp:
print(' [ERROR] There were issues while copying the javaCode files. Path: ' + srcPath) print(' [ERROR] There were issues while copying the javaCode files. Path: ' + srcPath)
print(' {}\n'.format(aExp), file=sys.stderr) print(' {}\n'.format(aExp), file=sys.stderr)

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env python3
import argparse import argparse
import getpass import getpass
@@ -24,18 +24,17 @@ def getDistInfo(aDistPath):
exit() exit()
exeMode = None exeMode = None
f = open(cfgFile, 'r') with open(cfgFile, mode='rt', encoding='utf-8') as tmpFO:
for aLine in f: for aLine in tmpFO:
aLine = aLine[:-1] aLine = aLine[:-1]
if aLine.startswith('-') == True: if aLine.startswith('-') == True:
exeMode = aLine; exeMode = aLine;
elif exeMode == '-name' and len(aLine) > 0: elif exeMode == '-name' and len(aLine) > 0:
appName = aLine appName = aLine
elif exeMode == '-version' and len(aLine) > 0: elif exeMode == '-version' and len(aLine) > 0:
version = aLine version = aLine
elif exeMode == '-buildDate' and len(aLine) > 0: elif exeMode == '-buildDate' and len(aLine) > 0:
buildDate = aLine buildDate = aLine
f.close()
if appName == None or version == None or buildDate == None: if appName == None or version == None or buildDate == None:
print('Distribution corresponding to the folder: ' + aDistPath + ' does not appear to be valid!') print('Distribution corresponding to the folder: ' + aDistPath + ' does not appear to be valid!')
@@ -51,16 +50,15 @@ def getDistInfo(aDistPath):
print('Release will not be deployed...') print('Release will not be deployed...')
exit() exit()
f = open(catFile, 'r') with open(catFile, mode='rt', encoding='utf-8') as tmpFO:
for aLine in f: for aLine in tmpFO:
aLine = aLine[:-1] aLine = aLine[:-1]
tokenL = aLine.split(',') tokenL = aLine.split(',')
# Check to see if legacy JREs are allowed # Check to see if legacy JREs are allowed
if len(tokenL) >= 2 and tokenL[0] == 'jre' and isLegacyJre == None: if len(tokenL) >= 2 and tokenL[0] == 'jre' and isLegacyJre == None:
isLegacyJre = False isLegacyJre = False
if tokenL[1].strip().startswith('1.') == True: if tokenL[1].strip().startswith('1.') == True:
isLegacyJre = True isLegacyJre = True
f.close()
if isLegacyJre == None: if isLegacyJre == None:
print('Distribution corresponding to the folder: ' + aDistPath + ' does not appear to be valid!') print('Distribution corresponding to the folder: ' + aDistPath + ' does not appear to be valid!')
@@ -84,66 +82,61 @@ def addReleaseInfo(aDeployPath, aAppName, aVerStr, aBuildDate, aIsLegacyJre):
verFile = os.path.join(aDeployPath, 'releaseInfo.txt') verFile = os.path.join(aDeployPath, 'releaseInfo.txt')
if os.path.isfile(verFile) == True: if os.path.isfile(verFile) == True:
# Read the legacy releases # Read the legacy releases
f = open(verFile, 'r') with open(verFile, mode='rt', encoding='utf-8') as tmpFO:
for aLine in f: for aLine in tmpFO:
aLine = aLine[:-1] aLine = aLine[:-1]
# Ignore empty lines and comments # Ignore empty lines and comments
if len(aLine) == 0: if len(aLine) == 0:
continue continue
if aLine.startswith('#') == True: if aLine.startswith('#') == True:
continue continue
tokenL = aLine.split(',') tokenL = aLine.split(',')
if len(tokenL) >= 2 and tokenL[0] == 'name': if len(tokenL) >= 2 and tokenL[0] == 'name':
isLegacyRelease = True isLegacyRelease = True
continue continue
# Ignore legacy exit instructions # Ignore legacy exit instructions
if len(tokenL) >= 1 and tokenL[0] == 'exit': if len(tokenL) >= 1 and tokenL[0] == 'exit':
continue continue
# Record all legacy releases # Record all legacy releases
if len(tokenL) == 2: if len(tokenL) == 2:
legacyReleaseL += [(tokenL[0], tokenL[1])] legacyReleaseL += [(tokenL[0], tokenL[1])]
continue continue
f.close()
# Create the appCatalog.txt file # Create the appCatalog.txt file
catFile = os.path.join(aDeployPath, 'appCatalog.txt') catFile = os.path.join(aDeployPath, 'appCatalog.txt')
if os.path.isfile(catFile) == False: if os.path.isfile(catFile) == False:
if isLegacyRelease == True and len(legacyReleaseL) > 0: if isLegacyRelease == True and len(legacyReleaseL) > 0:
f = open(catFile, 'w') with open(catFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
f.write('name' + ',' + aAppName + '\n\n') tmpFO.write('name' + ',' + aAppName + '\n\n')
# Copy the legacy releases # Copy the legacy releases
for (aLegacyVer, aLegacyDate) in legacyReleaseL: for (aLegacyVer, aLegacyDate) in legacyReleaseL:
f.write('R,{},{}\n'.format(aLegacyVer, aLegacyDate)) tmpFO.write('R,{},{}\n'.format(aLegacyVer, aLegacyDate))
f.write('info,msg,This is a legacy release.\n') tmpFO.write('info,msg,This is a legacy release.\n')
f.write('info,msg,\n') tmpFO.write('info,msg,\n')
if aIsLegacyJre == True: if aIsLegacyJre == True:
f.write('info,msg,Downgrading to this version may require a mandatory upgrade (ver: ' + aVerStr + ') before further upgrades are allowed.\n\n') tmpFO.write('info,msg,Downgrading to this version may require a mandatory upgrade (ver: ' + aVerStr + ') before further upgrades are allowed.\n\n')
else: else:
f.write('# A release should be made using a legacy JRE (1.8+) and this DistMaker release. The release notes will need to be manually.\n') tmpFO.write('# A release should be made using a legacy JRE (1.8+) and this DistMaker release. The release notes will need to be manually.\n')
f.write('info,msg,Downgrading to this version will require a mandatory 2-step upgrade in order to use releases made with non legacy JREs.\n\n') tmpFO.write('info,msg,Downgrading to this version will require a mandatory 2-step upgrade in order to use releases made with non legacy JREs.\n\n')
f.close()
os.chmod(catFile, 0o644)
else: else:
# Form the default (empty) appCatalog.txt # Form the default (empty) appCatalog.txt
f = open(catFile, 'w') with open(catFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
f.write('name' + ',' + aAppName + '\n\n') tmpFO.write('name' + ',' + aAppName + '\n\n')
f.close()
os.chmod(catFile, 0o644) os.chmod(catFile, 0o644)
# Updated the appCatalog.txt info file # Updated the appCatalog.txt info file
f = open(catFile, 'a') with open(catFile, mode='at', encoding='utf-8', newline='\n') as tmpFO:
f.write('R,{},{}\n'.format(aVerStr, aBuildDate)) tmpFO.write('R,{},{}\n'.format(aVerStr, aBuildDate))
f.write('info,msg,There are no release notes available.\n\n') tmpFO.write('info,msg,There are no release notes available.\n\n')
f.close()
# Update the (legacy) releaseInfo.txt file # Update the (legacy) releaseInfo.txt file
if isLegacyRelease == True and aIsLegacyJre == True: if isLegacyRelease == True and aIsLegacyJre == True:
f = open(verFile, 'a') with open(verFile, mode='at', encoding='utf-8', newline='\n') as tmpFO:
f.write(aVerStr + ',' + aBuildDate + '\n') tmpFO.write(aVerStr + ',' + aBuildDate + '\n')
f.close()
def delReleaseInfoLegacy(aDeployPath, aAppName, aVerStr, aBuildDate): def delReleaseInfoLegacy(aDeployPath, aAppName, aVerStr, aBuildDate):
@@ -155,22 +148,20 @@ def delReleaseInfoLegacy(aDeployPath, aAppName, aVerStr, aBuildDate):
# Read the file # Read the file
releaseInfo = [] releaseInfo = []
f = open(verFile, 'r') with open(verFile, mode='rt', encoding='utf-8') as tmpFO:
for line in f: for line in tmpFO:
tokens = line[:-1].split(',', 1); tokens = line[:-1].split(',', 1);
if len(tokens) == 2 and tokens[0] == aVerStr: if len(tokens) == 2 and tokens[0] == aVerStr:
# By not adding the current record to the releaseInfo list, we are effectively removing the record # By not adding the current record to the releaseInfo list, we are effectively removing the record
print('Removing release record from info file. Version: ' + aVerStr) print('Removing release record from info file. Version: ' + aVerStr)
elif len(tokens) == 2 and tokens[0] != 'name': elif len(tokens) == 2 and tokens[0] != 'name':
releaseInfo.append((tokens[0], tokens[1])) releaseInfo.append((tokens[0], tokens[1]))
f.close()
# Write the updated file # Write the updated file
f = open(verFile, 'w') with open(verFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
f.write('name' + ',' + aAppName + '\n') tmpFO.write('name' + ',' + aAppName + '\n')
for verTup in releaseInfo: for verTup in releaseInfo:
f.write(verTup[0] + ',' + verTup[1] + '\n') tmpFO.write(verTup[0] + ',' + verTup[1] + '\n')
f.close()
def delReleaseInfo(aDeployPath, aAppName, aVerStr, aBuildDate): def delReleaseInfo(aDeployPath, aAppName, aVerStr, aBuildDate):
@@ -188,33 +179,31 @@ def delReleaseInfo(aDeployPath, aAppName, aVerStr, aBuildDate):
# Read the file (and skip over all lines found after the release we are searching for) # Read the file (and skip over all lines found after the release we are searching for)
isDeleteMode = False isDeleteMode = False
passLineL = [] passLineL = []
f = open(catFile, 'r') with open(catFile, mode='rt', encoding='utf-8') as tmpFO:
for aLine in f: for aLine in tmpFO:
aLine = aLine[:-1] aLine = aLine[:-1]
tokenL = aLine.split(','); tokenL = aLine.split(',');
# Determine when to enter / exit isDeleteMode # Determine when to enter / exit isDeleteMode
if len(tokenL) == 3 and tokenL[0] == 'R' and tokenL[1] == aVerStr: if len(tokenL) == 3 and tokenL[0] == 'R' and tokenL[1] == aVerStr:
# By not adding the current record to the releaseInfo list, we are effectively removing the record # By not adding the current record to the releaseInfo list, we are effectively removing the record
isDeleteMode = True isDeleteMode = True
# We exit deleteMode when see a different release or exit instruction # We exit deleteMode when see a different release or exit instruction
elif len(tokenL) == 3 and tokenL[0] == 'R' and tokenL[1] != aVerStr: elif len(tokenL) == 3 and tokenL[0] == 'R' and tokenL[1] != aVerStr:
isDeleteMode = False isDeleteMode = False
elif len(tokenL) >= 1 and tokenL[0] == 'exit': elif len(tokenL) >= 1 and tokenL[0] == 'exit':
isDeleteMode = False isDeleteMode = False
# Skip to next if we are in deleteMode # Skip to next if we are in deleteMode
if isDeleteMode == True: if isDeleteMode == True:
continue continue
# Save off all lines when we are not in delete mode # Save off all lines when we are not in delete mode
passLineL += [aLine] passLineL += [aLine]
f.close()
# Write the updated file # Write the updated file
f = open(catFile, 'w') with open(catFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
for aLine in passLineL: for aLine in passLineL:
f.write(aLine + '\n') tmpFO.write(aLine + '\n')
f.close()
def addRelease(aRootPath, aAppName, aVerStr, aBuildDate, aIsLegacyJre): def addRelease(aRootPath, aAppName, aVerStr, aBuildDate, aIsLegacyJre):
@@ -223,8 +212,8 @@ def addRelease(aRootPath, aAppName, aVerStr, aBuildDate, aIsLegacyJre):
if os.path.isdir(deployPath) == False: if os.path.isdir(deployPath) == False:
print('Application ' + aAppName + ' has never been deployed to the root location: ' + aRootPath) print('Application ' + aAppName + ' has never been deployed to the root location: ' + aRootPath)
print('Create a new release of the application at the specified location?') print('Create a new release of the application at the specified location?')
input = raw_input('--> ').upper() tmpAns = input('--> ').upper()
if input != 'Y' and input != 'YES': if tmpAns != 'Y' and tmpAns != 'YES':
print('Release will not be made for app ' + aAppName) print('Release will not be made for app ' + aAppName)
exit() exit()

View File

@@ -1,6 +1,5 @@
#! /usr/bin/env python #! /usr/bin/env python3
from __future__ import print_function
import argparse import argparse
import collections import collections
import getpass import getpass
@@ -83,20 +82,18 @@ def addAppLauncherRelease(aRootPath):
# Create the appCatalog file # Create the appCatalog file
catFile = os.path.join(deployPath, 'appCatalog.txt') catFile = os.path.join(deployPath, 'appCatalog.txt')
if os.path.isfile(catFile) == False: if os.path.isfile(catFile) == False:
f = open(catFile, 'w') with open(catFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
f.write('name' + ',' + 'AppLauncher' + '\n') tmpFO.write('name' + ',' + 'AppLauncher' + '\n')
f.write('digest' + ',' + 'sha256' + '\n\n') tmpFO.write('digest' + ',' + 'sha256' + '\n\n')
f.close()
os.chmod(catFile, 0o644) os.chmod(catFile, 0o644)
# Updated the appCatalog file # Updated the appCatalog file
f = open(catFile, 'a') with open(catFile, mode='at', encoding='utf-8', newline='\n') as tmpFO:
digestStr = miscUtils.computeDigestForFile(srcFile, 'sha256') digestStr = miscUtils.computeDigestForFile(srcFile, 'sha256')
stat = os.stat(srcFile) stat = os.stat(srcFile)
fileLen = stat.st_size fileLen = stat.st_size
f.write("F,{},{},{},{}\n".format(digestStr, fileLen, dstFileName, version)) tmpFO.write("F,{},{},{},{}\n".format(digestStr, fileLen, dstFileName, version))
# f.write('\n') # tmpFO.write('\n')
f.close()
# Copy the src appLauncher.jar file to it's deployed location # Copy the src appLauncher.jar file to it's deployed location
shutil.copy2(srcFile, dstFile) shutil.copy2(srcFile, dstFile)
@@ -112,8 +109,8 @@ def addRelease(aRootPath, aJreNodeL, aVerStr):
if os.path.isdir(installPath) == False: if os.path.isdir(installPath) == False:
regPrintln('A JRE has never been deployed to the root location: ' + aRootPath) regPrintln('A JRE has never been deployed to the root location: ' + aRootPath)
regPrintln('Create a new release of the JRE at the specified location?') regPrintln('Create a new release of the JRE at the specified location?')
input = raw_input('--> ').upper() tmpAns = input('--> ').upper()
if input != 'Y' and input != 'YES': if tmpAns != 'Y' and tmpAns != 'YES':
regPrintln('Release will not be made for JRE version: ' + aVerStr) regPrintln('Release will not be made for JRE version: ' + aVerStr)
exit() exit()
@@ -141,27 +138,25 @@ def addReleaseInfo(aInstallPath, aJreNodeL, aVerStr):
# Create the jreCatalogfile # Create the jreCatalogfile
catFile = os.path.join(aInstallPath, 'jreCatalog.txt') catFile = os.path.join(aInstallPath, 'jreCatalog.txt')
if os.path.isfile(catFile) == False: if os.path.isfile(catFile) == False:
f = open(catFile, 'w') with open(catFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
f.write('name' + ',' + 'JRE' + '\n') tmpFO.write('name' + ',' + 'JRE' + '\n')
f.write('digest' + ',' + 'sha256' + '\n\n') tmpFO.write('digest' + ',' + 'sha256' + '\n\n')
# Note new JRE catalogs require DistMaker versions 0.55 or later # Note new JRE catalogs require DistMaker versions 0.55 or later
f.write('exit,DistMaker,0.55' + '\n\n') tmpFO.write('exit,DistMaker,0.55' + '\n\n')
f.close()
os.chmod(catFile, 0o644) os.chmod(catFile, 0o644)
exitVerDM = [0, 55] exitVerDM = [0, 55]
# Determine the last exit,DistMaker instruction specified # Determine the last exit,DistMaker instruction specified
else: else:
f = open(catFile, 'r') with open(catFile, mode='rt', encoding='utf-8') as tmpFO:
for line in f: for line in tmpFO:
tokens = line[:-1].split(','); tokens = line[:-1].split(',');
# Record the (exit) version of interest # Record the (exit) version of interest
if len(tokens) == 3 and tokens[0] == 'exit' and tokens[1] == 'DistMaker': if len(tokens) == 3 and tokens[0] == 'exit' and tokens[1] == 'DistMaker':
try: try:
exitVerDM = jreUtils.verStrToVerArr(tokens[2]) exitVerDM = jreUtils.verStrToVerArr(tokens[2])
except: except:
exitVerDM = None exitVerDM = None
f.close()
# Locate the list of JREs with a matching version # Locate the list of JREs with a matching version
matchJreNodeL = jreUtils.getJreNodesForVerStr(aJreNodeL, aVerStr) matchJreNodeL = jreUtils.getJreNodesForVerStr(aJreNodeL, aVerStr)
@@ -176,29 +171,28 @@ def addReleaseInfo(aInstallPath, aJreNodeL, aVerStr):
needExitInstr = True needExitInstr = True
# Updated the jreCatalogfile # Updated the jreCatalogfile
f = open(catFile, 'a') with open(catFile, mode='at', encoding='utf-8', newline='\n') as tmpFO:
# Write the exit info to stop legacy DistMakers from processing further # Write the exit info to stop legacy DistMakers from processing further
if needExitInstr == True: if needExitInstr == True:
f.write('exit,DistMaker,0.48\n\n') tmpFO.write('exit,DistMaker,0.48\n\n')
# Write out the JRE release info # Write out the JRE release info
f.write("jre,{}\n".format(aVerStr)) tmpFO.write("jre,{}\n".format(aVerStr))
if needExitInstr == True: if needExitInstr == True:
f.write("require,AppLauncher,0.1,0.2\n") tmpFO.write("require,AppLauncher,0.1,0.2\n")
for aJreNode in matchJreNodeL: for aJreNode in matchJreNodeL:
tmpFile = aJreNode.getFile() tmpFile = aJreNode.getFile()
stat = os.stat(tmpFile) stat = os.stat(tmpFile)
digestStr = miscUtils.computeDigestForFile(tmpFile, 'sha256') digestStr = miscUtils.computeDigestForFile(tmpFile, 'sha256')
fileLen = stat.st_size fileLen = stat.st_size
archStr = aJreNode.getArchitecture(); archStr = aJreNode.getArchitecture();
platStr = aJreNode.getPlatform() platStr = aJreNode.getPlatform()
if exitVerDM != None and exitVerDM > [0, 54]: if exitVerDM != None and exitVerDM > [0, 54]:
f.write("F,{},{},{},{},{}\n".format(archStr, platStr, os.path.basename(tmpFile), digestStr, fileLen)) tmpFO.write("F,{},{},{},{},{}\n".format(archStr, platStr, os.path.basename(tmpFile), digestStr, fileLen))
elif exitVerDM != None: elif exitVerDM != None:
f.write("F,{},{},{},{}\n".format(digestStr, fileLen, platStr, os.path.basename(tmpFile))) tmpFO.write("F,{},{},{},{}\n".format(digestStr, fileLen, platStr, os.path.basename(tmpFile)))
else: else:
f.write("F,{},{},{}\n".format(digestStr, fileLen, os.path.basename(tmpFile))) tmpFO.write("F,{},{},{}\n".format(digestStr, fileLen, os.path.basename(tmpFile)))
f.write('\n') tmpFO.write('\n')
f.close()
destPath = os.path.join(aInstallPath, aVerStr) destPath = os.path.join(aInstallPath, aVerStr)
os.makedirs(destPath, 0o755) os.makedirs(destPath, 0o755)
@@ -248,29 +242,27 @@ def delReleaseInfo(aInstallPath, aVerStr):
# Read the file # Read the file
inputLineL = [] inputLineL = []
isDeleteMode = False isDeleteMode = False
f = open(catFile, 'r') with open(catFile, mode='rt', encoding='utf-8') as tmpFO:
for line in f: for line in tmpFO:
tokens = line[:-1].split(',', 1); tokens = line[:-1].split(',', 1);
# Switch to deleteMode when we find a matching JRE release # Switch to deleteMode when we find a matching JRE release
if len(tokens) == 2 and tokens[0] == 'jre' and tokens[1] == aVerStr: if len(tokens) == 2 and tokens[0] == 'jre' and tokens[1] == aVerStr:
isDeleteMode = True isDeleteMode = True
continue continue
# Switch out of deleteMode when we find a different JRE release # Switch out of deleteMode when we find a different JRE release
elif len(tokens) == 2 and tokens[0] == 'jre' and tokens[1] != aVerStr: elif len(tokens) == 2 and tokens[0] == 'jre' and tokens[1] != aVerStr:
isDeleteMode = False isDeleteMode = False
# Skip over the input line if we are in deleteMode # Skip over the input line if we are in deleteMode
elif isDeleteMode == True: elif isDeleteMode == True:
continue continue
# Save off the input line # Save off the input line
inputLineL.append(line) inputLineL.append(line)
f.close()
# Write the updated file # Write the updated file
f = open(catFile, 'w') with open(catFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
for aLine in inputLineL: for aLine in inputLineL:
f.write(aLine) tmpFO.write(aLine)
f.close()
def showReleaseInfo(aRootPath, aJreNodeL): def showReleaseInfo(aRootPath, aJreNodeL):

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env python3
import glob import glob
import os import os
@@ -110,7 +110,7 @@ def getJreNode(aJreNodeL, aArchStr, aPlatStr, aJvmVerSpec):
any specific update for a major version of JAVA then just specify the major version. Example '1.8' instead of any specific update for a major version of JAVA then just specify the major version. Example '1.8' instead of
1.8.0_73'""" 1.8.0_73'"""
# Transform a single string to a list of size 1 # Transform a single string to a list of size 1
if isinstance(aJvmVerSpec, basestring): if isinstance(aJvmVerSpec, str):
aJvmVerSpec = [aJvmVerSpec] aJvmVerSpec = [aJvmVerSpec]
# Retrieve the min and max JVM versions from aJvmVerSpec # Retrieve the min and max JVM versions from aJvmVerSpec
@@ -185,8 +185,8 @@ def loadJreCatalog(aFile):
# Read the file # Read the file
regPrintln('Loading JRE catalog: {}'.format(aFile)) regPrintln('Loading JRE catalog: {}'.format(aFile))
with open(aFile, 'r') as workF: with open(aFile, mode='rt', encoding='utf-8') as tmpFO:
for (lineNum, aLine) in enumerate(workF, 1): for (lineNum, aLine) in enumerate(tmpFO, 1):
# Skip empty lines / comments # Skip empty lines / comments
line = aLine.strip() line = aLine.strip()
if len(line) == 0 or line[0] == '#': if len(line) == 0 or line[0] == '#':

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env python3
import copy import copy
import os import os
@@ -109,7 +109,7 @@ def buildDistTree(aBuildPath, aRootPath, aArgs, aJreNode):
jreUtils.unpackAndRenameToStandard(aJreNode, aRootPath) jreUtils.unpackAndRenameToStandard(aJreNode, aRootPath)
def buildBashScript(aDestFile, aArgs, aJreNode): def buildBashScript(aDstFile, aArgs, aJreNode):
# Form the jvmArgStr but strip away the -Xmx* component if it is specified # Form the jvmArgStr but strip away the -Xmx* component if it is specified
# since the JVM maxMem is dynamically configurable (via DistMaker) # since the JVM maxMem is dynamically configurable (via DistMaker)
maxMem = None maxMem = None
@@ -120,63 +120,61 @@ def buildBashScript(aDestFile, aArgs, aJreNode):
else: else:
jvmArgsStr += aStr + ' ' jvmArgsStr += aStr + ' '
f = open(aDestFile, 'wb') with open(aDstFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
# f.write('#!/bin/bash\n') # tmpFO.write('#!/bin/bash\n')
f.write('#!/usr/bin/env bash\n') tmpFO.write('#!/usr/bin/env bash\n')
f.write('# Do not remove the opening or closing brackets: {}. This enables safe inline\n') tmpFO.write('# Do not remove the opening or closing brackets: {}. This enables safe inline\n')
f.write('# mutations to this script while it is running\n') tmpFO.write('# mutations to this script while it is running\n')
f.write('{ # Do not remove this bracket! \n\n') tmpFO.write('{ # Do not remove this bracket! \n\n')
f.write('# Define where the Java executable is located\n') tmpFO.write('# Define where the Java executable is located\n')
if aJreNode == None: if aJreNode == None:
f.write('javaExe=java\n\n') tmpFO.write('javaExe=java\n\n')
else: else:
jrePath = jreUtils.getBasePathFor(aJreNode) jrePath = jreUtils.getBasePathFor(aJreNode)
f.write('javaExe=../' + jrePath + '/bin/java\n\n') tmpFO.write('javaExe=../' + jrePath + '/bin/java\n\n')
f.write('# Define the maximum memory to allow the application to utilize\n') tmpFO.write('# Define the maximum memory to allow the application to utilize\n')
if maxMem == None: if maxMem == None:
f.write('#maxMem=512m # Uncomment out this line to change from defaults.\n\n') tmpFO.write('#maxMem=512m # Uncomment out this line to change from defaults.\n\n')
else: else:
f.write('maxMem=' + maxMem + '\n\n') tmpFO.write('maxMem=' + maxMem + '\n\n')
f.write('# Get the installation path\n') tmpFO.write('# Get the installation path\n')
f.write('# We support the Linux / Macosx variants explicitly and then default back to Linux\n') tmpFO.write('# We support the Linux / Macosx variants explicitly and then default back to Linux\n')
f.write('if [ "$(uname -s)" == "Darwin" ]; then\n') tmpFO.write('if [ "$(uname -s)" == "Darwin" ]; then\n')
f.write(' # Macosx platform: We assume the coreutils package has been installed...\n') tmpFO.write(' # Macosx platform: We assume the coreutils package has been installed...\n')
f.write(' installPath=$(greadlink -f "$BASH_SOURCE")\n') tmpFO.write(' installPath=$(greadlink -f "$BASH_SOURCE")\n')
f.write('elif [ "$(uname -s)" == "Linux" ]; then\n') tmpFO.write('elif [ "$(uname -s)" == "Linux" ]; then\n')
f.write(' # Linux platform\n') tmpFO.write(' # Linux platform\n')
f.write(' installPath=$(readlink -f "$BASH_SOURCE")\n') tmpFO.write(' installPath=$(readlink -f "$BASH_SOURCE")\n')
f.write('else\n') tmpFO.write('else\n')
f.write(' # Other platform: ---> Defaults back to Linux platform\n') tmpFO.write(' # Other platform: ---> Defaults back to Linux platform\n')
f.write(' installPath=$(readlink -f "$BASH_SOURCE")\n') tmpFO.write(' installPath=$(readlink -f "$BASH_SOURCE")\n')
f.write('fi\n') tmpFO.write('fi\n')
f.write('installPath=$(dirname "$installPath")\n\n') tmpFO.write('installPath=$(dirname "$installPath")\n\n')
f.write('# Change the working directory to the app folder in the installation path\n') tmpFO.write('# Change the working directory to the app folder in the installation path\n')
f.write('cd "$installPath"/app\n\n') tmpFO.write('cd "$installPath"/app\n\n')
f.write('# Setup the xmxStr to define the maximum JVM memory.\n') tmpFO.write('# Setup the xmxStr to define the maximum JVM memory.\n')
f.write('if [ -z ${maxMem+x} ]; then\n') tmpFO.write('if [ -z ${maxMem+x} ]; then\n')
f.write(' xmxStr=""\n') tmpFO.write(' xmxStr=""\n')
f.write('else\n') tmpFO.write('else\n')
f.write(' xmxStr=\'-Xmx\'$maxMem\n') tmpFO.write(' xmxStr=\'-Xmx\'$maxMem\n')
f.write('fi\n\n') tmpFO.write('fi\n\n')
exeCmd = '$javaExe ' + jvmArgsStr + '$xmxStr -Djava.system.class.loader=appLauncher.RootClassLoader ' exeCmd = '$javaExe ' + jvmArgsStr + '$xmxStr -Djava.system.class.loader=appLauncher.RootClassLoader '
exeCmd = exeCmd + '-cp ../launcher/' + deployJreDist.getAppLauncherFileName() + ' appLauncher.AppLauncher $*' exeCmd = exeCmd + '-cp ../launcher/' + deployJreDist.getAppLauncherFileName() + ' appLauncher.AppLauncher $*'
f.write('# Run the application\n') tmpFO.write('# Run the application\n')
f.write(exeCmd + '\n\n') tmpFO.write(exeCmd + '\n\n')
f.write('exit # Do not remove this exit! (just before the bracket)\n') tmpFO.write('exit # Do not remove this exit! (just before the bracket)\n')
f.write('} # Do not remove this bracket! \n\n') tmpFO.write('} # Do not remove this bracket! \n\n')
f.close()
# Make the script executable # Make the script executable
os.chmod(aDestFile, 00755) os.chmod(aDstFile, 0o755)
def checkSystemEnvironment(): def checkSystemEnvironment():

View File

@@ -1,3 +1,5 @@
#! /usr/bin/env python3
import hashlib import hashlib
import os import os
import time import time

View File

@@ -1,4 +1,5 @@
#! /usr/bin/env python #! /usr/bin/env python3
import argparse import argparse
import hashlib import hashlib
import os import os
@@ -56,14 +57,14 @@ def computeDigestForFile(evalFile, digestType, block_size=2**20):
else: else:
raise ErrorDM('Unrecognized hash function: ' + digestType); raise ErrorDM('Unrecognized hash function: ' + digestType);
f = open(evalFile, 'rb') with open(evalFile, mode='rb') as tmpFO:
while True: while True:
data = f.read(block_size) data = tmpFO.read(block_size)
if not data: if not data:
break break
hash.update(data) hash.update(data)
f.close()
return hash.hexdigest() return hash.hexdigest()
def getPlatformTypes(aPlatformArr, aPlatformStr): def getPlatformTypes(aPlatformArr, aPlatformStr):
@@ -103,7 +104,7 @@ def executeAndLog(aCommand, indentStr=""):
try: try:
proc = subprocess.Popen(aCommand, stderr=subprocess.STDOUT, stdout=subprocess.PIPE) proc = subprocess.Popen(aCommand, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
proc.wait() proc.wait()
outStr = proc.stdout.read() outStr = proc.stdout.read().decode('utf-8')
if outStr != "": if outStr != "":
outStr = logUtils.appendLogOutputWithText(outStr, indentStr) outStr = logUtils.appendLogOutputWithText(outStr, indentStr)
print(outStr) print(outStr)
@@ -164,13 +165,7 @@ def requirePythonVersion(aVer):
exit(-1) exit(-1)
def buildAppLauncherConfig(aDestFile, aArgs): def buildAppLauncherConfig(aDstFile, aArgs):
classPathStr = ''
for aStr in aArgs.classPath:
classPathStr += 'java/' + aStr + ':'
if len(classPathStr) > 0:
classPathStr = classPathStr[0:-1]
jvmArgsStr = '' jvmArgsStr = ''
for aStr in aArgs.jvmArgs: for aStr in aArgs.jvmArgs:
if len(aStr) > 2 and aStr[0:1] == '\\': if len(aStr) > 2 and aStr[0:1] == '\\':
@@ -181,41 +176,39 @@ def buildAppLauncherConfig(aDestFile, aArgs):
for aStr in aArgs.appArgs: for aStr in aArgs.appArgs:
appArgsStr += ' ' + aStr appArgsStr += ' ' + aStr
f = open(aDestFile, 'wb') with open(aDstFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
# App name section
tmpFO.write('-name\n')
tmpFO.write(aArgs.name + '\n')
tmpFO.write('\n')
# App name section # Version section
f.write('-name\n') tmpFO.write('-version\n')
f.write(aArgs.name + '\n') tmpFO.write(aArgs.version + '\n')
f.write('\n') tmpFO.write('\n')
# Version section # Build date section
f.write('-version\n') exeDate = time.localtime()
f.write(aArgs.version + '\n') buildDate = time.strftime('%Y%b%d %H:%M:%S', exeDate)
f.write('\n') tmpFO.write('-buildDate\n')
tmpFO.write(buildDate + '\n')
tmpFO.write('\n')
# Build date section # MainClass section
exeDate = time.localtime() tmpFO.write('-mainClass\n')
buildDate = time.strftime('%Y%b%d %H:%M:%S', exeDate) tmpFO.write(aArgs.mainClass + '\n')
f.write('-buildDate\n') tmpFO.write('\n')
f.write(buildDate + '\n')
f.write('\n')
# MainClass section # ClassPath section
f.write('-mainClass\n') tmpFO.write('-classPath\n')
f.write(aArgs.mainClass + '\n') for aPath in aArgs.classPath:
f.write('\n') fileName = os.path.basename(aPath)
tmpFO.write(fileName + '\n')
tmpFO.write('\n')
# ClassPath section # Application args section
f.write('-classPath\n') tmpFO.write('-appArgs\n')
for aStr in aArgs.classPath: for aStr in aArgs.appArgs:
f.write(aStr + '\n') tmpFO.write(aStr + '\n')
f.write('\n') tmpFO.write('\n')
# Application args section
f.write('-appArgs\n')
for aStr in aArgs.appArgs:
f.write(aStr + '\n')
f.write('\n')
f.close()

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env python3
import copy import copy
import glob import glob
@@ -55,13 +55,13 @@ def buildRelease(aArgs, aBuildPath, aJreNodeL):
appInstallRoot = os.path.dirname(appInstallRoot) appInstallRoot = os.path.dirname(appInstallRoot)
l4jPath = os.path.join(appInstallRoot, 'template', 'launch4j') l4jPath = os.path.join(appInstallRoot, 'template', 'launch4j')
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
exeCmd = ['tar', '-C', tmpPath, '-xf', l4jPath + '/launch4j-3.12-macosx-x86.tgz'] exeCmd = ['tar', '-C', tmpPath, '-xf', l4jPath + '/launch4j-3.14-macosx-x86.tgz']
else: else:
is64Bit = sys.maxsize > 2**32 is64Bit = sys.maxsize > 2**32
if is64Bit == True: if is64Bit == True:
exeCmd = ['tar', '-C', tmpPath, '-xf', l4jPath + '/launch4j-3.12-linux-x64.tgz'] exeCmd = ['tar', '-C', tmpPath, '-xf', l4jPath + '/launch4j-3.14-linux-x64.tgz']
else: else:
exeCmd = ['tar', '-C', tmpPath, '-xf', l4jPath + '/launch4j-3.12-linux.tgz'] exeCmd = ['tar', '-C', tmpPath, '-xf', l4jPath + '/launch4j-3.14-linux.tgz']
retCode = subprocess.call(exeCmd) retCode = subprocess.call(exeCmd)
if retCode != 0: if retCode != 0:
print('Failed to extract launch4j package...') print('Failed to extract launch4j package...')
@@ -166,66 +166,65 @@ def buildDistTree(aBuildPath, aRootPath, aArgs, aJreNode):
if winIconFile != None: if winIconFile != None:
os.remove(winIconFile) os.remove(winIconFile)
def buildLaunch4JConfig(aDestFile, aArgs, aJreNode, aIconFile): def buildLaunch4JConfig(aDstFile, aArgs, aJreNode, aIconFile):
f = open(aDestFile, 'wb') with open(aDstFile, mode='wt', encoding='utf-8', newline='\n') as tmpFO:
writeln(f, 0, "<launch4jConfig>") writeln(tmpFO, 0, "<launch4jConfig>")
if aArgs.debug == True: if aArgs.debug == True:
writeln(f, 1, "<headerType>console</headerType>"); writeln(tmpFO, 1, "<headerType>console</headerType>");
else: else:
writeln(f, 1, "<headerType>gui</headerType>"); writeln(tmpFO, 1, "<headerType>gui</headerType>");
writeln(f, 1, "<outfile>" + aArgs.name + ".exe</outfile>"); writeln(tmpFO, 1, "<outfile>" + aArgs.name + ".exe</outfile>");
writeln(f, 1, "<dontWrapJar>true</dontWrapJar>"); writeln(tmpFO, 1, "<dontWrapJar>true</dontWrapJar>");
writeln(f, 1, "<errTitle>" + aArgs.name + "</errTitle>"); writeln(tmpFO, 1, "<errTitle>" + aArgs.name + "</errTitle>");
writeln(f, 1, "<downloadUrl>http://java.com/download</downloadUrl>"); writeln(tmpFO, 1, "<downloadUrl>http://java.com/download</downloadUrl>");
# writeln(f, 1, "<supportUrl>url</supportUrl>"); # writeln(tmpFO, 1, "<supportUrl>url</supportUrl>");
# writeln(f, 1, "<cmdLine>app.cfg</cmdLine>"); # writeln(tmpFO, 1, "<cmdLine>app.cfg</cmdLine>");
writeln(f, 1, "<chdir>app/</chdir>"); writeln(tmpFO, 1, "<chdir>app/</chdir>");
writeln(f, 1, "<priority>normal</priority>"); writeln(tmpFO, 1, "<priority>normal</priority>");
writeln(f, 1, "<customProcName>true</customProcName>"); writeln(tmpFO, 1, "<customProcName>true</customProcName>");
writeln(f, 1, "<stayAlive>false</stayAlive>"); writeln(tmpFO, 1, "<stayAlive>false</stayAlive>");
if aIconFile != None: if aIconFile != None:
writeln(f, 1, "<icon>" + aIconFile + "</icon>"); writeln(tmpFO, 1, "<icon>" + aIconFile + "</icon>");
writeln(f, 1, "<classPath>"); writeln(tmpFO, 1, "<classPath>");
writeln(f, 2, "<mainClass>appLauncher.AppLauncher</mainClass>"); writeln(tmpFO, 2, "<mainClass>appLauncher.AppLauncher</mainClass>");
writeln(f, 2, "<cp>../launcher/" + deployJreDist.getAppLauncherFileName() + "</cp>"); writeln(tmpFO, 2, "<cp>../launcher/" + deployJreDist.getAppLauncherFileName() + "</cp>");
writeln(f, 1, "</classPath>"); writeln(tmpFO, 1, "</classPath>");
if aArgs.forceSingleInstance != False: if aArgs.forceSingleInstance != False:
writeln(f, 0, ""); writeln(tmpFO, 0, "");
writeln(f, 1, "<singleInstance>"); writeln(tmpFO, 1, "<singleInstance>");
writeln(f, 2, "<mutexName>" + aArgs.name + ".mutex</mutexName>"); writeln(tmpFO, 2, "<mutexName>" + aArgs.name + ".mutex</mutexName>");
writeln(f, 2, "<windowTitle>" + aArgs.name + "</windowTitle>"); writeln(tmpFO, 2, "<windowTitle>" + aArgs.name + "</windowTitle>");
writeln(f, 1, "</singleInstance>"); writeln(tmpFO, 1, "</singleInstance>");
writeln(f, 0, ""); writeln(tmpFO, 0, "");
writeln(f, 1, "<jre>"); writeln(tmpFO, 1, "<jre>");
if aJreNode != None: if aJreNode != None:
jrePath = jreUtils.getBasePathFor(aJreNode) jrePath = jreUtils.getBasePathFor(aJreNode)
writeln(f, 2, "<path>" + jrePath + "</path>"); writeln(tmpFO, 2, "<path>" + jrePath + "</path>");
else: else:
jreVer = getJreMajorVersion(aArgs.jreVerSpec) jreVer = getJreMajorVersion(aArgs.jreVerSpec)
writeln(f, 2, "<minVersion>" + jreVer + "</minVersion>"); # Valid values: '1.7.0' or '1.8.0' ... writeln(tmpFO, 2, "<minVersion>" + jreVer + "</minVersion>"); # Valid values: '1.7.0' or '1.8.0' ...
writeln(f, 2, "<jdkPreference>preferJre</jdkPreference>"); # Valid values: jreOnlyjdkOnly|preferJre|preferJdk writeln(tmpFO, 2, "<jdkPreference>preferJre</jdkPreference>"); # Valid values: jreOnlyjdkOnly|preferJre|preferJdk
for aJvmArg in aArgs.jvmArgs: for aJvmArg in aArgs.jvmArgs:
writeln(f, 2, "<opt>" + aJvmArg + "</opt>"); writeln(tmpFO, 2, "<opt>" + aJvmArg + "</opt>");
writeln(f, 2, "<opt>-Djava.system.class.loader=appLauncher.RootClassLoader</opt>"); writeln(tmpFO, 2, "<opt>-Djava.system.class.loader=appLauncher.RootClassLoader</opt>");
writeln(f, 1, "</jre>"); writeln(tmpFO, 1, "</jre>");
writeln(f, 0, ""); writeln(tmpFO, 0, "");
writeln(f, 1, "<messages>"); writeln(tmpFO, 1, "<messages>");
writeln(f, 2, "<startupErr>" + aArgs.name + " error...</startupErr>"); writeln(tmpFO, 2, "<startupErr>" + aArgs.name + " error...</startupErr>");
writeln(f, 2, "<bundledJreErr>Failed to locate the bundled JRE</bundledJreErr>"); writeln(tmpFO, 2, "<bundledJreErr>Failed to locate the bundled JRE</bundledJreErr>");
writeln(f, 2, "<jreVersionErr>Located JRE is not the proper version.</jreVersionErr>"); writeln(tmpFO, 2, "<jreVersionErr>Located JRE is not the proper version.</jreVersionErr>");
writeln(f, 2, "<launcherErr>Failed to launch " + aArgs.name + "</launcherErr>"); writeln(tmpFO, 2, "<launcherErr>Failed to launch " + aArgs.name + "</launcherErr>");
writeln(f, 1, "</messages>"); writeln(tmpFO, 1, "</messages>");
writeln(f, 0, "") writeln(tmpFO, 0, "")
writeln(f, 0, "</launch4jConfig>") writeln(tmpFO, 0, "</launch4jConfig>")
f.write('\n') tmpFO.write('\n')
f.close()
def checkSystemEnvironment(): def checkSystemEnvironment():

View File

@@ -15,7 +15,7 @@ import glum.version.Version;
public class DistApp public class DistApp
{ {
/** The DistMaker version is defined here. */ /** The DistMaker version is defined here. */
public static final Version version = new PlainVersion(0, 57, 0); public static final Version version = new PlainVersion(0, 61, 0);
/** /**
* Main entry point that will print out the version of DistMaker to stdout. * Main entry point that will print out the version of DistMaker to stdout.

View File

@@ -12,8 +12,6 @@ import java.util.*;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import com.google.common.base.Joiner;
import distMaker.gui.PickReleasePanel; import distMaker.gui.PickReleasePanel;
import distMaker.jre.*; import distMaker.jre.*;
import distMaker.node.*; import distMaker.node.*;
@@ -142,14 +140,16 @@ public class DistMakerEngine
*/ */
public UpdateStatus isUpToDate() public UpdateStatus isUpToDate()
{ {
LoggingTask task = new LoggingTask(); var task = new BufferTask();
// LoggingTask task = new LoggingTask();
String appName = currRelease.getName(); String appName = currRelease.getName();
List<AppRelease> unsortedReleaseL = DistUtils.getAvailableAppReleases(task, updateSiteUrl, appName, refCredential); List<AppRelease> unsortedReleaseL = DistUtils.getAvailableAppReleases(task, updateSiteUrl, appName, refCredential);
if (unsortedReleaseL == null) if (unsortedReleaseL == null)
{ {
// The update check failed, so return a status of false with a message about the problem // The update check failed, so return a status of false with a message about the problem
String msg = Joiner.on("; ").join(task.getMessages()); // String msg = Joiner.on("; ").join(task.getMessages());
var msg = task.getBuffer();
return new UpdateStatus(msg); return new UpdateStatus(msg);
} }
// Sort the items, and isolate the newest item // Sort the items, and isolate the newest item

View File

@@ -1,37 +0,0 @@
package distMaker;
import glum.task.SilentTask;
import java.util.ArrayList;
import java.util.List;
public class LoggingTask extends SilentTask
{
private final List<String> messageL = new ArrayList<>();
@Override
public void logReg(String aMsg)
{
messageL.add(aMsg);
super.logReg(aMsg);
}
@Override
public void logRegln(String aMsg)
{
messageL.add(aMsg);
super.logRegln(aMsg);
}
@Override
public void logRegUpdate(String aMsg)
{
messageL.add(aMsg);
super.logRegUpdate(aMsg);
}
List<String> getMessages()
{
return messageL;
}
}

View File

@@ -38,7 +38,7 @@ public class PickReleasePanel extends GlassPanel implements ActionListener, Item
// GUI vars // GUI vars
private JLabel titleL; private JLabel titleL;
private JRadioButton newestRB, olderRB; private JRadioButton newestRB, olderRB;
private ItemListPanel<AppRelease> listPanel; private ItemListPanel<AppRelease, LookUp> listPanel;
private QueryTableCellRenderer col0Renderer, col1Renderer; private QueryTableCellRenderer col0Renderer, col1Renderer;
private JButton abortB, proceedB; private JButton abortB, proceedB;
private JTextArea headTA, infoTA; private JTextArea headTA, infoTA;
@@ -197,7 +197,7 @@ public class PickReleasePanel extends GlassPanel implements ActionListener, Item
// Latest version area // Latest version area
newestRB = GuiUtil.createJRadioButton(this, "Unspecified", smallFont); newestRB = GuiUtil.createJRadioButton(this, "Unspecified", smallFont);
newestRB.setSelected(true); // newestRB.setSelected(true);
// Older version area // Older version area
olderRB = GuiUtil.createJRadioButton(this, "Select an older release:", smallFont); olderRB = GuiUtil.createJRadioButton(this, "Select an older release:", smallFont);
@@ -232,6 +232,9 @@ public class PickReleasePanel extends GlassPanel implements ActionListener, Item
proceedB = GuiUtil.createJButton("Proceed", this, smallFont); proceedB = GuiUtil.createJButton("Proceed", this, smallFont);
add(abortB, "align right,span,split 2"); add(abortB, "align right,span,split 2");
add(proceedB, ""); add(proceedB, "");
// Set the initial state
newestRB.setSelected(true);
} }
/** /**
@@ -255,10 +258,10 @@ public class PickReleasePanel extends GlassPanel implements ActionListener, Item
tmpComposer.setRenderer(LookUp.Version, col0Renderer); tmpComposer.setRenderer(LookUp.Version, col0Renderer);
tmpComposer.setRenderer(LookUp.BuildTime, col1Renderer); tmpComposer.setRenderer(LookUp.BuildTime, col1Renderer);
tmpIH = new QueryItemHandler<>(tmpComposer); tmpIH = new QueryItemHandler<>();
myItemProcessor = new StaticItemProcessor<>(); myItemProcessor = new StaticItemProcessor<>();
listPanel = new ItemListPanel<>(tmpIH, myItemProcessor, false); listPanel = new ItemListPanel<>(tmpIH, myItemProcessor, tmpComposer, false);
listPanel.setSortingEnabled(false); listPanel.setSortingEnabled(false);
listPanel.addListSelectionListener(this); listPanel.addListSelectionListener(this);
return listPanel; return listPanel;

View File

@@ -30,8 +30,8 @@ public class JreVersion implements Comparable<JreVersion>, Version
{ {
label = aLabel; label = aLabel;
String[] tokenArr = label.split("[._]"); var tokenArr = label.split("[._]");
ArrayList<Integer> workL = new ArrayList<>(); var workL = new ArrayList<Integer>();
for (String aStr : tokenArr) for (String aStr : tokenArr)
{ {
int tmpVal = ParseUtil.readInt(aStr, Integer.MIN_VALUE); int tmpVal = ParseUtil.readInt(aStr, Integer.MIN_VALUE);
@@ -66,7 +66,6 @@ public class JreVersion implements Comparable<JreVersion>, Version
public static JreVersion getBetterVersion(JreVersion verA, JreVersion verB) public static JreVersion getBetterVersion(JreVersion verA, JreVersion verB)
{ {
JreVersion defaultVer; JreVersion defaultVer;
int valA, valB, idxCnt;
// Default JreVersion is the version that is more specific // Default JreVersion is the version that is more specific
defaultVer = null; defaultVer = null;
@@ -76,14 +75,14 @@ public class JreVersion implements Comparable<JreVersion>, Version
defaultVer = verA; defaultVer = verA;
// Set the idxCnt to the less specific JreVersion // Set the idxCnt to the less specific JreVersion
idxCnt = Math.min(verA.compL.size(), verB.compL.size()); var idxCnt = Math.min(verA.compL.size(), verB.compL.size());
// Compare each integral component (which originated from the label) // Compare each integral component (which originated from the label)
// Assume higher values correspond to later versions // Assume higher values correspond to later versions
for (int c1 = 0; c1 < idxCnt; c1++) for (int c1 = 0; c1 < idxCnt; c1++)
{ {
valA = verA.compL.get(c1); var valA = verA.compL.get(c1);
valB = verB.compL.get(c1); var valB = verB.compL.get(c1);
if (valA > valB) if (valA > valB)
return verA; return verA;
if (valB > valA) if (valB > valA)
@@ -95,7 +94,7 @@ public class JreVersion implements Comparable<JreVersion>, Version
} }
@Override @Override
public int getMajorVersion() public int major()
{ {
if (isLegacy == true) if (isLegacy == true)
return compL.get(1); return compL.get(1);
@@ -107,7 +106,7 @@ public class JreVersion implements Comparable<JreVersion>, Version
} }
@Override @Override
public int getMinorVersion() public int minor()
{ {
if (isLegacy == true) if (isLegacy == true)
{ {
@@ -123,7 +122,7 @@ public class JreVersion implements Comparable<JreVersion>, Version
} }
@Override @Override
public int getPatchVersion() public int patch()
{ {
if (isLegacy == true) if (isLegacy == true)
{ {
@@ -141,10 +140,8 @@ public class JreVersion implements Comparable<JreVersion>, Version
@Override @Override
public int compareTo(JreVersion aItem) public int compareTo(JreVersion aItem)
{ {
JreVersion tmpVer;
// Note the natural ordering is from oldest version to most recent version // 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) if (tmpVer == aItem)
return -1; return -1;
if (tmpVer == this) if (tmpVer == this)

View File

@@ -34,7 +34,7 @@ public class PlatformUtils
*/ */
public static String getAppLauncherFileName(Version aVersion) 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.jar";
return "appLauncher-" + aVersion + ".jar"; return "appLauncher-" + aVersion + ".jar";

View File

@@ -14,7 +14,7 @@ public class ParseUtils
* <p> * <p>
* Processing of the configuration file should exit if the specified needed version is not met or the version string * 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. * could not be parsed into major minor components.
* *
* @param aTargName * @param aTargName
* The target component whose version will be evaluated. Current supported values are one of the following: * The target component whose version will be evaluated. Current supported values are one of the following:
* [AppLauncher, DistMaker] * [AppLauncher, DistMaker]
@@ -39,25 +39,22 @@ public class ParseUtils
int needMinorVer = Integer.MAX_VALUE; int needMinorVer = Integer.MAX_VALUE;
try try
{ {
String[] versionArr; var versionArr = aNeededVer.split("\\.");
versionArr = aNeededVer.split("\\.");
if (versionArr.length >= 1) if (versionArr.length >= 1)
needMajorVer = Integer.parseInt(versionArr[0]); needMajorVer = Integer.parseInt(versionArr[0]);
if (versionArr.length >= 2) if (versionArr.length >= 2)
needMinorVer = Integer.parseInt(versionArr[1]); needMinorVer = Integer.parseInt(versionArr[1]);
} }
catch(Throwable aExp) catch (Throwable aExp)
{ {
// Ignore just assume version components are whatever we managed to parse // Ignore just assume version components are whatever we managed to parse
} }
Version needVer; var needVer = new PlainVersion(needMajorVer, needMinorVer, 0);
needVer = new PlainVersion(needMajorVer, needMinorVer, 0);
// Exit the logic if the needVer > evalVer // Exit the logic if the needVer > evalVer
if (needVer.getMajorVersion() > evalVer.getMajorVersion()) if (needVer.major() > evalVer.major())
return true; return true;
if (needVer.getMajorVersion() == needVer.getMajorVersion() && needVer.getMinorVersion() > evalVer.getMinorVersion()) if (needVer.major() == needVer.major() && needVer.minor() > evalVer.minor())
return true; return true;
return false; return false;

81
tools/build.xml Normal file
View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Ant script for building the library. This Ant script is used by the
script buildRelease to aide in the compilation of Java source files into
a binary jar file.
Please note that the basedir is set to the parent folder. This build.xml
file is expected to reside in ~/tools/ folder.-->
<project basedir="../" default="install" name="DistMaker">
<description>
DistMaker Library
</description>
<!-- PACKAGE PROPERTIES -->
<property file="build.properties"/>
<property name="src" location="src"/>
<property name="build" location="bin"/>
<property name="classes" location="bin/classes"/>
<path id="class.path">
<pathelement path="${classes}"/>
<pathelement path="lib/commons-compress-1.15.jar"/>
<pathelement path="lib/glum-2.0.0-RC3.jar"/>
<pathelement path="lib/guava-18.0.jar"/>
<pathelement path="lib/miglayout-3.7.2-swing.jar"/>
<pathelement path="."/>
</path>
<!-- BUILD PROPERTIES -->
<property name="javac.cmdline" value="-Xlint:unchecked"/>
<property name="javac.debug" value="on"/>
<property name="javac.debuglevel" value="lines,vars,source"/>
<property name="javac.deprecated" value="on"/>
<property name="javac.optimize" value="on"/>
<property name="javac.version" value="11"/>
<!-- Perform initialization for various tasks -->
<target name="init" description="Initialization task">
<!-- create timestamp -->
<tstamp/>
<!-- create any necessary directories -->
<mkdir dir="${build}"/>
<mkdir dir="${classes}"/>
<!-- <mkdir dir="${doc}"/> -->
</target>
<!-- Build the binary build structure from source files -->
<target name="compile" depends="init" description="Compile source code for the library">
<!-- Build class files from source files -->
<javac srcdir="${src}" destdir="${classes}" includeantruntime="false"
debug="${javac.debug}" debuglevel="${javac.debuglevel}"
deprecation="${javac.deprecated}" includes="**/*.java"
optimize="${javac.optimize}" source="${javac.version}" target="${javac.version}">
<classpath refid="class.path"/>
<compilerarg line="${javac.cmdline}"/>
</javac>
</target>
<!-- Clean up ant build content -->
<target name="clean" description="Complete clean">
<delete dir="${build}"/>
</target>
<!-- Generate JavaDoc documentation -->
<!--
<target name="javadoc" description="Produce javadoc API in doc directory">
<javadoc destdir="${doc}">
<classpath refid="class.path"/>
<link href="http://ws.apache.org/axis/java/apiDocs/"/>
<link href="http://java.sun.com/javase/6/docs/api/"/>
<packageset dir="src"/>
<bottom><![CDATA[<i>Copyright &#169; 2008 JHU/APL. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
-->
</project>

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env python3
import argparse import argparse
import glob import glob
@@ -7,40 +7,147 @@ import shutil
import signal import signal
import subprocess import subprocess
import sys import sys
import traceback
# Define the libraries the application depends on # Define the (baseline) version
libList = ['glum-1.3.7.jar', 'guava-18.0.jar', 'distMaker.jar'] 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): def checkForInstalledApps():
"""Method that builds a release of DistMaker. Upon sucessful execution, a """Checks for installed applications needed to build a release of the
tar.gz archive will be generated named: 'DistMaker-<aVersion>.tar.gz'. Note DistMaker library / package.
that releases of DistMaker aVersion 0.50 or later (2018May01+) will no longer """
include static JREs.""" # 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-<version>.jar
- distMaker-<version>-src.jar
- DistMaker-<version>.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 # Retrieve the install path
installPath = getInstallRoot() installPath = getInstallRoot()
installPath = os.path.dirname(installPath) installPath = os.path.dirname(installPath)
# Determine the workPath # Define the paths of interest
workPath = os.path.join(installPath, 'release', 'DistMaker-' + aVersion) jarBinPathFN = os.path.join(installPath, 'release', libBaseName + '-' + version + '.jar')
destFileGZ = os.path.join(installPath, 'release', 'DistMaker-' + aVersion + '.tar.gz') 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: 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) exit(-1)
# Bail if the release already exists # Build the library jars
if os.path.exists(destFileGZ) == True: buildLibraryJar(version)
errPrintln('\tAborting DistMaker release build. Release already exists. File: ' + destFileGZ)
# 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) exit(-1)
# Laydown the structure, and let the user know of the version we are building # Laydown the structure, and let the user know of the version we are building
print('Building DistMaker release ' + aVersion + '...')
os.mkdir(workPath) os.mkdir(workPath)
# Copy the regular docs # Copy the regular documents
dstPath = os.path.join(workPath, 'doc') dstPath = os.path.join(workPath, 'doc')
os.mkdir(dstPath) os.mkdir(dstPath)
for aFile in ['QuickStartGuide.pdf', 'ReadMe.txt']: for aFile in ['QuickStartGuide.pdf', 'ReadMe.txt']:
@@ -61,6 +168,9 @@ def buildRelease(aVersion, aDoNotClean=False):
srcPath = os.path.join(installPath, 'lib', aLib) srcPath = os.path.join(installPath, 'lib', aLib)
shutil.copy2(srcPath, dstPath) shutil.copy2(srcPath, dstPath)
# Copy the (newly) built DistMaker (binary) library
shutil.copy2(jarBinPathFN, dstPath)
# Copy the scripts # Copy the scripts
dstPath = os.path.join(workPath, 'script') dstPath = os.path.join(workPath, 'script')
os.mkdir(dstPath) os.mkdir(dstPath)
@@ -73,7 +183,7 @@ def buildRelease(aVersion, aDoNotClean=False):
os.makedirs(dstPath + '/apple') os.makedirs(dstPath + '/apple')
os.makedirs(dstPath + '/background') os.makedirs(dstPath + '/background')
os.makedirs(dstPath + '/launch4j') 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) srcPath = os.path.join(installPath, 'template', aFile)
shutil.copy2(srcPath, dstPath + '/' + aFile) shutil.copy2(srcPath, dstPath + '/' + aFile)
@@ -88,7 +198,10 @@ def buildRelease(aVersion, aDoNotClean=False):
if aDoNotClean == False: if aDoNotClean == False:
shutil.rmtree(workPath) 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=''): def errPrintln(aMessage=''):
@@ -98,31 +211,20 @@ def errPrintln(aMessage=''):
sys.stderr.write(aMessage + '\n') sys.stderr.write(aMessage + '\n')
def getDistMakerVersion(): def getLibraryBinVersion(aJarBinPath):
"""Method that will return the version of the distMaker.jar file that resides """Method that will return the version of the specified binary jar file.
in the library path. The version of the DistMaker release is defined by the The binary jar file will be queried (package distmaker.DistApp) and the
value associated with the disMaker.jar file. Any failures will result in the output will be parsed. Any failures will result in the abrupt exit of this
abrupt exit of this script.""" 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)
try: try:
cpStr = ':lib/'.join(libList) cpStr = aJarBinPath
cpStr = 'lib/' + cpStr cpStr += ':lib/' + ':lib/'.join(libList)
exeCmd = ['java', '-cp', cpStr, 'distMaker.DistApp', '--version'] exeCmd = [javaExe, '-cp', cpStr, 'distMaker.DistApp', '--version']
output = subprocess.check_output(exeCmd).decode('utf-8') output = subprocess.check_output(exeCmd).decode('utf-8')
version = output.split()[1] version = output.split()[1].strip()
return version return version
except: except Exception as aExp:
errPrintln('\tPlease run the buildDistMakerBin.jardesc from your workspace.') traceback.print_exc()
exit(-1) exit(-1)
@@ -144,19 +246,20 @@ if __name__ == "__main__":
# Logic to capture Ctrl-C and bail # Logic to capture Ctrl-C and bail
signal.signal(signal.SIGINT, handleSignal) signal.signal(signal.SIGINT, handleSignal)
# Require python version 2.7 or later # Require python version 3.6 or later
targVer = (2, 7) targVer = (3, 6)
if sys.version_info < targVer: if sys.version_info < targVer:
print('The installed version of python is too old. Please upgrade.') print('The installed version of python is too old. Please upgrade.')
print(' Current version: ' + '.'.join(str(i) for i in sys.version_info)) print(' Current version: ' + '.'.join(str(i) for i in sys.version_info))
print(' Require version: ' + '.'.join(str(i) for i in targVer)) print(' Require version: ' + '.'.join(str(i) for i in targVer))
sys.exit(-1) 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 = 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('--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('--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('--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 # Intercept any request for a help message and bail
argv = sys.argv; argv = sys.argv;
@@ -168,12 +271,11 @@ if __name__ == "__main__":
parser.formatter_class.max_help_position = 50 parser.formatter_class.max_help_position = 50
args = parser.parse_args() args = parser.parse_args()
# Get the version of DistMaker we are building
version = getDistMakerVersion()
print('DistMaker version: ' + version)
# TODO: Finish this functionality # TODO: Finish this functionality
if args.doFullBuild == True: if args.doFullBuild == True:
print("Unsupported action: [--doFullBuild]. Skipping...") print("Unsupported action: [--doFullBuild]. Skipping...")
buildRelease(version, args.doNotClean) # Ensure required applications are installed
checkForInstalledApps()
buildRelease(args.extraTag, args.doNotClean)