diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml new file mode 100644 index 0000000..7c27d0e --- /dev/null +++ b/.github/workflows/build-publish.yml @@ -0,0 +1,40 @@ +name: Build and Publish + +# Thin caller around the shared reusable workflow in +# NrgXnat/xnat-ci-workflows. Plugin variant — no GHCR Docker image +# (plugins ship a jar to JFrog only). + +on: + push: + branches: + - main + - develop + - 'releases/*' # RC / release branches, e.g. releases/1.6.0-rc + workflow_dispatch: + inputs: + publish_jfrog: + description: 'Publish jar to JFrog Artifactory (nrgxnat)' + type: boolean + default: false + +permissions: + contents: read + packages: write # required by reusable workflow's publish-ghcr job (gated by if: inputs.publish-ghcr but parsed at startup) + +jobs: + build-publish: + uses: NrgXnat/xnat-ci-workflows/.github/workflows/gradle-build-publish.yml@v1 + with: + # ──── Artifact ──── + artifact-glob: 'build/libs/*.jar' + artifact-name: 'nihss-plugin-jar' + + # ──── JFrog ──── + # On any push to a triggered branch: publish. On dispatch: only when publish_jfrog ticked. + publish-jfrog: ${{ github.event_name == 'push' || inputs.publish_jfrog }} + + # publish-ghcr deliberately omitted — defaults to false in the reusable workflow. + + # secrets: inherit passes XNAT_ARTIFACTORY_USER/TOKEN (org-level) and + # the auto-injected GITHUB_TOKEN through to the reusable workflow. + secrets: inherit diff --git a/.github/workflows/release-cut-rc.yml b/.github/workflows/release-cut-rc.yml new file mode 100644 index 0000000..b54e824 --- /dev/null +++ b/.github/workflows/release-cut-rc.yml @@ -0,0 +1,37 @@ +name: Release - Cut RC Branch + +# Thin caller around the shared reusable workflow in NrgXnat/xnat-ci-workflows. +# Cuts a `releases/-rc` branch from source_branch and bumps +# source_branch to the next dev version. All release-cut logic lives in the +# reusable workflow; this file only defines our triggers + inputs. + +on: + workflow_dispatch: + inputs: + next_dev_version: + description: 'Next dev SNAPSHOT version (e.g. 1.7.0-SNAPSHOT)' + type: string + required: true + source_branch: + description: 'Branch to cut from (default: develop)' + type: string + required: false + default: develop + trigger_build: + description: 'After cut, dispatch build/publish on RC and source_branch' + type: boolean + required: false + default: true + +permissions: + contents: write + actions: write # dispatch build-publish workflow + +jobs: + cut-rc: + uses: NrgXnat/xnat-ci-workflows/.github/workflows/gradle-release-cut-rc.yml@v1 + with: + next_dev_version: ${{ inputs.next_dev_version }} + source_branch: ${{ inputs.source_branch }} + trigger_build: ${{ inputs.trigger_build }} + secrets: inherit diff --git a/.github/workflows/release-promote.yml b/.github/workflows/release-promote.yml new file mode 100644 index 0000000..09416fb --- /dev/null +++ b/.github/workflows/release-promote.yml @@ -0,0 +1,37 @@ +name: Release - Promote RC to Main + +# Thin caller around the shared reusable workflow in NrgXnat/xnat-ci-workflows. +# Promotes a stabilized RC branch to a tagged release on target_main. All +# release-promote logic lives in the reusable workflow; this file only defines +# our triggers + inputs. + +on: + workflow_dispatch: + inputs: + rc_branch: + description: 'RC branch to promote (e.g. releases/1.6.0-rc)' + type: string + required: true + target_main: + description: 'Branch to merge into (default main)' + type: string + required: false + default: main + trigger_build: + description: 'After promote, dispatch build/publish on target_main' + type: boolean + required: false + default: true + +permissions: + contents: write # push RC/main + create tag + actions: write # dispatch build-publish workflow + +jobs: + promote: + uses: NrgXnat/xnat-ci-workflows/.github/workflows/gradle-release-promote.yml@v1 + with: + rc_branch: ${{ inputs.rc_branch }} + target_main: ${{ inputs.target_main }} + trigger_build: ${{ inputs.trigger_build }} + secrets: inherit diff --git a/build.gradle b/build.gradle index 1884109..1f0cf8d 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { ext { - vXnat = "1.8.5-SNAPSHOT" + vXnat = "1.10.1-SNAPSHOT" } } @@ -20,10 +20,9 @@ plugins { id "java" id "maven-publish" id "com.dorongold.task-tree" version "1.5" - id "com.palantir.git-version" version "0.12.1" + id "com.palantir.git-version" version "3.0.0" id "io.franzbecker.gradle-lombok" version "5.0.0" - id "io.spring.dependency-management" version "1.0.11.RELEASE" - id "net.linguica.maven-settings" version "0.5" + id "io.spring.dependency-management" version "1.1.7" id "org.nrg.xnat.build.xnat-data-builder" version "${vXnat}" } @@ -38,25 +37,55 @@ repositories { mavenCentral() } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} dependencyManagement.imports { mavenBom "org.nrg:parent:${vXnat}" } +lombok { + version = "1.18.34" + sha256 = "1ea5ad6c6afcff902d75072b2aaa6695585aebee9f12127e15c0036ba95d2918" +} + dependencies { implementation("org.nrg.xnat:web") { transitive = false } - implementation("org.nrg.xnat:xnat-data-models") { - transitive = false - } + // xnat-data-models merged into xnat-web in monorepo 1.10 implementation "org.nrg.xdat:core" implementation "org.apache.commons:commons-lang3" implementation "org.slf4j:slf4j-api" - implementation "log4j:log4j" + implementation "log4j:log4j:1.2.17" + + // Compile-only deps that xnat-web no longer surfaces on consumer compileClasspath in monorepo 1.10.1+ + implementation("turbine:turbine") { + exclude group: "commons-dbcp" + exclude group: "commons-email" + exclude group: "commons-pool" + exclude group: "fulcrum" + exclude group: "javax.activation", module: "activation" + exclude group: "javax.mail" + exclude group: "javax.servlet" + exclude group: "jython" + exclude group: "xalan" + exclude group: "xml-apis" + exclude group: "log4j", module: "log4j" + exclude group: "berkeleydb" + exclude group: "javax.sql" + exclude group: "jndi" + exclude group: "mysql" + exclude group: "tomcat" + exclude group: "xerces" + exclude group: "velocity", module: "texen" + exclude group: "jamon", module: "jamon" + } + compileOnly("org.apache.velocity:velocity") { transitive = false } + compileOnly "javax.servlet:javax.servlet-api" testImplementation "junit:junit" testImplementation "org.springframework:spring-test" @@ -83,7 +112,7 @@ configurations { } jacoco { - toolVersion = dependencyManagement.importedProperties["jacoco.version"] + toolVersion = "0.8.12" } jacocoTestReport { @@ -130,19 +159,19 @@ try { isCleanTag = false } -ext.gitManifest = manifest { - attributes "Application-Name": project.description, - "Build-Date": buildDate, - "Build-Number": buildNumber, - "Implementation-Version": project.version, - "Implementation-Sha": gitHash, - "Implementation-Sha-Full": gitHashFull, - "Implementation-Commit": commitDistance, - "Implementation-LastTag": lastTag, - "Implementation-Branch": branchName, - "Implementation-CleanTag": isCleanTag, - "Implementation-Dirty": isDirty -} +ext.gitManifestAttrs = [ + "Application-Name" : project.description, + "Build-Date" : buildDate, + "Build-Number" : buildNumber, + "Implementation-Version" : project.version, + "Implementation-Sha" : gitHash, + "Implementation-Sha-Full" : gitHashFull, + "Implementation-Commit" : commitDistance, + "Implementation-LastTag" : lastTag, + "Implementation-Branch" : branchName, + "Implementation-CleanTag" : isCleanTag, + "Implementation-Dirty" : isDirty +] logger.info """ Building artifacts with manifest attributes: @@ -160,17 +189,17 @@ Building artifacts with manifest attributes: """ task sourceJar(type: Jar, dependsOn: classes) { - classifier "sources" + archiveClassifier.set("sources") manifest { - from gitManifest + attributes gitManifestAttrs } from sourceSets.main.allSource } task javadocJar(type: Jar) { - classifier "javadoc" + archiveClassifier.set("javadoc") manifest { - from gitManifest + attributes gitManifestAttrs } from javadoc.destinationDir } @@ -179,7 +208,7 @@ jar { dependsOn test, sourceJar, javadocJar enabled = true manifest { - from gitManifest + attributes gitManifestAttrs } } @@ -188,7 +217,7 @@ task xnatPluginJar(type: Jar) { zip64 true archiveClassifier.set "xpl" manifest { - from gitManifest + attributes gitManifestAttrs } // files and folders with "-dev" or "--xx" in their name // will not be in the compiled jar @@ -241,9 +270,17 @@ publishing { repositories { maven { - url project.version.endsWith("-SNAPSHOT") ? "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local" : "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local" - // The value for name must match in ~/.m2/settings.xml name = "XNAT_Artifactory" + url = project.version.toString().endsWith("-SNAPSHOT") + ? "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local" + : "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local" + // CI injects ORG_GRADLE_PROJECT_artifactoryUser/Token env vars (Gradle maps + // these to project properties). Local devs can set artifactoryUser/Token in + // ~/.gradle/gradle.properties. Mirrors monorepo's buildSrc convention. + credentials { + username = (project.findProperty("artifactoryUser") ?: System.getenv("ARTIFACTORY_USER")) ?: "" + password = (project.findProperty("artifactoryToken") ?: System.getenv("ARTIFACTORY_TOKEN")) ?: "" + } } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 92f06b5..daee2e0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists