This commit is contained in:
2025-08-14 15:24:13 +02:00
parent c2bb4007ae
commit 78fcef565e
5 changed files with 107 additions and 2 deletions

View File

@@ -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")
}
}
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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} "\$@"