From 6bda431723cf40b87ad640e40579f50f54a5a2d8 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 22 Dec 2025 14:11:01 -0800 Subject: [PATCH 1/7] Fix ArrayOfStringsSummary and add .mvn to root. --- .gitignore | 1 + .../tuple/strings/ArrayOfStringsSummary.java | 35 +++++----- .../strings/ArrayOfStringsSketchTest.java | 25 +++++-- .../ArrayOfStringsSummary_Issue699.java | 69 +++++++++++++++++++ 4 files changed, 106 insertions(+), 24 deletions(-) create mode 100644 src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java diff --git a/.gitignore b/.gitignore index f03c5078f..f0a5c0998 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ # Additional tools .clover/ +.mvn/ # OSX files **/.DS_Store diff --git a/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java b/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java index 4197cd285..5008fecd5 100644 --- a/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java +++ b/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java @@ -36,19 +36,16 @@ */ public final class ArrayOfStringsSummary implements UpdatableSummary { - private String[] stringArr = null; + private String[] stringArr = new String[] {}; //empty string array; /** * No argument constructor. */ - ArrayOfStringsSummary() { //required for ArrayOfStringsSummaryFactory - stringArr = null; - } + ArrayOfStringsSummary() {} //required for ArrayOfStringsSummaryFactory //Used by copy() and in test ArrayOfStringsSummary(final String[] stringArr) { - this.stringArr = stringArr.clone(); - checkNumNodes(stringArr.length); + update(stringArr); } //used by fromMemorySegment and in test @@ -87,10 +84,20 @@ public final class ArrayOfStringsSummary implements UpdatableSummary { this.stringArr = stringArr; } + //From UpdatableSummary + + @Override + public final ArrayOfStringsSummary update(final String[] value) { + if (value == null) { stringArr = new String[] {}; } + else { stringArr = value.clone(); } + return this; + } + + //From Summary + @Override public ArrayOfStringsSummary copy() { - final ArrayOfStringsSummary nodes = new ArrayOfStringsSummary(stringArr); - return nodes; + return new ArrayOfStringsSummary(stringArr); } @Override @@ -112,16 +119,6 @@ public byte[] toByteArray() { return out; } - //From UpdatableSummary - - @Override - public ArrayOfStringsSummary update(final String[] value) { - if (stringArr == null) { - stringArr = value.clone(); - } - return this; - } - //From Object @Override @@ -139,6 +136,8 @@ public boolean equals(final Object summary) { return thisStr.equals(thatStr); } + //Local + /** * Returns the nodes array for this summary. * @return the nodes array for this summary. diff --git a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java index ef39e6b90..b5cf4a39a 100644 --- a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java +++ b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java @@ -49,22 +49,30 @@ public void checkSketch() { for (int i = 0; i < len; i++) { sketch1.update(strArrArr[i], strArrArr[i]); } + println("Sketch1"); + printSummaries(sketch1.iterator()); + sketch1.update(strArrArr[0], strArrArr[0]); //insert duplicate + println("Sketch1 updated with a duplicate"); printSummaries(sketch1.iterator()); - byte[] array = sketch1.toByteArray(); - MemorySegment wseg = MemorySegment.ofArray(array); + + MemorySegment wseg = MemorySegment.ofArray(sketch1.toByteArray()); ArrayOfStringsTupleSketch sketch2 = new ArrayOfStringsTupleSketch(wseg); + println("Sketch2 = Sketch1 via SerDe"); printSummaries(sketch2.iterator()); - checkSummaries(sketch2, sketch2); + checkSummariesEqual(sketch2, sketch2); String[] strArr3 = {"g", "h" }; sketch2.update(strArr3, strArr3); - + println("Sketch2 with a new row"); + printSummaries(sketch2.iterator()); + TupleUnion union = new TupleUnion<>(new ArrayOfStringsSummarySetOperations()); union.union(sketch1); union.union(sketch2); CompactTupleSketch csk = union.getResult(); - //printSummaries(csk.iterator()); + println("Result of union of Sketch1, Sketch2"); + printSummaries(csk.iterator()); assertEquals(csk.getRetainedEntries(), 4); TupleIntersection inter = @@ -72,17 +80,21 @@ public void checkSketch() { inter.intersect(sketch1); inter.intersect(sketch2); csk = inter.getResult(); + println("Intersect Sketch1, Sketch2"); + printSummaries(csk.iterator()); assertEquals(csk.getRetainedEntries(), 3); TupleAnotB aNotB = new TupleAnotB<>(); aNotB.setA(sketch2); aNotB.notB(sketch1); csk = aNotB.getResult(true); + println("AnotB(Sketch2, Sketch1)"); + printSummaries(csk.iterator()); assertEquals(csk.getRetainedEntries(), 1); } - private static void checkSummaries(ArrayOfStringsTupleSketch sk1, ArrayOfStringsTupleSketch sk2) { + private static void checkSummariesEqual(ArrayOfStringsTupleSketch sk1, ArrayOfStringsTupleSketch sk2) { TupleSketchIterator it1 = sk1.iterator(); TupleSketchIterator it2 = sk2.iterator(); while(it1.next() && it2.next()) { @@ -100,6 +112,7 @@ static void printSummaries(TupleSketchIterator it) { } println(""); } + println(""); } @Test diff --git a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java new file mode 100644 index 000000000..febe924f9 --- /dev/null +++ b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java @@ -0,0 +1,69 @@ +package org.apache.datasketches.tuple.strings; + +import static org.apache.datasketches.common.Util.LS; + +import org.apache.datasketches.theta.UpdatableThetaSketch; +import org.apache.datasketches.tuple.TupleSketchIterator; +import org.apache.datasketches.tuple.TupleUnion; +import org.testng.annotations.Test; + +public class ArrayOfStringsSummary_Issue699 { + UpdatableThetaSketch thetaSk = UpdatableThetaSketch.builder().build(); + ArrayOfStringsTupleSketch tupleSk = new ArrayOfStringsTupleSketch(); + TupleUnion union = new TupleUnion<>(new ArrayOfStringsSummarySetOperations()); + + @Test + void go() { + thetaSk.update("a"); + thetaSk.update("b"); + thetaSk.update("c"); + + tupleSk.update("a", new String[] {"x", "y"}); + tupleSk.update("b", new String[] {"z"}); + tupleSk.update("e", new String[] {"x", "z"}); + + println("Print Tuple Summary before union"); + printSummaries(tupleSk.iterator()); + + union.union(tupleSk); + union.union(thetaSk, new ArrayOfStringsSummary()); //enable this or the next + //union.union(thetaSk, new ArrayOfStringsSummary(new String[] {"u", "v"})); //optional association + + println("Print Tuple Summary after union"); + printSummaries(union.getResult().iterator()); + } + + @Test + void checkCopy() { + ArrayOfStringsSummary aoss = new ArrayOfStringsSummary(); + ArrayOfStringsSummary aoss2 = aoss.copy(); + } + + @Test + void checkToByteArray() { + ArrayOfStringsSummary aoss = new ArrayOfStringsSummary(); + byte[] bytes = aoss.toByteArray(); + println("byte[].length = " + bytes.length); + } + + + static void printSummaries(TupleSketchIterator it) { + while (it.next()) { + String[] strArr = it.getSummary().getValue(); + if (strArr.length == 0) { print("-"); } //illustrates an empty string array + for (String s : strArr) { + print(s + ", "); + } + println(""); + } + println(""); + } + + private static void println(Object o) { + print(o + LS); + } + + private static void print(Object o) { + //System.out.print(o.toString()); + } +} From b1d9bb80a9ef8864d7328d0efae2e858d6ba858d Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 22 Dec 2025 14:27:14 -0800 Subject: [PATCH 2/7] Add maven.config to .mvn --- .mvn/maven.config | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .mvn/maven.config diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 000000000..268ab97a0 --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1,6 @@ +# suppresses the warning: +# Direct modification of testCompileSourceRoots through add() is deprecated and will not work in Maven 4.0.0. Please use the add/remove methods instead. +# If you're using a plugin that causes this warning, please upgrade to the latest version and report an issue if the warning persists. +# To disable these warnings, set -Dmaven.project.sourceRoots.warningsDisabled=true on the command line, in the .mvn/maven.config file, +# or in project POM properties. +-Dmaven.project.sourceRoots.warningsDisabled=true From 20eeb809cf976a10f8dd03d60c1df2074e715dc6 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 22 Dec 2025 14:48:11 -0800 Subject: [PATCH 3/7] clean up test to remove unused variable. --- .../tuple/strings/ArrayOfStringsSummary_Issue699.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java index febe924f9..2c623b7c6 100644 --- a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java +++ b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java @@ -36,7 +36,7 @@ void go() { @Test void checkCopy() { ArrayOfStringsSummary aoss = new ArrayOfStringsSummary(); - ArrayOfStringsSummary aoss2 = aoss.copy(); + aoss.copy(); //if null this will throw } @Test From 58fbbf97864832be18421a48ad13dce4e3a2ea50 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 22 Dec 2025 14:59:13 -0800 Subject: [PATCH 4/7] Added license. --- .../ArrayOfStringsSummary_Issue699.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java index 2c623b7c6..7e68fc1de 100644 --- a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java +++ b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.datasketches.tuple.strings; import static org.apache.datasketches.common.Util.LS; From 60b0b0ce0989106315840f7b1cfe56b136cfc3b1 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Tue, 30 Dec 2025 11:44:38 -0800 Subject: [PATCH 5/7] Fixed Typo and simplified key values. --- .../tuple/strings/ArrayOfStringsSketchTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java index b5cf4a39a..b9aaf576e 100644 --- a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java +++ b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java @@ -47,12 +47,12 @@ public void checkSketch() { String[][] strArrArr = {{"a","b"},{"c","d"},{"e","f"}}; int len = strArrArr.length; for (int i = 0; i < len; i++) { - sketch1.update(strArrArr[i], strArrArr[i]); + sketch1.update(i, strArrArr[i]); } println("Sketch1"); printSummaries(sketch1.iterator()); - sketch1.update(strArrArr[0], strArrArr[0]); //insert duplicate + sketch1.update(0, strArrArr[0]); //insert duplicate println("Sketch1 updated with a duplicate"); printSummaries(sketch1.iterator()); @@ -60,10 +60,10 @@ public void checkSketch() { ArrayOfStringsTupleSketch sketch2 = new ArrayOfStringsTupleSketch(wseg); println("Sketch2 = Sketch1 via SerDe"); printSummaries(sketch2.iterator()); - checkSummariesEqual(sketch2, sketch2); + checkSummariesEqual(sketch1, sketch2); String[] strArr3 = {"g", "h" }; - sketch2.update(strArr3, strArr3); + sketch2.update(3, strArr3); println("Sketch2 with a new row"); printSummaries(sketch2.iterator()); @@ -121,7 +121,7 @@ public void checkCopyCtor() { String[][] strArrArr = {{"a","b"},{"c","d"},{"e","f"}}; int len = strArrArr.length; for (int i = 0; i < len; i++) { - sk1.update(strArrArr[i], strArrArr[i]); + sk1.update(i, strArrArr[i]); } assertEquals(sk1.getRetainedEntries(), 3); final ArrayOfStringsTupleSketch sk2 = sk1.copy(); From 7c7f6f17ff37d37f9ebaf9117da3edc0c63d9991 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Sun, 4 Jan 2026 17:03:50 -0800 Subject: [PATCH 6/7] Update pom and try to fix javadoc.yml --- .github/workflows/javadoc.yml | 63 +++-- pom.xml | 463 ++++++++++++++-------------------- 2 files changed, 228 insertions(+), 298 deletions(-) diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index 22bde6d5e..a501686b5 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -8,17 +8,16 @@ on: workflow_dispatch: inputs: tag_ref: - description: 'Existing Git Tag to deploy (e.g., 1.0.0)' + description: 'Existing Git Tag to deploy (e.g., 1.0.0):' required: true - default: '1.0.0' # Default can be left blank or set to a placeholder + # Default can be left blank or set to a placeholder + default: '99.0.0' # unlikely to conflict if accidentally used. jobs: build-and-deploy-javadoc: runs-on: ubuntu-latest permissions: contents: write - pages: write - id-token: write steps: - name: Checkout Code at Specified Tag @@ -35,33 +34,45 @@ jobs: cache: 'maven' - name: Build and Generate Javadoc + # POM is configured to output to target/site/apidocs run: mvn javadoc:javadoc - - name: Deploy Javadoc to gh-pages/docs/${TAG} + - name: Deploy Javadoc via Worktree env: - GH_PAGES_EMAIL: noreply@github.com - GH_PAGES_NAME: github-actions[bot] - GIT_TAG_NAME: ${{ github.event.inputs.tag_ref }} - TARGET_DIR: docs/${{ github.event.inputs.tag_ref }} - run: | - # 1. Configure Git user - git config user.email "${GH_PAGES_EMAIL}" - git config user.name "${GH_PAGES_NAME}" + TAG_NAME: ${{ github.event.inputs.tag_ref }} - # 2. Fetch and checkout the existing gh-pages branch - git fetch origin gh-pages:gh-pages - git checkout gh-pages + run: | + # 1. Configure Git Identity + git config user.email "noreply@github.com" + git config user.name "github-actions[bot]" - # 3. Clean up any previous documentation for this tag (optional, but safer) - rm -rf $TARGET_DIR + # 2. Ensure gh-pages exists and is fetched + git fetch origin gh-pages --depth=1 || git branch gh-pages + + # 3. Create a worktree for the gh-pages branch in a separate folder + # This prevents switching the main directory and losing the 'target' folder + git worktree add ./gh-pages-dir origin/gh-pages + + # 4. Prepare the target directory inside the worktree + TARGET_PATH="gh-pages-dir/docs/$TAG_NAME" + mkdir -p $TARGET_PATH + + # 5. Copy the generated docs (using . to copy contents, not the folder itself) + cp -a target/site/apidocs/. $TARGET_PATH/ + + # 6. Commit and Push from the worktree directory + cd gh-pages-dir + git add . - # 4. Create the versioned directory structure - mkdir -p $TARGET_DIR + # Only commit and push if there are actual changes + if git diff --staged --quiet; then + echo "No changes detected for Javadoc $TAG_NAME." + else + git commit -m "Manual Javadoc deployment for tag $TAG_NAME" + git push origin gh-pages + fi - # 5. Copy the generated Javadoc files into the versioned directory - cp -r target/reports/apidocs/* $TARGET_DIR/ + # 7. Cleanup the worktree + cd .. + git worktree remove ./gh-pages-dir - # 6. Add the new directory and files, commit, and push - git add $TARGET_DIR - git commit -m "Manual Javadoc deployment for tag ${GIT_TAG_NAME} into $TARGET_DIR" - git push origin gh-pages diff --git a/pom.xml b/pom.xml index ab514cef5..d0364662b 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,6 @@ under the License. 2.19.1 1.0.0 - 0.17 @@ -143,343 +142,263 @@ under the License. - - - org.apache.maven.plugins - maven-assembly-plugin - ${maven-assembly-plugin.version} - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - true - ${java.version} - - -J${jvm.options} - - - - - - org.apache.maven.plugins - maven-dependency-plugin - ${maven-dependency-plugin.version} - - - - - - org.apache.maven.plugins - maven-deploy-plugin - ${maven-deploy-plugin.version} - - - - org.apache.maven.plugins - maven-enforcer-plugin - ${maven-enforcer-plugin.version} - - - enforce-banned-dependencies - - enforce - - - - - [25,) - - - [${maven.version},) - - - - - - com.google.code.findbugs:annotations - - - - true - - - - - - - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} - - - default-jar - package - - jar - - - - default-test-jar - package - - test-jar - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven-javadoc-plugin.version} - - true - public - all,-missing - ${java.version} - - -J${jvm.options} - - - - - attach-javadocs - - jar - - - - - - - org.apache.maven.plugins - maven-release-plugin - ${maven-release-plugin.version} - - - - org.apache.maven.plugins - maven-source-plugin - ${maven-source-plugin.version} - - - attach-sources - package - - jar-no-fork - - - - attach-test-sources - package - - test-jar-no-fork - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-failsafe-plugins.version} - - 1 - true - ${argLine} ${jvm.options} - false - false - true - ${project.build.directory}/test-output/${maven.build.timestamp} - ${testng.generate-java-files},${testng.check-cpp-files},${testng.check-go-files},${testng.check-cpp-historical-files} - - - - - org.apache.maven.plugins - maven-toolchains-plugin - ${maven-toolchains-plugin.version} - - - - toolchain - - - - - - - ${java.version} - - - - - - - org.apache.rat - apache-rat-plugin - ${apache-rat-plugin.version} - - - verify - - check - - - - - ${project.basedir}/rat - true - - - StandardCollection - **/*.yaml - **/*.yml - **/.* - **/test/resources/**/*.txt - **/git.properties - **/doc/** - **/*.sk - LICENSE - NOTICE - **/*.code-workspace - - - - - - org.codehaus.mojo - versions-maven-plugin - ${versions-maven-plugin.version} - - - - - org.eluder.coveralls - coveralls-maven-plugin - ${coveralls-maven-plugin.version} - - ${coveralls-repo-token} - - - - - - org.jacoco - jacoco-maven-plugin - ${jacoco-maven-plugin.version} - - - default-prepare-agent - - prepare-agent - - - - default-report - test - - report - - - - - - - pl.project13.maven - git-commit-id-plugin - ${git-commit-id-plugin.version} - - - - io.github.zlika - reproducible-build-maven-plugin - ${reproducible-build-maven-plugin.version} - - - - strip-jar - - - - - - - - org.apache.maven.plugins maven-assembly-plugin + ${maven-assembly-plugin.version} + org.apache.maven.plugins maven-compiler-plugin + ${maven-compiler-plugin.version} + + true + ${java.version} + + -J${jvm.options} + + + org.apache.maven.plugins maven-dependency-plugin + ${maven-dependency-plugin.version} + + + org.apache.maven.plugins maven-deploy-plugin + ${maven-deploy-plugin.version} + org.apache.maven.plugins maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-banned-dependencies + + enforce + + + + + [25,) + + + [${maven.version},) + + + + + + com.google.code.findbugs:annotations + + + + true + + + + org.apache.maven.plugins maven-jar-plugin + ${maven-jar-plugin.version} + + + default-jar + package + + jar + + + + default-test-jar + package + + test-jar + + + + org.apache.maven.plugins maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + ${project.reporting.outputDirectory} + ${project.reporting.outputDirectory} + ${project.reporting.outputDirectory} + apidocs + true + public + all,-missing + ${java.version} + + -J${jvm.options} + + + + + attach-javadocs + + jar + + + + org.apache.maven.plugins maven-release-plugin + ${maven-release-plugin.version} + org.apache.maven.plugins maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + package + + jar-no-fork + + + + attach-test-sources + package + + test-jar-no-fork + + + + org.apache.maven.plugins maven-surefire-plugin + ${maven-surefire-failsafe-plugins.version} + + 1 + true + ${argLine} ${jvm.options} + false + false + true + ${project.build.directory}/test-output/${maven.build.timestamp} + ${testng.generate-java-files},${testng.check-cpp-files},${testng.check-go-files}, +${testng.check-cpp-historical-files} + + org.apache.maven.plugins maven-toolchains-plugin + ${maven-toolchains-plugin.version} + + + + toolchain + + + + + + + ${java.version} + + + + org.apache.rat apache-rat-plugin + ${apache-rat-plugin.version} + + + verify + + check + + + + + ${project.basedir}/rat + true + + + StandardCollection + **/*.yaml + **/*.yml + **/.* + **/test/resources/**/*.txt + **/git.properties + **/doc/** + **/*.sk + LICENSE + NOTICE + **/*.code-workspace + + + org.codehaus.mojo versions-maven-plugin + ${versions-maven-plugin.version} + + org.eluder.coveralls coveralls-maven-plugin + ${coveralls-maven-plugin.version} + + ${coveralls-repo-token} + + + org.jacoco jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + default-prepare-agent + + prepare-agent + + + + default-report + test + + report + + + + pl.project13.maven git-commit-id-plugin + ${git-commit-id-plugin.version} - - io.github.zlika - reproducible-build-maven-plugin - + From ae402611f256c4ea5e3df1dc6b13c148ac4348d9 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Sun, 4 Jan 2026 18:15:50 -0800 Subject: [PATCH 7/7] Corrections to javadoc.yml --- .github/workflows/javadoc.yml | 113 ++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 54 deletions(-) diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index a501686b5..4aaf2867f 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -10,8 +10,7 @@ on: tag_ref: description: 'Existing Git Tag to deploy (e.g., 1.0.0):' required: true - # Default can be left blank or set to a placeholder - default: '99.0.0' # unlikely to conflict if accidentally used. + default: '99.0.0' # unlikely to conflict if accidentally used. Can be left blank jobs: build-and-deploy-javadoc: @@ -19,60 +18,66 @@ jobs: permissions: contents: write - steps: - - name: Checkout Code at Specified Tag - uses: actions/checkout@v5 - with: - ref: ${{ github.event.inputs.tag_ref }} # from manual trigger input - fetch-depth: 0 + steps: + - name: Checkout Code at Specified Tag + uses: actions/checkout@v5 + with: + ref: ${{ github.event.inputs.tag_ref }} # from manual trigger input + fetch-depth: 0 - - name: Set up JDK - uses: actions/setup-java@v4 - with: - java-version: '25' - distribution: 'temurin' - cache: 'maven' + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '25' + distribution: 'temurin' + cache: 'maven' - - name: Build and Generate Javadoc - # POM is configured to output to target/site/apidocs - run: mvn javadoc:javadoc + - name: Build and Generate Javadoc # POM is configured to output to target/site/apidocs + run: mvn javadoc:javadoc - - name: Deploy Javadoc via Worktree - env: - TAG_NAME: ${{ github.event.inputs.tag_ref }} + - name: Deploy Javadoc via Worktree + env: + TAG_NAME: ${{ github.event.inputs.tag_ref }} + run: | + # 1. Initialize error tracking + EXIT_CODE=0 + + # 2. Configure Git Identity + git config user.email "noreply@github.com" + git config user.name "github-actions[bot]" + + # 3. Ensure gh-pages exists and is fetched + git fetch origin gh-pages --depth=1 || git branch gh-pages + + # 4. Create worktree for the gh-pages branch in a separate folder + git worktree add ./gh-pages-dir origin/gh-pages + + # 5. Deployment Logic in a subshell to capture exit code + ( + set -e # Exit subshell on any internal error + TARGET_PATH="gh-pages-dir/docs/$TAG_NAME" # target directory inside the worktree + mkdir -p "$TARGET_PATH" + cp -a target/site/apidocs/. "$TARGET_PATH/" + + cd gh-pages-dir + git add . + + if git diff --staged --quiet; then + echo "No changes detected for Javadoc $TAG_NAME." + else + git commit -m "Manual Javadoc deployment for tag $TAG_NAME" + git push origin gh-pages + fi + ) || EXIT_CODE=$? + + # 6. Cleanup (Always runs) + echo "Cleaning up worktree..." + git worktree remove --force ./gh-pages-dir || true + + # 7. Final exit based on subshell success + exit $EXIT_CODE - run: | - # 1. Configure Git Identity - git config user.email "noreply@github.com" - git config user.name "github-actions[bot]" - - # 2. Ensure gh-pages exists and is fetched - git fetch origin gh-pages --depth=1 || git branch gh-pages - - # 3. Create a worktree for the gh-pages branch in a separate folder - # This prevents switching the main directory and losing the 'target' folder - git worktree add ./gh-pages-dir origin/gh-pages - - # 4. Prepare the target directory inside the worktree - TARGET_PATH="gh-pages-dir/docs/$TAG_NAME" - mkdir -p $TARGET_PATH - - # 5. Copy the generated docs (using . to copy contents, not the folder itself) - cp -a target/site/apidocs/. $TARGET_PATH/ - - # 6. Commit and Push from the worktree directory - cd gh-pages-dir - git add . - - # Only commit and push if there are actual changes - if git diff --staged --quiet; then - echo "No changes detected for Javadoc $TAG_NAME." - else - git commit -m "Manual Javadoc deployment for tag $TAG_NAME" - git push origin gh-pages - fi - - # 7. Cleanup the worktree - cd .. - git worktree remove ./gh-pages-dir + - name: Confirm Deployment + if: success() + run: echo "Javadoc for ${{ github.event.inputs.tag_ref }} is now live on gh-pages."