diff --git a/build.gradle b/build.gradle index aeb622c..316d0d5 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,6 @@ allprojects { version = '2.0.0' group = 'ch.psi' ext.release = '1' - ext.app_jdk = '21' ext.jar_suffix = 'fat' @@ -78,5 +77,98 @@ subprojects { } } - } + def app_name = project.name + def app_version = project.version.toString() + def app_title = project.ext.title.toString() + def app_description = project.ext.desc.toString() + def app_release = project.ext.release.toString() + def jar_suffix = project.ext.jar_suffix.toString() + def package_name = project.name + def app_path = '/opt/' + package_name + "/" + app_version + def jar_file_name = app_name + "-" + app_version + "-" + jar_suffix + ".jar"; + def jar_file_path = app_path + '/lib/' + jar_file_name; + def main_class = project.mainClass + def sys_bin ='/usr/local/bin/' + def sys_lib ='/usr/local/lib/' + def bin_file_name = "${app_name}-${app_version}" + def java_file_name = main_class + ".java" + + project.tasks.register("rpm", Rpm) { + doFirst { + def rpmFile = archiveFile.get().asFile + if (rpmFile.exists()) { + //Workaround to nebula plugin bug: must first remove old RPMs otherwise the payload digest is corrupted. + rpmFile.delete() + } + } + requires 'pshell-workbench' + + release = app_release + version = app_version + arch 'noarch' + os LINUX + reproducibleFileOrder = true + + title = app_title + description = app_description + summary = description + url = 'https://github.com/paulscherrerinstitute/jstriptool' + vendor = 'Paul Scherrer Institute' + license = 'GPL' + packageName = package_name + packageGroup = 'Applications' + packageDescription = 'This application is part of PShell scripting environment for experiments.' + + user = 'root' + permissionGroup 'root' + addParentDirs true + + directory(app_path, 755) + directory(app_path + '/lib', 755) + directory(app_path + '/bin', 755) + + into app_path + + from ('src/main/java') { + print(java_file_name ) + include java_file_name + into 'lib' + fileMode 0644 + } + + from('scripts') { + into 'bin' + //Add version to startup script name + rename { String fileName -> + fileName == "app_startup" ? bin_file_name : fileName + } + expand([ + "app_name": app_name, + "app_version": app_version, + "jar_file": jar_file_path, + "java_file": app_path + '/lib/' + main_class + ".java" + ]) + fileMode 0755 + } + link(sys_bin + bin_file_name, app_path + '/bin/' + bin_file_name) + link(sys_bin + app_name, sys_bin + bin_file_name) + } + + + } } + +def rpmsTask = tasks.register('rpms') { + description = 'Generates all RPMs for app subprojects' + group = 'rpm' +} + +afterEvaluate { + tasks.named('rpms') { + subprojects.each { subproj -> + if (subproj.hasProperty('mainClass')) { + dependsOn("${subproj.path}:rpm") + } + } + } +} \ No newline at end of file diff --git a/screenpanel-sf/build.gradle b/screenpanel-sf/build.gradle index be9b1d5..eac08d5 100644 --- a/screenpanel-sf/build.gradle +++ b/screenpanel-sf/build.gradle @@ -1,5 +1,7 @@ description = 'screenpanel-sf' ext.mainClass = hasProperty('mainClass') ? mainClass : 'ScreenPanelSF' +ext.title = 'ScreenPanel' +ext.desc = 'ScreenPanel customization for SwissFEL cameras' dependencies { implementation 'ch.psi:workbench:' + version diff --git a/screenpanel-sls/build.gradle b/screenpanel-sls/build.gradle index 1d880e5..7dbd480 100644 --- a/screenpanel-sls/build.gradle +++ b/screenpanel-sls/build.gradle @@ -1,5 +1,7 @@ description = 'screenpanel-sls' ext.mainClass = hasProperty('mainClass') ? mainClass : 'ScreenPanelSLS' +ext.title = 'ScreenPanel' +ext.desc = 'ScreenPanel customization for SLS cameras' dependencies { implementation 'ch.psi:workbench:' + version diff --git a/screenpanel-sls/gradle.properties b/screenpanel-sls/gradle.properties index f4123b9..2ad0954 100644 --- a/screenpanel-sls/gradle.properties +++ b/screenpanel-sls/gradle.properties @@ -1 +1,3 @@ +action.custom-1=rpm +action.custom-1.args=--configure-on-demand -w -x check -x test rpm action.debug.args=debug --args="-b -d -l -k -n -q -console_log=SEVERE -buffer_size=10 -size=1000x800 -p ScreenPanelSLS -laf=dark -pipeline_server localhost:8889 -camera_server localhost:8888" diff --git a/screenpanel-sls/scripts/app_startup b/screenpanel-sls/scripts/app_startup new file mode 100644 index 0000000..1d776ce --- /dev/null +++ b/screenpanel-sls/scripts/app_startup @@ -0,0 +1,7 @@ +#!/bin/sh +APP_ARGS_NAME=\$(echo "APP_${app_name}" | tr '[:lower:]' '[:upper:]')_ARGS +APP_ARGS_NAME=\${APP_ARGS_NAME//-/_} + +# Run the JAR with all passed arguments +#exec pshell-workbench -b -d -l -k -n -q -console_log=SEVERE -buffer_size=10 -size=1000x800 -p ${java_file} \${!APP_ARGS_NAME} "\$@" +exec pshell-workbench -b -d -l -k -n -q -console_log=SEVERE -size=1000x800 -p ${java_file} \${!APP_ARGS_NAME} "\$@"