From c07d662b635fc2a38ebf41988cae6b602eb7141a Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 12 Nov 2026 12:15:13 -0500 Subject: [PATCH 1/8] build: install pre-built `grapes` --- bin/install-clara | 22 +++------ build-coatjava.sh | 15 +++--- common-tools/clara-io/pom.xml | 25 ---------- common-tools/{djl-runtime => copycat}/pom.xml | 49 ++++++++++++++++--- common-tools/pom.xml | 2 +- pom.xml | 11 +++++ 6 files changed, 68 insertions(+), 56 deletions(-) rename common-tools/{djl-runtime => copycat}/pom.xml (63%) diff --git a/bin/install-clara b/bin/install-clara index 3c89e2dfa4..a5dca84c23 100755 --- a/bin/install-clara +++ b/bin/install-clara @@ -3,8 +3,7 @@ set -e # Default versions: -grapes=2.26 -clara=5.0.2 +clara=main function error() { echo -e "\n$usage\n\n Use option '-h' for more usage guidance.\n\nERROR: $@" @@ -56,24 +55,18 @@ function cleanup() { } function build_clara { - #git clone --branch $clara --depth 1 https://code.jlab.org/hallb/clas12/clara-java - git clone --depth 1 https://code.jlab.org/hallb/clas12/clara-java + git clone --branch $clara --depth 1 https://code.jlab.org/hallb/clas12/clara-java cd clara-java && CLARA_HOME=$1 ./gradlew deploy && cd - } -function build_grapes { - git clone --depth 1 --branch $grapes https://code.jlab.org/hallb/clas12/coatjava/grapes.git - cd grapes && mvn package && cd - -} - trap cleanup EXIT # Configure: debug=0 args=() -usage="Usage: install-clara [-v] [-c COATJAVA] [-f CLARA] [-g GRAPES] PATH" +usage="Usage: install-clara [-v] [-c COATJAVA] [-f CLARA] PATH" info=""" -- The default CLARA / GRAPES versions are $clara / $grapes +- The default CLARA version is $clara - COATJAVA can also be specified as a local installation directory - If the COATJAVA version is not specified, it will try to auto-detect it. - [-v adds verbosity and disables cleanup]""" @@ -84,7 +77,7 @@ do -h|--help) echo -e "\n$usage" && echo -e "$info" && exit 1 ;; -f) clara="$2" && shift && shift ;; -c) coatjava="$2" && shift && shift ;; - -g) grapes="$2" && shift && shift ;; + -g) echo "WARNING: option -g has been removed" >&2 && shift && shift ;; -v) let debug=$debug+1 && shift ;; -*|--*) echo -e "$usage\n\nUnknown option: $1" && exit 1 ;; *) args+=("$1") && shift ;; @@ -138,7 +131,4 @@ mkdir -p clara-cre/plugins/clas12/config cp -Lr $coatjava/etc $coatjava/bin $coatjava/lib* clara-cre/plugins/clas12 # GRAPES: -echo -e "\nRetrieving GRAPES version $grapes ..." -build_grapes $PWD/grapes -mkdir -p clara-cre/plugins/grapes/lib/core/ -cp grapes/target/grapes-*core*.jar clara-cre/plugins/grapes/lib/core/ +cp $coatjava/lib/utils/grapes*.jar clara-cre/plugins/grapes/lib/core/ diff --git a/build-coatjava.sh b/build-coatjava.sh index dea396ae15..a69489b5c1 100755 --- a/build-coatjava.sh +++ b/build-coatjava.sh @@ -386,22 +386,23 @@ fi # - seem to break thread safety of `mvn install`, i.e., we'd need to run `mvn package` first, then `mvn install` # - we just want copy the produced JAR files to a final installation directory, so the following bash code gets the job done without drama install_jars() { - src=$(dirname $1) + src=$1 dest=$2 [ $# -ge 3 ] && filter="$3" || filter='*.jar' - if [ -d $src/target ]; then - for f in $(find $src/target -name $filter); do + if [ -d $src ]; then + for f in $(find $src -name $filter); do mkdir -p $dest cp $f $dest/ done fi } for pom in $(find reconstruction -name pom.xml); do - install_jars $pom $prefix_dir/lib/services + install_jars $(dirname $pom)/target $prefix_dir/lib/services done -install_jars common-tools/djl-runtime/pom.xml $prefix_dir/lib/services -install_jars common-tools/clara-io/pom.xml $prefix_dir/lib/utils 'jclara-*.jar' -install_jars common-tools/coat-libs/pom.xml $prefix_dir/lib/clas 'coat-libs-*.jar' +install_jars common-tools/copycat/target/lib/djl $prefix_dir/lib/services +install_jars common-tools/copycat/target/lib/grapes $prefix_dir/lib/utils +install_jars common-tools/copycat/target/lib/clara $prefix_dir/lib/utils 'jclara-*.jar' +install_jars common-tools/coat-libs/target $prefix_dir/lib/clas 'coat-libs-*.jar' echo "installed coatjava to: $prefix_dir" # install clara diff --git a/common-tools/clara-io/pom.xml b/common-tools/clara-io/pom.xml index c942080a04..8ebd8c9a59 100644 --- a/common-tools/clara-io/pom.xml +++ b/common-tools/clara-io/pom.xml @@ -55,29 +55,4 @@ - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-jclara - package - - copy-dependencies - - - ${project.build.directory}/lib/utils - org.jlab.coda - jclara - jar - - - - - - - diff --git a/common-tools/djl-runtime/pom.xml b/common-tools/copycat/pom.xml similarity index 63% rename from common-tools/djl-runtime/pom.xml rename to common-tools/copycat/pom.xml index 5c6d998062..76b4a5a1d6 100644 --- a/common-tools/djl-runtime/pom.xml +++ b/common-tools/copycat/pom.xml @@ -2,12 +2,9 @@ 4.0.0 - + - djl-runtime + copycat pom @@ -63,6 +60,17 @@ + + + org.jlab.coda + jclara + + + + org.jlab.jnp + grapes + + ai.djl api @@ -103,8 +111,35 @@ copy-dependencies - ${project.build.directory}/lib/services - runtime + ${project.build.directory}/lib/djl + ai.djl,ai.djl.pytorch + runtime + + + + copy-jclara + package + + copy-dependencies + + + ${project.build.directory}/lib/clara + org.jlab.coda + jclara + jar + + + + copy-grapes + package + + copy-dependencies + + + ${project.build.directory}/lib/grapes + org.jlab.jnp + grapes + jar diff --git a/common-tools/pom.xml b/common-tools/pom.xml index 852f74101f..96c4eda547 100644 --- a/common-tools/pom.xml +++ b/common-tools/pom.xml @@ -29,7 +29,7 @@ clara-io clas-tracking clas-decay-tools - djl-runtime + copycat coat-libs diff --git a/pom.xml b/pom.xml index 26f2b9ab3b..d4b91f550b 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,11 @@ clasweb-clas12maven https://clasweb.jlab.org/.clas12maven + + + code.jlab.org-hallb-grapes + https://code.jlab.org/api/v4/projects/776/packages/maven + @@ -124,6 +129,12 @@ 6.2 + + org.jlab.jnp + grapes + 2.27-SNAPSHOT + + org.jlab.coda jevio From 1f1ba694b08382df27d02e46fa53515468564e1b Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 12 Nov 2026 15:34:58 -0500 Subject: [PATCH 2/8] fix: split the modules --- build-coatjava.sh | 7 +- common-tools/copycat/README.md | 3 + common-tools/copycat/djl/pom.xml | 111 +++++++++++++++++++++++ common-tools/copycat/jlab/pom.xml | 63 +++++++++++++ common-tools/copycat/pom.xml | 141 ++---------------------------- 5 files changed, 186 insertions(+), 139 deletions(-) create mode 100644 common-tools/copycat/README.md create mode 100644 common-tools/copycat/djl/pom.xml create mode 100644 common-tools/copycat/jlab/pom.xml diff --git a/build-coatjava.sh b/build-coatjava.sh index a69489b5c1..d2155d4ea0 100755 --- a/build-coatjava.sh +++ b/build-coatjava.sh @@ -399,10 +399,9 @@ install_jars() { for pom in $(find reconstruction -name pom.xml); do install_jars $(dirname $pom)/target $prefix_dir/lib/services done -install_jars common-tools/copycat/target/lib/djl $prefix_dir/lib/services -install_jars common-tools/copycat/target/lib/grapes $prefix_dir/lib/utils -install_jars common-tools/copycat/target/lib/clara $prefix_dir/lib/utils 'jclara-*.jar' -install_jars common-tools/coat-libs/target $prefix_dir/lib/clas 'coat-libs-*.jar' +install_jars common-tools/copycat/djl/target/lib $prefix_dir/lib/services +install_jars common-tools/copycat/jlab/target/lib $prefix_dir/lib/utils +install_jars common-tools/coat-libs/target $prefix_dir/lib/clas 'coat-libs-*.jar' echo "installed coatjava to: $prefix_dir" # install clara diff --git a/common-tools/copycat/README.md b/common-tools/copycat/README.md new file mode 100644 index 0000000000..b0c4103c8a --- /dev/null +++ b/common-tools/copycat/README.md @@ -0,0 +1,3 @@ +# copycat + +POMs to install runtime dependencies to our prefix class path. diff --git a/common-tools/copycat/djl/pom.xml b/common-tools/copycat/djl/pom.xml new file mode 100644 index 0000000000..319c016b4b --- /dev/null +++ b/common-tools/copycat/djl/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + + org.jlab.clas + copycat-djl + pom + + + org.jlab.clas + copycat + 14.2.4-SNAPSHOT + + + + + linux-x86_64 + + + + + + djl-linux-x86_64 + + + unix + Linux + amd64 + + + + linux-x86_64 + + + + djl-osx-aarch64 + + + mac + aarch64 + + + + osx-aarch64 + + + + djl-win-x86_64 + + + windows + amd64 + + + + win-x86_64 + + + + + + + ai.djl + api + + + ai.djl + model-zoo + + + ai.djl.pytorch + pytorch-model-zoo + + + ai.djl.pytorch + pytorch-engine + + + ai.djl.pytorch + pytorch-native-cpu + ${djl.pytorch.classifier} + + + ai.djl.pytorch + pytorch-jni + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-djl-runtime + package + + copy-dependencies + + + ${project.build.directory}/lib + runtime + + + + + + + + diff --git a/common-tools/copycat/jlab/pom.xml b/common-tools/copycat/jlab/pom.xml new file mode 100644 index 0000000000..6bfdcaba89 --- /dev/null +++ b/common-tools/copycat/jlab/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + org.jlab.clas + copycat-jlab + pom + + + org.jlab.clas + copycat + 14.2.4-SNAPSHOT + + + + + org.jlab.coda + jclara + + + org.jlab.jnp + grapes + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-jclara + package + + copy-dependencies + + + ${project.build.directory}/lib + org.jlab.coda + jclara + jar + + + + copy-grapes + package + + copy-dependencies + + + ${project.build.directory}/lib + org.jlab.jnp + grapes + jar + + + + + + + + diff --git a/common-tools/copycat/pom.xml b/common-tools/copycat/pom.xml index 76b4a5a1d6..7a8ae17c2b 100644 --- a/common-tools/copycat/pom.xml +++ b/common-tools/copycat/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - - + org.jlab.clas copycat + 14.2.4-SNAPSHOT pom @@ -13,138 +13,9 @@ 14.2.4-SNAPSHOT - - - linux-x86_64 - - - - - - djl-linux-x86_64 - - - unix - Linux - amd64 - - - - linux-x86_64 - - - - djl-osx-aarch64 - - - mac - aarch64 - - - - osx-aarch64 - - - - djl-win-x86_64 - - - windows - amd64 - - - - win-x86_64 - - - - - - - - org.jlab.coda - jclara - - - - org.jlab.jnp - grapes - - - - ai.djl - api - - - ai.djl - model-zoo - - - ai.djl.pytorch - pytorch-model-zoo - - - ai.djl.pytorch - pytorch-engine - - - ai.djl.pytorch - pytorch-native-cpu - ${djl.pytorch.classifier} - - - ai.djl.pytorch - pytorch-jni - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-djl-runtime - package - - copy-dependencies - - - ${project.build.directory}/lib/djl - ai.djl,ai.djl.pytorch - runtime - - - - copy-jclara - package - - copy-dependencies - - - ${project.build.directory}/lib/clara - org.jlab.coda - jclara - jar - - - - copy-grapes - package - - copy-dependencies - - - ${project.build.directory}/lib/grapes - org.jlab.jnp - grapes - jar - - - - - - + + djl + jlab + From 1fa6e81c7a00789832b57574a0d80ed96f7b1fca Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 12 Nov 2026 15:47:24 -0500 Subject: [PATCH 3/8] fix: clara installation warnings --- bin/install-clara | 2 +- libexec/env.sh | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/install-clara b/bin/install-clara index a5dca84c23..aa230a7be5 100755 --- a/bin/install-clara +++ b/bin/install-clara @@ -55,7 +55,7 @@ function cleanup() { } function build_clara { - git clone --branch $clara --depth 1 https://code.jlab.org/hallb/clas12/clara-java + git clone --branch $clara --depth 1 https://code.jlab.org/hallb/clas12/maven/clara-java.git cd clara-java && CLARA_HOME=$1 ./gradlew deploy && cd - } diff --git a/libexec/env.sh b/libexec/env.sh index 543a1f81bd..0e05f99cf3 100644 --- a/libexec/env.sh +++ b/libexec/env.sh @@ -36,11 +36,10 @@ if [ "${1-}" != '--no-classpath' ]; then done unset jar_dirs export COATJAVA_CLASSPATH + # set log manager + export JAVA_OPTS="-Djava.util.logging.manager=org.jlab.logging.SplitLogManager ${JAVA_OPTS-}" fi -# set log manager -export JAVA_OPTS="-Djava.util.logging.manager=org.jlab.logging.SplitLogManager ${JAVA_OPTS-}" - # additional environment variables for groovy or interactive use # - call as `source $0 groovy` or `source $0 jshell` if [ $# -ge 1 ]; then From b397d1c1d8eaf15ae5da6d61495ac21858b862bf Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 12 Nov 2026 15:50:06 -0500 Subject: [PATCH 4/8] fix: mkdir --- bin/install-clara | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/install-clara b/bin/install-clara index aa230a7be5..38efc1b2ac 100755 --- a/bin/install-clara +++ b/bin/install-clara @@ -131,4 +131,5 @@ mkdir -p clara-cre/plugins/clas12/config cp -Lr $coatjava/etc $coatjava/bin $coatjava/lib* clara-cre/plugins/clas12 # GRAPES: +mkdir -p clara-cre/plugins/grapes/lib/core cp $coatjava/lib/utils/grapes*.jar clara-cre/plugins/grapes/lib/core/ From 3c779e243fc758bfa2ef666aa7fdf3cf4143ccb4 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 12 Nov 2026 16:37:28 -0500 Subject: [PATCH 5/8] fix: keep grapes outta the coatjava classpath --- bin/install-clara | 2 +- build-coatjava.sh | 7 ++++--- common-tools/copycat/jlab/pom.xml | 13 +++++++++++-- pom.xml | 5 ----- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/bin/install-clara b/bin/install-clara index 38efc1b2ac..b9d05674d3 100755 --- a/bin/install-clara +++ b/bin/install-clara @@ -132,4 +132,4 @@ cp -Lr $coatjava/etc $coatjava/bin $coatjava/lib* clara-cre/plugins/clas12 # GRAPES: mkdir -p clara-cre/plugins/grapes/lib/core -cp $coatjava/lib/utils/grapes*.jar clara-cre/plugins/grapes/lib/core/ +cp $coatjava/libexec/grapes*.jar clara-cre/plugins/grapes/lib/core/ diff --git a/build-coatjava.sh b/build-coatjava.sh index d2155d4ea0..70cf38bf82 100755 --- a/build-coatjava.sh +++ b/build-coatjava.sh @@ -399,9 +399,10 @@ install_jars() { for pom in $(find reconstruction -name pom.xml); do install_jars $(dirname $pom)/target $prefix_dir/lib/services done -install_jars common-tools/copycat/djl/target/lib $prefix_dir/lib/services -install_jars common-tools/copycat/jlab/target/lib $prefix_dir/lib/utils -install_jars common-tools/coat-libs/target $prefix_dir/lib/clas 'coat-libs-*.jar' +install_jars common-tools/copycat/djl/target/lib $prefix_dir/lib/services +install_jars common-tools/copycat/jlab/target/lib/clara $prefix_dir/lib/utils +install_jars common-tools/copycat/jlab/target/lib/grapes $prefix_dir/libexec # keep grapes outta the coatjava classpath +install_jars common-tools/coat-libs/target $prefix_dir/lib/clas 'coat-libs-*.jar' echo "installed coatjava to: $prefix_dir" # install clara diff --git a/common-tools/copycat/jlab/pom.xml b/common-tools/copycat/jlab/pom.xml index 6bfdcaba89..3118d63adb 100644 --- a/common-tools/copycat/jlab/pom.xml +++ b/common-tools/copycat/jlab/pom.xml @@ -12,6 +12,15 @@ 14.2.4-SNAPSHOT + + + + + code.jlab.org-hallb-grapes + https://code.jlab.org/api/v4/projects/776/packages/maven + + + org.jlab.coda @@ -36,7 +45,7 @@ copy-dependencies - ${project.build.directory}/lib + ${project.build.directory}/lib/clara org.jlab.coda jclara jar @@ -49,7 +58,7 @@ copy-dependencies - ${project.build.directory}/lib + ${project.build.directory}/lib/grapes org.jlab.jnp grapes jar diff --git a/pom.xml b/pom.xml index d4b91f550b..d6ebe74693 100644 --- a/pom.xml +++ b/pom.xml @@ -29,11 +29,6 @@ clasweb-clas12maven https://clasweb.jlab.org/.clas12maven - - - code.jlab.org-hallb-grapes - https://code.jlab.org/api/v4/projects/776/packages/maven - From fe110b7580e6bec87df46890b4d4b9581c65a11a Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 12 Nov 2026 17:38:47 -0500 Subject: [PATCH 6/8] build: 227 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d6ebe74693..4c869d1666 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,7 @@ org.jlab.jnp grapes - 2.27-SNAPSHOT + 2.27 From d1b346a47f06a793f5d4d60a11e3055d54deeda7 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 12 Nov 2026 18:34:56 -0500 Subject: [PATCH 7/8] ci: test --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ etc/services/grapes.yaml | 21 +++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 etc/services/grapes.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbf70ee5b2..4a5c0120a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -338,6 +338,32 @@ jobs: retention-days: 1 path: rec.hipo + test_grapes: + needs: test_clara + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - name: Set up JDK + uses: actions/setup-java@v6.1.0 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.java_distribution }} + - uses: actions/download-artifact@v8 + with: + name: test_clara_result + - uses: actions/download-artifact@v8 + with: + name: build_ubuntu-latest + - name: untar build + run: tar xzf coatjava.tar.gz + - name: run test + run: ./bin/run-clara -y ./etc/services/grapes.yaml -t 4 -n 500 -c ./clara -o ./tmp rec.hipo + - name: hipo-utils -info + run: | + for f in rec.hipo $(find tmp -type f -name '*.hipo'); do + coatjava/bin/hipo-utils -info $f + done + test_coatjava: needs: [ build ] strategy: @@ -556,6 +582,7 @@ jobs: - spotbugs - test_decoder - test_clara + - test_grapes - test_coatjava_macos - unit_tests runs-on: ubuntu-latest diff --git a/etc/services/grapes.yaml b/etc/services/grapes.yaml new file mode 100644 index 0000000000..9c109d74b6 --- /dev/null +++ b/etc/services/grapes.yaml @@ -0,0 +1,21 @@ +io-services: + reader: + class: org.jlab.jnp.grapes.io.HipoFrameReader + name: HipoFrameReader + writer: + class: org.jlab.jnp.grapes.io.HipoFrameWriter + name: HipoFrameWriter +services: + - class: org.jlab.jnp.grapes.services.ElastWagon + name: elast +configuration: + io-services: + writer: + compression: 2 + services: + elast: + id: 1 + beamEnergy: 10.6 + targetPDG: 2212 +mime-types: + - binary/data-hipo-frame From 8e3b8203ac21f9cb3937e840f3fbfe2a51fafad2 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 12 Nov 2026 18:49:03 -0500 Subject: [PATCH 8/8] fix: unclara --- .github/workflows/ci.yml | 4 +++- common-tools/copycat/pom.xml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a5c0120a5..222a97bcdc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -355,7 +355,9 @@ jobs: with: name: build_ubuntu-latest - name: untar build - run: tar xzf coatjava.tar.gz + run: | + tar xzf clara.tar.gz + tar xzf coatjava.tar.gz - name: run test run: ./bin/run-clara -y ./etc/services/grapes.yaml -t 4 -n 500 -c ./clara -o ./tmp rec.hipo - name: hipo-utils -info diff --git a/common-tools/copycat/pom.xml b/common-tools/copycat/pom.xml index 7a8ae17c2b..fedc2e5d93 100644 --- a/common-tools/copycat/pom.xml +++ b/common-tools/copycat/pom.xml @@ -14,6 +14,7 @@ + djl jlab