From 49b31b74ba136c0efb188299af1e7f6e167ae72d Mon Sep 17 00:00:00 2001 From: gobbo_a Date: Thu, 4 Sep 2025 15:49:18 +0200 Subject: [PATCH] Add publishing to build script --- build.gradle | 50 +++++++++++++++++++++++++++++--- correlation/gradle.properties | 2 ++ gradle.properties | 2 ++ screenpanel-sf/gradle.properties | 2 ++ 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index ea4b86b..cafc305 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,10 @@ plugins { - id("com.gradleup.shadow") version "8.3.8" id("com.netflix.nebula.rpm") version "11.11.2" id("maven-publish") } +import org.redline_rpm.header.Flags + allprojects { version = '2.0.0' group = 'ch.psi' @@ -13,7 +14,11 @@ allprojects { ext.deploy_type= 'java' ext.readonly = true ext.plugin = '' - + ext.rpm_requires = [] + //Not forcing workbench to same version, as it can break other apps. + //If specific minimal version is needed then must be specified in project. + ext.workbench_version= '2.0.0' + repositories { mavenLocal() mavenCentral() @@ -42,7 +47,6 @@ allprojects { subprojects { plugins.apply('java') plugins.apply('java-library') - plugins.apply('com.gradleup.shadow') plugins.apply('com.netflix.nebula.rpm') plugins.apply('maven-publish') @@ -102,6 +106,8 @@ subprojects { def file_mode = readonly ? 0644: 0777 //def dir_mode = readonly ? 0755: 0777 def app_args_var = "APP_${app_name.replace('-', '_').toUpperCase()}_ARGS" + def proj_requires = project.rpm_requires + def workbench_version = project.workbench_version project.tasks.register("rpm", Rpm) { doFirst { @@ -111,7 +117,11 @@ subprojects { rpmFile.delete() } } - requires 'pshell-workbench' + //requires 'pshell-workbench' + requires("pshell-workbench", workbench_version, Flags.GREATER | Flags.EQUAL) + proj_requires.each { dep -> + requires dep + } dependsOn 'jar' release = app_release @@ -187,6 +197,38 @@ subprojects { link(sys_bin + bin_file_name, app_path + '/bin/' + bin_file_name) link(sys_bin + app_name, sys_bin + bin_file_name) } + + project.afterEvaluate { + project.publishing { + publications { + MyPublication(MavenPublication) { + from project.components.java + if (project.tasks.findByName('sourcesJar')) { + //artifact project.tasks.sourcesJar + } + if (project.tasks.findByName('javadocJar')) { + //artifact project.tasks.javadocJar + } + if (project.tasks.findByName('rpm')) { + artifact project.tasks.rpm + } + groupId = project.group + artifactId = project.name + version = project.version + } + } + + repositories { + maven { + credentials { + username artifactoryUser + password artifactoryPwd + } + url = artifactoryUrlRel + } + } + } + } } } diff --git a/correlation/gradle.properties b/correlation/gradle.properties index a934e31..38794b7 100644 --- a/correlation/gradle.properties +++ b/correlation/gradle.properties @@ -1,3 +1,5 @@ action.custom-1=rpm action.custom-1.args=--configure-on-demand -w -x check -x test rpm +action.custom-2=publish +action.custom-2.args=--configure-on-demand -w -x check -x test publish action.debug.args=debug --args="-b -d -l -k -g -q -statusbar -size=1000x700 -console_log=SEVERE -m ./src/main/pkg -laf=dark -pipeline_server localhost:8889 -camera_server localhost:8888 -epics_config ch.psi.jcae.ContextFactory.addressList=localhost:54321" diff --git a/gradle.properties b/gradle.properties index ce3e376..ba16e57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,5 @@ netbeans.hint.jdkPlatform=JDK_21 action.custom-1=rpm action.custom-1.args=--configure-on-demand -w -x check -x test rpm +action.custom-2=publish +action.custom-2.args=--configure-on-demand -w -x check -x test publish diff --git a/screenpanel-sf/gradle.properties b/screenpanel-sf/gradle.properties index 16f26de..7309350 100644 --- a/screenpanel-sf/gradle.properties +++ b/screenpanel-sf/gradle.properties @@ -1 +1,3 @@ +action.custom-1=publish +action.custom-1.args=--configure-on-demand -w -x check -x test publish action.debug.args=debug --args="-b -d -l -k -n -q -console_log=SEVERE -buffer_size=10 -size=1000x800 -p ScreenPanelSF -laf=dark -pipeline_server localhost:8889 -camera_server localhost:8888"