diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..db61f64 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +# Normalize all text files to LF in the repository (checkout follows the platform). +* text=auto + +# Scripts that must keep a specific line ending regardless of platform. +gradlew text eol=lf +*.sh text eol=lf +*.bat text eol=crlf +*.cmd text eol=crlf + +# Binary assets — never touch line endings. +*.rar binary +*.jar binary +*.png binary +*.jpg binary +*.gif binary +*.ico binary diff --git a/.github/workflows/bp-main.yml b/.github/workflows/bp-main.yml index d3edea3..aa7dbdc 100644 --- a/.github/workflows/bp-main.yml +++ b/.github/workflows/bp-main.yml @@ -9,46 +9,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK - uses: actions/setup-java@v5 - with: - java-version: '21' - distribution: 'temurin' - - name: Install Nats Server - run: | - pkill -9 nats-server 2>/dev/null || true - mkdir -p ~/.local/bin - cd $GITHUB_WORKSPACE - git clone https://github.com/nats-io/nats-server.git - cd nats-server - go build -o ~/.local/bin/nats-server - nats-server -v - - name: Check out code - uses: actions/checkout@v4 - - name: Compile and Test - run: | - pushd batch-publish - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd batch-publish - ./gradlew javadoc - popd - - name: Publish Snapshot - run: | - pushd batch-publish - ./gradlew -i publishToSonatype - popd - - name: Clean up - if: always() - run: pkill -9 nats-server 2>/dev/null || true + uses: synadia-io/workflows/.github/workflows/java-standard-main.yml@main + with: + project-dir: batch-publish + secrets: inherit diff --git a/.github/workflows/bp-pr.yml b/.github/workflows/bp-pr.yml index 0e5eb97..f2b5a08 100644 --- a/.github/workflows/bp-pr.yml +++ b/.github/workflows/bp-pr.yml @@ -8,41 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK - uses: actions/setup-java@v5 - with: - java-version: '21' - distribution: 'temurin' - - name: Install Nats Server - run: | - pkill -9 nats-server 2>/dev/null || true - mkdir -p ~/.local/bin - cd $GITHUB_WORKSPACE - git clone https://github.com/nats-io/nats-server.git - cd nats-server - go build -o ~/.local/bin/nats-server - nats-server -v - - name: Check out code - uses: actions/checkout@v4 - - name: Build and Test - run: | - pushd batch-publish - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd batch-publish - ./gradlew javadoc - popd - - name: Clean up - if: always() - run: pkill -9 nats-server 2>/dev/null || true + uses: synadia-io/workflows/.github/workflows/java-standard-pr.yml@main + with: + project-dir: batch-publish + secrets: inherit diff --git a/.github/workflows/bp-release.yml b/.github/workflows/bp-release.yml index f4d192f..afb8416 100644 --- a/.github/workflows/bp-release.yml +++ b/.github/workflows/bp-release.yml @@ -6,41 +6,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: "release" - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK - uses: actions/setup-java@v5 - with: - java-version: '21' - distribution: 'temurin' - - name: Install Nats Server - run: | - pkill -9 nats-server 2>/dev/null || true - mkdir -p ~/.local/bin - cd $GITHUB_WORKSPACE - git clone https://github.com/nats-io/nats-server.git - cd nats-server - go build -o ~/.local/bin/nats-server - nats-server -v - - name: Check out code - uses: actions/checkout@v4 - - name: Compile and Test - run: | - pushd batch-publish - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify, Sign and Publish Release - run: | - pushd batch-publish - ./gradlew -i publishToSonatype closeAndReleaseSonatypeStagingRepository - popd - - name: Clean up - if: always() - run: pkill -9 nats-server 2>/dev/null || true + uses: synadia-io/workflows/.github/workflows/java-standard-release.yml@main + with: + project-dir: batch-publish + secrets: inherit diff --git a/.github/workflows/cr-main.yml b/.github/workflows/cr-main.yml index babbd7f..e782117 100644 --- a/.github/workflows/cr-main.yml +++ b/.github/workflows/cr-main.yml @@ -9,39 +9,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd chaos-runner - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd chaos-runner - ./gradlew javadoc - popd - - name: Publish Snapshot - run: | - pushd chaos-runner - ./gradlew -i publishToSonatype - popd + uses: synadia-io/workflows/.github/workflows/java-standard-main.yml@main + with: + project-dir: chaos-runner + secrets: inherit diff --git a/.github/workflows/cr-pr.yml b/.github/workflows/cr-pr.yml index 9d59f24..9a837ab 100644 --- a/.github/workflows/cr-pr.yml +++ b/.github/workflows/cr-pr.yml @@ -8,34 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd chaos-runner - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd chaos-runner - ./gradlew javadoc - popd + uses: synadia-io/workflows/.github/workflows/java-standard-pr.yml@main + with: + project-dir: chaos-runner + secrets: inherit diff --git a/.github/workflows/cr-release.yml b/.github/workflows/cr-release.yml index a01b18a..aa3397a 100644 --- a/.github/workflows/cr-release.yml +++ b/.github/workflows/cr-release.yml @@ -6,34 +6,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: "release" - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd chaos-runner - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify, Sign and Publish Release - run: | - pushd chaos-runner - ./gradlew -i signArchives signMavenJavaPublication publishToSonatype closeAndReleaseSonatypeStagingRepository - popd + uses: synadia-io/workflows/.github/workflows/java-standard-release.yml@main + with: + project-dir: chaos-runner + secrets: inherit diff --git a/.github/workflows/db-main.yml b/.github/workflows/db-main.yml index 8ba10a6..42a95ab 100644 --- a/.github/workflows/db-main.yml +++ b/.github/workflows/db-main.yml @@ -9,39 +9,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd direct-batch - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd direct-batch - ./gradlew javadoc - popd - - name: Publish Snapshot - run: | - pushd direct-batch - ./gradlew -i publishToSonatype - popd + uses: synadia-io/workflows/.github/workflows/java-standard-main.yml@main + with: + project-dir: direct-batch + secrets: inherit diff --git a/.github/workflows/db-pr.yml b/.github/workflows/db-pr.yml index 92f1b62..cc95a7e 100644 --- a/.github/workflows/db-pr.yml +++ b/.github/workflows/db-pr.yml @@ -8,34 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd direct-batch - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd direct-batch - ./gradlew javadoc - popd + uses: synadia-io/workflows/.github/workflows/java-standard-pr.yml@main + with: + project-dir: direct-batch + secrets: inherit diff --git a/.github/workflows/db-release.yml b/.github/workflows/db-release.yml index b1db120..8cd9323 100644 --- a/.github/workflows/db-release.yml +++ b/.github/workflows/db-release.yml @@ -6,34 +6,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: "release" - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd direct-batch - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify, Sign and Publish Release - run: | - pushd direct-batch - ./gradlew -i signArchives signMavenJavaPublication publishToSonatype closeAndReleaseSonatypeStagingRepository - popd + uses: synadia-io/workflows/.github/workflows/java-standard-release.yml@main + with: + project-dir: direct-batch + secrets: inherit diff --git a/.github/workflows/ekv-main.yml b/.github/workflows/ekv-main.yml index 30c4c98..cf57bd2 100644 --- a/.github/workflows/ekv-main.yml +++ b/.github/workflows/ekv-main.yml @@ -9,39 +9,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd encoded-kv - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd encoded-kv - ./gradlew javadoc - popd - - name: Publish Snapshot - run: | - pushd encoded-kv - ./gradlew -i publishToSonatype - popd + uses: synadia-io/workflows/.github/workflows/java-standard-main.yml@main + with: + project-dir: encoded-kv + secrets: inherit diff --git a/.github/workflows/ekv-pr.yml b/.github/workflows/ekv-pr.yml index 9b87465..1879353 100644 --- a/.github/workflows/ekv-pr.yml +++ b/.github/workflows/ekv-pr.yml @@ -8,34 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd encoded-kv - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd encoded-kv - ./gradlew javadoc - popd + uses: synadia-io/workflows/.github/workflows/java-standard-pr.yml@main + with: + project-dir: encoded-kv + secrets: inherit diff --git a/.github/workflows/ekv-release.yml b/.github/workflows/ekv-release.yml index dacdddc..bbb60d6 100644 --- a/.github/workflows/ekv-release.yml +++ b/.github/workflows/ekv-release.yml @@ -6,34 +6,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: "release" - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd encoded-kv - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify, Sign and Publish Release - run: | - pushd encoded-kv - ./gradlew -i signArchives signMavenJavaPublication publishToSonatype closeAndReleaseSonatypeStagingRepository - popd + uses: synadia-io/workflows/.github/workflows/java-standard-release.yml@main + with: + project-dir: encoded-kv + secrets: inherit diff --git a/.github/workflows/pubx-main.yml b/.github/workflows/pubx-main.yml index dfe93d7..497335b 100644 --- a/.github/workflows/pubx-main.yml +++ b/.github/workflows/pubx-main.yml @@ -9,39 +9,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd js-publish-extensions - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd js-publish-extensions - ./gradlew javadoc - popd - - name: Publish Snapshot - run: | - pushd js-publish-extensions - ./gradlew -i publishToSonatype - popd + uses: synadia-io/workflows/.github/workflows/java-standard-main.yml@main + with: + project-dir: js-publish-extensions + secrets: inherit diff --git a/.github/workflows/pubx-pr.yml b/.github/workflows/pubx-pr.yml index b9c9a82..489b734 100644 --- a/.github/workflows/pubx-pr.yml +++ b/.github/workflows/pubx-pr.yml @@ -8,34 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd js-publish-extensions - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd js-publish-extensions - ./gradlew javadoc - popd + uses: synadia-io/workflows/.github/workflows/java-standard-pr.yml@main + with: + project-dir: js-publish-extensions + secrets: inherit diff --git a/.github/workflows/pubx-release.yml b/.github/workflows/pubx-release.yml index efdf855..7a25edf 100644 --- a/.github/workflows/pubx-release.yml +++ b/.github/workflows/pubx-release.yml @@ -6,34 +6,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: "release" - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd js-publish-extensions - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify, Sign and Publish Release - run: | - pushd js-publish-extensions - ./gradlew -i signArchives signMavenJavaPublication publishToSonatype closeAndReleaseSonatypeStagingRepository - popd + uses: synadia-io/workflows/.github/workflows/java-standard-release.yml@main + with: + project-dir: js-publish-extensions + secrets: inherit diff --git a/.github/workflows/retrier-main.yml b/.github/workflows/retrier-main.yml index 7d51520..cb6e106 100644 --- a/.github/workflows/retrier-main.yml +++ b/.github/workflows/retrier-main.yml @@ -9,39 +9,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd retrier - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd retrier - ./gradlew javadoc - popd - - name: Publish Snapshot - run: | - pushd retrier - ./gradlew -i publishToSonatype - popd + uses: synadia-io/workflows/.github/workflows/java-standard-main.yml@main + with: + project-dir: retrier + secrets: inherit diff --git a/.github/workflows/retrier-pr.yml b/.github/workflows/retrier-pr.yml index 31beed7..ab9a156 100644 --- a/.github/workflows/retrier-pr.yml +++ b/.github/workflows/retrier-pr.yml @@ -8,34 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd retrier - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd retrier - ./gradlew javadoc - popd + uses: synadia-io/workflows/.github/workflows/java-standard-pr.yml@main + with: + project-dir: retrier + secrets: inherit diff --git a/.github/workflows/retrier-release.yml b/.github/workflows/retrier-release.yml index 853e04c..1ff6dce 100644 --- a/.github/workflows/retrier-release.yml +++ b/.github/workflows/retrier-release.yml @@ -6,34 +6,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: "release" - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd retrier - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify, Sign and Publish Release - run: | - pushd retrier - ./gradlew -i signArchives signMavenJavaPublication publishToSonatype closeAndReleaseSonatypeStagingRepository - popd + uses: synadia-io/workflows/.github/workflows/java-standard-release.yml@main + with: + project-dir: retrier + secrets: inherit diff --git a/.github/workflows/rm-main.yml b/.github/workflows/rm-main.yml index c9e62ea..de3ad44 100644 --- a/.github/workflows/rm-main.yml +++ b/.github/workflows/rm-main.yml @@ -9,39 +9,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd request-many - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd request-many - ./gradlew javadoc - popd - - name: Publish Snapshot - run: | - pushd request-many - ./gradlew -i publishToSonatype - popd + uses: synadia-io/workflows/.github/workflows/java-standard-main.yml@main + with: + project-dir: request-many + secrets: inherit diff --git a/.github/workflows/rm-pr.yml b/.github/workflows/rm-pr.yml index 5938636..3fd61df 100644 --- a/.github/workflows/rm-pr.yml +++ b/.github/workflows/rm-pr.yml @@ -8,34 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: ${{ github.event_name }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd request-many - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify Javadoc - run: | - pushd request-many - ./gradlew javadoc - popd + uses: synadia-io/workflows/.github/workflows/java-standard-pr.yml@main + with: + project-dir: request-many + secrets: inherit diff --git a/.github/workflows/rm-release.yml b/.github/workflows/rm-release.yml index d186d36..c395099 100644 --- a/.github/workflows/rm-release.yml +++ b/.github/workflows/rm-release.yml @@ -6,34 +6,7 @@ on: jobs: build: - runs-on: ubuntu-latest - env: - BUILD_EVENT: "release" - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - name: Install Nats Server - run: | - curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh - sudo mv nats-server /usr/local/bin - nats-server -v - - name: Check out code - uses: actions/checkout@v3 - - name: Compile and Test - run: | - pushd request-many - chmod +x gradlew && ./gradlew clean test - popd - - name: Verify, Sign and Publish Release - run: | - pushd request-many - ./gradlew -i signArchives signMavenJavaPublication publishToSonatype closeAndReleaseSonatypeStagingRepository - popd + uses: synadia-io/workflows/.github/workflows/java-standard-release.yml@main + with: + project-dir: request-many + secrets: inherit diff --git a/batch-publish/build.gradle b/batch-publish/build.gradle index 64b8a10..2355212 100644 --- a/batch-publish/build.gradle +++ b/batch-publish/build.gradle @@ -11,25 +11,22 @@ plugins { id("signing") } -def jarVersion = "0.2.3" +def jarVersion = "0.3.0" group = 'io.synadia' def isRelease = System.getenv("BUILD_EVENT") == "release" -def tc = System.getenv("TARGET_COMPATIBILITY"); -def targetCompat = tc == "21" ? JavaVersion.VERSION_21 : (tc == "17" ? JavaVersion.VERSION_17 : JavaVersion.VERSION_1_8) -def jarEnd = tc == "21" ? "-jdk21" : (tc == "17" ? "-jdk17" : "") -def jarAndArtifactName = "batch-publish" + jarEnd +def jarAndArtifactName = "batch-publish" version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" // version is the variable the build actually uses. System.out.println("Java: " + System.getProperty("java.version")) -System.out.println("Target Compatibility: " + targetCompat) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) System.out.println(group + ":" + jarAndArtifactName + ":" + version) java { sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = targetCompat + targetCompatibility = JavaVersion.VERSION_1_8 } repositories { @@ -39,10 +36,10 @@ repositories { } dependencies { - implementation 'io.nats:jnats:2.25.1' + implementation 'io.nats:jnats:2.26.3-SNAPSHOT' implementation 'org.jspecify:jspecify:1.0.0' - testImplementation 'io.nats:jnats-server-runner:1.2.8' + testImplementation 'io.nats:jnats-server-runner:3.1.1' testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1' testImplementation 'nl.jqno.equalsverifier:equalsverifier:4.2.3' @@ -70,11 +67,12 @@ tasks.register('bundle', Bundle) { jar { bundle { - bnd("Bundle-Name": "io.synadia.batch.publish", + bnd("Automatic-Module-Name": "io.synadia.batch.publish", + "Bundle-Name": "io.synadia.batch.publish", "Bundle-Vendor": "synadia.io", - "Bundle-Description": "JetStream Distributed Counters", - "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/counters", - "Target-Compatibility": "Java " + targetCompat + "Bundle-Description": "Batch Publish", + "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/batch-publish", + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 ) } } diff --git a/chaos-runner/build.gradle b/chaos-runner/build.gradle index 1719c8e..438c58e 100644 --- a/chaos-runner/build.gradle +++ b/chaos-runner/build.gradle @@ -1,27 +1,30 @@ import aQute.bnd.gradle.Bundle -import org.gradle.internal.os.OperatingSystem plugins { id 'java' id 'java-library' id 'maven-publish' id 'jacoco' - id 'com.github.kt3k.coveralls' version '2.12.0' - id 'biz.aQute.bnd.builder' version '5.1.2' - id "org.gradle.test-retry" version "1.1.9" - id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' + id 'biz.aQute.bnd.builder' version '7.1.0' + id "org.gradle.test-retry" version "1.6.4" + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'signing' } def jarVersion = "0.0.9" group = 'io.synadia' -def isMerge = System.getenv("BUILD_EVENT") == "push" def isRelease = System.getenv("BUILD_EVENT") == "release" +def jarAndArtifactName = "chaos-runner" + // version is the variable the build actually uses. version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" +System.out.println("Java: " + System.getProperty("java.version")) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) +System.out.println(group + ":" + jarAndArtifactName + ":" + version) + java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -38,15 +41,16 @@ repositories { } dependencies { - implementation 'io.nats:jnats-server-runner:2.0.2' + implementation 'io.nats:jnats-server-runner:3.1.1' // this is only for the example and the uber jar won't include it - implementation 'io.nats:jnats:2.25.1' + implementation 'io.nats:jnats:2.26.2' testImplementation 'commons-codec:commons-codec:1.18.0' - testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0' + testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1' + testImplementation 'org.junit.platform:junit-platform-launcher:1.14.3' testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.12.3' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:4.2.3' } sourceSets { @@ -68,13 +72,16 @@ tasks.register('bundle', Bundle) { } jar { - manifest { - attributes('Automatic-Module-Name': 'io.synadia.chaos.runner') + bundle { + bnd("Automatic-Module-Name": "io.synadia.chaos.runner", + "Bundle-Name": "io.synadia.chaos.runner", + "Bundle-Vendor": "synadia.io", + "Bundle-Description": "Chaos Runner", + "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/chaos-runner", + "Implementation-Version": jarVersion, + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 + ) } - bnd (['Implementation-Title': 'Chaos Runner', - 'Implementation-Version': jarVersion, - 'Implementation-Vendor': 'synadia.io'] - ) exclude("io/synadia/examples/**") } @@ -88,21 +95,6 @@ javadoc { source = sourceSets.main.allJava title = "Synadia Communications Inc. Chaos Runner" classpath = sourceSets.main.runtimeClasspath - doLast { - if (!OperatingSystem.current().isWindows()) { - exec { - println "Updating favicon on all html files" - workingDir 'build/docs/javadoc' - // Only on linux, mac at this point - commandLine 'find', '.', '-name', '*.html', '-exec', 'sed', '-i', '-e', 's###', '{}', ';' - } - copy { - println "Copying images to javadoc folder" - from 'src/main/javadoc/images' - into 'build/docs/javadoc' - } - } - } } tasks.register('examplesJar', Jar) { @@ -156,13 +148,13 @@ tasks.register ('examplesUberJar', Jar) { } jacoco { - toolVersion = "0.8.6" + toolVersion = "0.8.12" } jacocoTestReport { reports { - xml.enabled = true // coveralls plugin depends on xml format report - html.enabled = true + xml.required = true // coveralls plugin depends on xml format report + html.required = true } afterEvaluate { // only report on main library not examples classDirectories.setFrom(files(classDirectories.files.collect { @@ -196,10 +188,10 @@ publishing { artifact javadocJar artifact uberJar pom { - name = 'chaos-runner' + name = jarAndArtifactName packaging = 'jar' groupId = group - artifactId = archivesBaseName + artifactId = jarAndArtifactName description = 'Synadia Communications Inc. Chaos Runner' url = 'https://github.com/synadia-io/orbit.java' licenses { diff --git a/chaos-runner/gradle/wrapper/gradle-wrapper.jar b/chaos-runner/gradle/wrapper/gradle-wrapper.jar index 490fda8..1b33c55 100644 Binary files a/chaos-runner/gradle/wrapper/gradle-wrapper.jar and b/chaos-runner/gradle/wrapper/gradle-wrapper.jar differ diff --git a/chaos-runner/gradle/wrapper/gradle-wrapper.properties b/chaos-runner/gradle/wrapper/gradle-wrapper.properties index 442d913..ca025c8 100644 --- a/chaos-runner/gradle/wrapper/gradle-wrapper.properties +++ b/chaos-runner/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/chaos-runner/gradlew b/chaos-runner/gradlew index 2fe81a7..23d15a9 100644 --- a/chaos-runner/gradlew +++ b/chaos-runner/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,80 +15,115 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,87 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/chaos-runner/gradlew.bat b/chaos-runner/gradlew.bat index 62bd9b9..db3a6ac 100644 --- a/chaos-runner/gradlew.bat +++ b/chaos-runner/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -54,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/chaos-runner/src/main/java/io/synadia/chaos/ChaosArguments.java b/chaos-runner/src/main/java/io/synadia/chaos/ChaosArguments.java index 00053b0..fa023a4 100644 --- a/chaos-runner/src/main/java/io/synadia/chaos/ChaosArguments.java +++ b/chaos-runner/src/main/java/io/synadia/chaos/ChaosArguments.java @@ -5,14 +5,13 @@ import java.nio.file.Paths; import java.util.Objects; -import static io.nats.NatsRunnerUtils.DEFAULT_CLUSTER_NAME; -import static io.nats.NatsRunnerUtils.DEFAULT_SERVER_NAME_PREFIX; +import static io.nats.ClusterUtils.DEFAULT_CLUSTER_DEFAULTS; public class ChaosArguments { int servers = 3; - String clusterName = DEFAULT_CLUSTER_NAME; - String serverNamePrefix = DEFAULT_SERVER_NAME_PREFIX; + String clusterName = DEFAULT_CLUSTER_DEFAULTS.getClusterName(); + String serverNamePrefix = DEFAULT_CLUSTER_DEFAULTS.getServerNamePrefix(); boolean js = true; Path workDirectory; long initialDelay = 30_000; diff --git a/chaos-runner/src/main/java/io/synadia/chaos/ChaosRunner.java b/chaos-runner/src/main/java/io/synadia/chaos/ChaosRunner.java index ce17179..8cc1a35 100644 --- a/chaos-runner/src/main/java/io/synadia/chaos/ChaosRunner.java +++ b/chaos-runner/src/main/java/io/synadia/chaos/ChaosRunner.java @@ -3,12 +3,15 @@ package io.synadia.chaos; +import io.nats.ClusterDefaults; import io.nats.ClusterInsert; import io.nats.ClusterNode; +import io.nats.NatsRunnerUtils; import io.nats.NatsServerRunner; import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; @@ -19,7 +22,9 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; -import static io.nats.NatsRunnerUtils.*; +import static io.nats.ClusterUtils.createClusterInserts; +import static io.nats.ClusterUtils.createNodes; +import static io.nats.NatsRunnerUtils.getNatsLocalhostUri; import static io.synadia.chaos.ChaosUtils.getDefaultPrinter; public class ChaosRunner { @@ -91,7 +96,7 @@ private NatsServerRunner createRunner(int index) throws Exception { .jetstream(true) .configInserts(ci.configInserts) .port(ci.node.port) - .connectCheckTries(0) + .skipConnectValidate() ; return b.build(); } @@ -172,7 +177,7 @@ public String toString() { private ChaosRunner(ChaosArguments a, ChaosPrinter printer) throws IOException { if (a.workDirectory == null) { - a.workDirectory = getTemporaryJetStreamStoreDirBase(); + a.workDirectory = Files.createTempDirectory(null); } else if (!a.workDirectory.toFile().exists()) { throw new IllegalArgumentException("Work directory does not exist: " + a.workDirectory); @@ -233,7 +238,15 @@ else if (!a.workDirectory.toFile().exists()) { clusterInserts.add(new ClusterInsert(cn, inserts.toArray(new String[0]))); } else { - List cns = createNodes(servers, clusterName, serverNamePrefix, jsStoreDirBase, DEFAULT_HOST, port, listen, monitor < 1 ? null : monitor); + ClusterDefaults cd = new ClusterDefaults() + .count(servers) + .clusterName(clusterName) + .serverNamePrefix(serverNamePrefix) + .host(NatsRunnerUtils.LocalHost.ip.host) + .portStart(port) + .listenStart(listen) + .monitorStart(monitor); // less than 1 turns the monitor off + List cns = createNodes(cd, jsStoreDirBase); if (specificPort != -1) { boolean found = false; for (ClusterNode cn : cns) { @@ -279,7 +292,7 @@ public static ChaosRunner start(ChaosArguments a) throws Exception { } public static ChaosRunner start(ChaosArguments a, ChaosPrinter printer) throws Exception { - NatsServerRunner.setDefaultOutputLevel(Level.SEVERE); + NatsRunnerUtils.setDefaultOutputLevel(Level.SEVERE); final ChaosPrinter finalPrinter = printer == null ? getDefaultPrinter() : printer; INSTANCE_LOCK.lock(); diff --git a/counters/build.gradle b/counters/build.gradle index a6ef597..2166dda 100644 --- a/counters/build.gradle +++ b/counters/build.gradle @@ -16,20 +16,17 @@ group = 'io.synadia' def isRelease = System.getenv("BUILD_EVENT") == "release" -def tc = System.getenv("TARGET_COMPATIBILITY"); -def targetCompat = tc == "21" ? JavaVersion.VERSION_21 : (tc == "17" ? JavaVersion.VERSION_17 : JavaVersion.VERSION_1_8) -def jarEnd = tc == "21" ? "-jdk21" : (tc == "17" ? "-jdk17" : "") -def jarAndArtifactName = "counters" + jarEnd +def jarAndArtifactName = "counters" version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" // version is the variable the build actually uses. System.out.println("Java: " + System.getProperty("java.version")) -System.out.println("Target Compatibility: " + targetCompat) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) System.out.println(group + ":" + jarAndArtifactName + ":" + version) java { sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = targetCompat + targetCompatibility = JavaVersion.VERSION_1_8 } repositories { @@ -39,11 +36,11 @@ repositories { } dependencies { - implementation 'io.nats:jnats:2.25.1' + implementation 'io.nats:jnats:2.26.2' implementation 'io.synadia:direct-batch:0.1.4' implementation 'org.jspecify:jspecify:1.0.0' - testImplementation 'io.nats:jnats-server-runner:1.2.8' + testImplementation 'io.nats:jnats-server-runner:3.1.1' testImplementation 'commons-codec:commons-codec:1.20.0' testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1' testImplementation 'nl.jqno.equalsverifier:equalsverifier:4.2.3' @@ -75,11 +72,12 @@ tasks.register('bundle', Bundle) { jar { bundle { - bnd("Bundle-Name": "io.synadia.counters", + bnd("Automatic-Module-Name": "io.synadia.counters", + "Bundle-Name": "io.synadia.counters", "Bundle-Vendor": "synadia.io", "Bundle-Description": "JetStream Distributed Counters", "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/counters", - "Target-Compatibility": "Java " + targetCompat + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 ) } } diff --git a/counters/src/test/java/io/synadia/counters/CountersTests.java b/counters/src/test/java/io/synadia/counters/CountersTests.java index 0f3c60f..03a3218 100644 --- a/counters/src/test/java/io/synadia/counters/CountersTests.java +++ b/counters/src/test/java/io/synadia/counters/CountersTests.java @@ -1,11 +1,12 @@ package io.synadia.counters; +import io.nats.NatsRunnerUtils; +import io.nats.NatsServerRunner; import io.nats.client.*; import io.nats.client.api.Source; import io.nats.client.api.StorageType; import io.nats.client.api.StreamConfiguration; import io.nats.client.api.SubjectTransform; -import nats.io.NatsServerRunner; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -29,10 +30,10 @@ public class CountersTests { @BeforeAll public static void beforeAll() throws Exception { - NatsServerRunner.setDefaultOutputLevel(Level.WARNING); + NatsRunnerUtils.setDefaultOutputLevel(Level.WARNING); runner = new NatsServerRunner(false, true); Options options = Options.builder() - .server(runner.getURI()) + .server(runner.getNatsLocalhostUri()) .errorListener(new ErrorListener() {}) .build(); nc = Nats.connect(options); diff --git a/direct-batch/build.gradle b/direct-batch/build.gradle index 5602936..c350383 100644 --- a/direct-batch/build.gradle +++ b/direct-batch/build.gradle @@ -1,27 +1,30 @@ import aQute.bnd.gradle.Bundle -import org.gradle.internal.os.OperatingSystem plugins { id 'java' id 'java-library' id 'maven-publish' id 'jacoco' - id 'com.github.kt3k.coveralls' version '2.12.0' - id 'biz.aQute.bnd.builder' version '5.1.2' - id "org.gradle.test-retry" version "1.1.9" - id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' + id 'biz.aQute.bnd.builder' version '7.1.0' + id "org.gradle.test-retry" version "1.6.4" + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'signing' } def jarVersion = "0.1.5" group = 'io.synadia' -def isMerge = System.getenv("BUILD_EVENT") == "push" def isRelease = System.getenv("BUILD_EVENT") == "release" +def jarAndArtifactName = "direct-batch" + // version is the variable the build actually uses. version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" +System.out.println("Java: " + System.getProperty("java.version")) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) +System.out.println(group + ":" + jarAndArtifactName + ":" + version) + java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -38,13 +41,14 @@ repositories { } dependencies { - implementation 'io.nats:jnats:2.25.1' + implementation 'io.nats:jnats:2.26.2' implementation 'org.jspecify:jspecify:1.0.0' - testImplementation 'io.nats:jnats-server-runner:1.2.8' - testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0' + testImplementation 'io.nats:jnats-server-runner:3.1.1' + testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1' + testImplementation 'org.junit.platform:junit-platform-launcher:1.14.3' testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.12.3' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:4.2.3' } configurations.configureEach { @@ -70,13 +74,16 @@ tasks.register('bundle', Bundle) { } jar { - manifest { - attributes('Automatic-Module-Name': 'io.synadia.direct.batch') + bundle { + bnd("Automatic-Module-Name": "io.synadia.direct.batch", + "Bundle-Name": "io.synadia.direct.batch", + "Bundle-Vendor": "synadia.io", + "Bundle-Description": "Direct Batch", + "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/direct-batch", + "Implementation-Version": jarVersion, + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 + ) } - bnd (['Implementation-Title': 'Direct Batch', - 'Implementation-Version': jarVersion, - 'Implementation-Vendor': 'synadia.io'] - ) exclude("io/synadia/examples/**") } @@ -90,21 +97,6 @@ javadoc { source = sourceSets.main.allJava title = "Synadia Communications Inc. Direct Batch" classpath = sourceSets.main.runtimeClasspath - doLast { - if (!OperatingSystem.current().isWindows()) { - exec { - println "Updating favicon on all html files" - workingDir 'build/docs/javadoc' - // Only on linux, mac at this point - commandLine 'find', '.', '-name', '*.html', '-exec', 'sed', '-i', '-e', 's###', '{}', ';' - } - copy { - println "Copying images to javadoc folder" - from 'src/main/javadoc/images' - into 'build/docs/javadoc' - } - } - } } tasks.register('examplesJar', Jar) { @@ -130,13 +122,13 @@ tasks.register('sourcesJar', Jar) { } jacoco { - toolVersion = "0.8.6" + toolVersion = "0.8.12" } jacocoTestReport { reports { - xml.enabled = true // coveralls plugin depends on xml format report - html.enabled = true + xml.required = true // coveralls plugin depends on xml format report + html.required = true } afterEvaluate { // only report on main library not examples classDirectories.setFrom(files(classDirectories.files.collect { @@ -169,10 +161,10 @@ publishing { artifact examplesJar artifact javadocJar pom { - name = 'direct-batch' + name = jarAndArtifactName packaging = 'jar' groupId = group - artifactId = archivesBaseName + artifactId = jarAndArtifactName description = 'Synadia Communications Inc. Direct Batch' url = 'https://github.com/synadia-io/orbit.java' licenses { diff --git a/direct-batch/gradle/wrapper/gradle-wrapper.jar b/direct-batch/gradle/wrapper/gradle-wrapper.jar index 490fda8..1b33c55 100644 Binary files a/direct-batch/gradle/wrapper/gradle-wrapper.jar and b/direct-batch/gradle/wrapper/gradle-wrapper.jar differ diff --git a/direct-batch/gradle/wrapper/gradle-wrapper.properties b/direct-batch/gradle/wrapper/gradle-wrapper.properties index 442d913..ca025c8 100644 --- a/direct-batch/gradle/wrapper/gradle-wrapper.properties +++ b/direct-batch/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/direct-batch/gradlew b/direct-batch/gradlew index 2fe81a7..23d15a9 100644 --- a/direct-batch/gradlew +++ b/direct-batch/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,80 +15,115 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,87 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/direct-batch/gradlew.bat b/direct-batch/gradlew.bat index 62bd9b9..db3a6ac 100644 --- a/direct-batch/gradlew.bat +++ b/direct-batch/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -54,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/direct-batch/src/test/java/io/synadia/direct/DirectBatchTests.java b/direct-batch/src/test/java/io/synadia/direct/DirectBatchTests.java index 21b92f0..ea73f8c 100644 --- a/direct-batch/src/test/java/io/synadia/direct/DirectBatchTests.java +++ b/direct-batch/src/test/java/io/synadia/direct/DirectBatchTests.java @@ -1,5 +1,7 @@ package io.synadia.direct; +import io.nats.NatsRunnerUtils; +import io.nats.NatsServerRunner; import io.nats.client.Connection; import io.nats.client.JetStream; import io.nats.client.JetStreamManagement; @@ -10,7 +12,6 @@ import io.nats.client.api.StreamInfo; import io.nats.client.support.DateTimeUtils; import io.nats.client.support.JsonUtils; -import nats.io.NatsServerRunner; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -29,13 +30,13 @@ public class DirectBatchTests { @BeforeAll public static void beforeAll() { - NatsServerRunner.setDefaultOutputLevel(Level.WARNING); + NatsRunnerUtils.setDefaultOutputLevel(Level.WARNING); } @Test public void testBatchDirectGetErrorsAndStatuses() throws Exception { try (NatsServerRunner runner = new NatsServerRunner(false, true)) { - try (Connection nc = Nats.connect(runner.getURI())) { + try (Connection nc = Nats.connect(runner.getNatsLocalhostUri())) { assertThrows(IllegalArgumentException.class, () -> MessageBatchGetRequest.batch(null, 1)); assertThrows(IllegalArgumentException.class, () -> MessageBatchGetRequest.batch("", 1)); assertThrows(IllegalArgumentException.class, () -> MessageBatchGetRequest.batch(">", 0)); @@ -122,7 +123,7 @@ public void testIssue6032() throws Exception { try (NatsServerRunner runner = new NatsServerRunner(false, true)) { String stream = "stream6032"; String subject = "subject6032"; - try (Connection nc = Nats.connect(runner.getURI())) { + try (Connection nc = Nats.connect(runner.getNatsLocalhostUri())) { JetStreamManagement jsm = nc.jetStreamManagement(); JetStream js = jsm.jetStream(); @@ -167,7 +168,7 @@ public void testIssue6077() throws Exception { try (NatsServerRunner runner = new NatsServerRunner(false, true)) { String stream = "stream6077"; String subject = "subject6077"; - try (Connection nc = Nats.connect(runner.getURI())) { + try (Connection nc = Nats.connect(runner.getNatsLocalhostUri())) { JetStreamManagement jsm = nc.jetStreamManagement(); JetStream js = jsm.jetStream(); @@ -220,7 +221,7 @@ private static void verifyError(List list, int code) { @Test public void testBatchDirectGet() throws Exception { try (NatsServerRunner runner = new NatsServerRunner(false, true)) { - try (Connection nc = Nats.connect(runner.getURI())) { + try (Connection nc = Nats.connect(runner.getNatsLocalhostUri())) { JetStream js = nc.jetStream(); JetStreamManagement jsm = nc.jetStreamManagement(); diff --git a/encoded-kv/build.gradle b/encoded-kv/build.gradle index a508fd4..d08683b 100644 --- a/encoded-kv/build.gradle +++ b/encoded-kv/build.gradle @@ -1,27 +1,30 @@ import aQute.bnd.gradle.Bundle -import org.gradle.internal.os.OperatingSystem plugins { id 'java' id 'java-library' id 'maven-publish' id 'jacoco' - id 'com.github.kt3k.coveralls' version '2.12.0' - id 'biz.aQute.bnd.builder' version '5.1.2' - id "org.gradle.test-retry" version "1.1.9" - id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' + id 'biz.aQute.bnd.builder' version '7.1.0' + id "org.gradle.test-retry" version "1.6.4" + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'signing' } def jarVersion = "0.0.5" group = 'io.synadia' -def isMerge = System.getenv("BUILD_EVENT") == "push" def isRelease = System.getenv("BUILD_EVENT") == "release" +def jarAndArtifactName = "encoded-kv" + // version is the variable the build actually uses. version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" +System.out.println("Java: " + System.getProperty("java.version")) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) +System.out.println(group + ":" + jarAndArtifactName + ":" + version) + java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -38,13 +41,14 @@ repositories { } dependencies { - implementation 'io.nats:jnats:2.25.1' + implementation 'io.nats:jnats:2.26.2' testImplementation 'commons-codec:commons-codec:1.18.0' - testImplementation 'io.nats:jnats-server-runner:1.2.8' - testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0' + testImplementation 'io.nats:jnats-server-runner:3.1.1' + testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1' + testImplementation 'org.junit.platform:junit-platform-launcher:1.14.3' testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.12.3' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:4.2.3' } sourceSets { @@ -66,13 +70,16 @@ tasks.register('bundle', Bundle) { } jar { - manifest { - attributes('Automatic-Module-Name': 'io.synadia.encoded.kv') + bundle { + bnd("Automatic-Module-Name": "io.synadia.encoded.kv", + "Bundle-Name": "io.synadia.encoded.kv", + "Bundle-Vendor": "synadia.io", + "Bundle-Description": "KV Encoding", + "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/encoded-kv", + "Implementation-Version": jarVersion, + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 + ) } - bnd (['Implementation-Title': 'KV Encoding', - 'Implementation-Version': jarVersion, - 'Implementation-Vendor': 'synadia.io'] - ) exclude("io/synadia/examples/**") } @@ -86,21 +93,6 @@ javadoc { source = sourceSets.main.allJava title = "Synadia Communications Inc. KV Encoding" classpath = sourceSets.main.runtimeClasspath - doLast { - if (!OperatingSystem.current().isWindows()) { - exec { - println "Updating favicon on all html files" - workingDir 'build/docs/javadoc' - // Only on linux, mac at this point - commandLine 'find', '.', '-name', '*.html', '-exec', 'sed', '-i', '-e', 's###', '{}', ';' - } - copy { - println "Copying images to javadoc folder" - from 'src/main/javadoc/images' - into 'build/docs/javadoc' - } - } - } } tasks.register('examplesJar', Jar) { @@ -126,13 +118,13 @@ tasks.register('sourcesJar', Jar) { } jacoco { - toolVersion = "0.8.6" + toolVersion = "0.8.12" } jacocoTestReport { reports { - xml.enabled = true // coveralls plugin depends on xml format report - html.enabled = true + xml.required = true // coveralls plugin depends on xml format report + html.required = true } afterEvaluate { // only report on main library not examples classDirectories.setFrom(files(classDirectories.files.collect { @@ -165,10 +157,10 @@ publishing { artifact examplesJar artifact javadocJar pom { - name = 'encoded-kv' + name = jarAndArtifactName packaging = 'jar' groupId = group - artifactId = archivesBaseName + artifactId = jarAndArtifactName description = 'Synadia Communications Inc. Encoded KV' url = 'https://github.com/synadia-io/orbit.java' licenses { diff --git a/encoded-kv/gradle/wrapper/gradle-wrapper.jar b/encoded-kv/gradle/wrapper/gradle-wrapper.jar index 490fda8..1b33c55 100644 Binary files a/encoded-kv/gradle/wrapper/gradle-wrapper.jar and b/encoded-kv/gradle/wrapper/gradle-wrapper.jar differ diff --git a/encoded-kv/gradle/wrapper/gradle-wrapper.properties b/encoded-kv/gradle/wrapper/gradle-wrapper.properties index 442d913..ca025c8 100644 --- a/encoded-kv/gradle/wrapper/gradle-wrapper.properties +++ b/encoded-kv/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/encoded-kv/gradlew b/encoded-kv/gradlew index 2fe81a7..23d15a9 100644 --- a/encoded-kv/gradlew +++ b/encoded-kv/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,80 +15,115 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,87 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/encoded-kv/gradlew.bat b/encoded-kv/gradlew.bat index 62bd9b9..db3a6ac 100644 --- a/encoded-kv/gradlew.bat +++ b/encoded-kv/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -54,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/encoded-kv/src/test/java/io/synadia/ekv/ChainTests.java b/encoded-kv/src/test/java/io/synadia/ekv/ChainTests.java index 73086ef..a2024b1 100644 --- a/encoded-kv/src/test/java/io/synadia/ekv/ChainTests.java +++ b/encoded-kv/src/test/java/io/synadia/ekv/ChainTests.java @@ -3,10 +3,10 @@ package io.synadia.ekv; +import io.nats.NatsRunnerUtils; import io.synadia.ekv.codec.*; import io.synadia.ekv.misc.Data; import io.synadia.ekv.misc.GeneralType; -import nats.io.NatsServerRunner; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -18,7 +18,7 @@ public class ChainTests { @BeforeAll public static void beforeAll() { - NatsServerRunner.setDefaultOutputLevel(Level.WARNING); + NatsRunnerUtils.setDefaultOutputLevel(Level.WARNING); } @Test diff --git a/encoded-kv/src/test/java/io/synadia/ekv/CodecTests.java b/encoded-kv/src/test/java/io/synadia/ekv/CodecTests.java index 69e08d8..e5c224b 100644 --- a/encoded-kv/src/test/java/io/synadia/ekv/CodecTests.java +++ b/encoded-kv/src/test/java/io/synadia/ekv/CodecTests.java @@ -3,10 +3,10 @@ package io.synadia.ekv; +import io.nats.NatsRunnerUtils; import io.synadia.ekv.codec.*; import io.synadia.ekv.misc.Data; import io.synadia.ekv.misc.GeneralType; -import nats.io.NatsServerRunner; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Hex; import org.junit.jupiter.api.BeforeAll; @@ -20,7 +20,7 @@ public class CodecTests { @BeforeAll public static void beforeAll() { - NatsServerRunner.setDefaultOutputLevel(Level.WARNING); + NatsRunnerUtils.setDefaultOutputLevel(Level.WARNING); } @Test diff --git a/encoded-kv/src/test/java/io/synadia/ekv/WorkflowTests.java b/encoded-kv/src/test/java/io/synadia/ekv/WorkflowTests.java index 6c812f6..e062183 100644 --- a/encoded-kv/src/test/java/io/synadia/ekv/WorkflowTests.java +++ b/encoded-kv/src/test/java/io/synadia/ekv/WorkflowTests.java @@ -3,6 +3,8 @@ package io.synadia.ekv; +import io.nats.NatsRunnerUtils; +import io.nats.NatsServerRunner; import io.nats.client.*; import io.nats.client.api.KeyValueConfiguration; import io.nats.client.api.KeyValueOperation; @@ -12,7 +14,6 @@ import io.synadia.ekv.codec.*; import io.synadia.ekv.misc.Data; import io.synadia.ekv.misc.GeneralType; -import nats.io.NatsServerRunner; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Hex; import org.junit.jupiter.api.BeforeAll; @@ -38,7 +39,7 @@ public class WorkflowTests { @BeforeAll public static void beforeAll() { - NatsServerRunner.setDefaultOutputLevel(Level.WARNING); + NatsRunnerUtils.setDefaultOutputLevel(Level.WARNING); } @ParameterizedTest @@ -46,7 +47,7 @@ public static void beforeAll() { public void testStringKeyWorkflow(String gtName, String variant) throws Exception { GeneralType gt = gtName.equals("PLAIN") ? GeneralType.PLAIN : (gtName.equals("BASE64") ? GeneralType.BASE64 : GeneralType.HEX); try (NatsServerRunner runner = new NatsServerRunner(false, true)) { - try (Connection nc = Nats.connect(runner.getURI())) { + try (Connection nc = Nats.connect(runner.getNatsLocalhostUri())) { GeneralStringKeyCodec keyCodec = new GeneralStringKeyCodec(gt); DataValueCodec dvc = new DataValueCodec(gt); @@ -227,7 +228,7 @@ private void assertHistory(List expected, List allKeys = Arrays.asList(TEST_WATCH_KEY_1, TEST_WATCH_KEY_2, TEST_WATCH_KEY_NULL); try (NatsServerRunner runner = new NatsServerRunner(false, true)) { - try (Connection nc = Nats.connect(runner.getURI())) { + try (Connection nc = Nats.connect(runner.getNatsLocalhostUri())) { _testWatch(nc, gt, key1FullWatcher, key1AllExpecteds, -1, kv -> kv.watch(TEST_WATCH_KEY_1, key1FullWatcher, key1FullWatcher.watchOptions)); _testWatch(nc, gt, key1MetaWatcher, key1AllExpecteds, -1, kv -> kv.watch(TEST_WATCH_KEY_1, key1MetaWatcher, key1MetaWatcher.watchOptions)); _testWatch(nc, gt, key1StartNewWatcher, key1AllExpecteds, -1, kv -> kv.watch(TEST_WATCH_KEY_1, key1StartNewWatcher, key1StartNewWatcher.watchOptions)); diff --git a/js-publish-extensions/build.gradle b/js-publish-extensions/build.gradle index f194363..18a1df2 100644 --- a/js-publish-extensions/build.gradle +++ b/js-publish-extensions/build.gradle @@ -1,27 +1,30 @@ import aQute.bnd.gradle.Bundle -import org.gradle.internal.os.OperatingSystem plugins { id 'java' id 'java-library' id 'maven-publish' id 'jacoco' - id 'com.github.kt3k.coveralls' version '2.12.0' - id 'biz.aQute.bnd.builder' version '5.1.2' - id "org.gradle.test-retry" version "1.1.9" - id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' + id 'biz.aQute.bnd.builder' version '7.1.0' + id "org.gradle.test-retry" version "1.6.4" + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'signing' } def jarVersion = "0.4.5" group = 'io.synadia' -def isMerge = System.getenv("BUILD_EVENT") == "push" def isRelease = System.getenv("BUILD_EVENT") == "release" +def jarAndArtifactName = "jnats-js-publish-extensions" + // version is the variable the build actually uses. version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" +System.out.println("Java: " + System.getProperty("java.version")) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) +System.out.println(group + ":" + jarAndArtifactName + ":" + version) + java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -45,13 +48,14 @@ repositories { } dependencies { - implementation 'io.nats:jnats:2.25.1' + implementation 'io.nats:jnats:2.26.2' implementation 'io.synadia:retrier:0.2.1' - testImplementation 'io.nats:jnats-server-runner:1.2.8' - testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0' + testImplementation 'io.nats:jnats-server-runner:3.1.1' + testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1' + testImplementation 'org.junit.platform:junit-platform-launcher:1.14.3' testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.12.3' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:4.2.3' } sourceSets { @@ -73,13 +77,16 @@ tasks.register('bundle', Bundle) { } jar { - manifest { - attributes('Automatic-Module-Name': 'io.synadia.jnats.js.publish.extensions') + bundle { + bnd("Automatic-Module-Name": "io.synadia.jnats.js.publish.extensions", + "Bundle-Name": "io.synadia.jnats.js.publish.extensions", + "Bundle-Vendor": "synadia.io", + "Bundle-Description": "JNATS JetStream Publish Extensions", + "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/js-publish-extensions", + "Implementation-Version": jarVersion, + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 + ) } - bnd (['Implementation-Title': 'JNATS JetStream Publish Extensions', - 'Implementation-Version': jarVersion, - 'Implementation-Vendor': 'synadia.io'] - ) exclude("io/synadia/examples/**") } @@ -93,21 +100,6 @@ javadoc { source = sourceSets.main.allJava title = "Synadia Communications Inc. JNATS JetStream Publish Extensions" classpath = sourceSets.main.runtimeClasspath - doLast { - if (!OperatingSystem.current().isWindows()) { - exec { - println "Updating favicon on all html files" - workingDir 'build/docs/javadoc' - // Only on linux, mac at this point - commandLine 'find', '.', '-name', '*.html', '-exec', 'sed', '-i', '-e', 's###', '{}', ';' - } - copy { - println "Copying images to javadoc folder" - from 'src/main/javadoc/images' - into 'build/docs/javadoc' - } - } - } } tasks.register('examplesJar', Jar) { @@ -133,13 +125,13 @@ tasks.register('sourcesJar', Jar) { } jacoco { - toolVersion = "0.8.6" + toolVersion = "0.8.12" } jacocoTestReport { reports { - xml.enabled = true // coveralls plugin depends on xml format report - html.enabled = true + xml.required = true // coveralls plugin depends on xml format report + html.required = true } afterEvaluate { // only report on main library not examples classDirectories.setFrom(files(classDirectories.files.collect { @@ -153,15 +145,13 @@ artifacts { archives javadocJar, sourcesJar, examplesJar } -if (isMerge || isRelease) { - nexusPublishing { - repositories { - sonatype { - nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) - snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) - username = System.getenv('OSSRH_USERNAME') - password = System.getenv('OSSRH_PASSWORD') - } +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) + snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) + username = System.getenv('OSSRH_USERNAME') + password = System.getenv('OSSRH_PASSWORD') } } } @@ -174,10 +164,10 @@ publishing { artifact examplesJar artifact javadocJar pom { - name = rootProject.name + name = jarAndArtifactName packaging = 'jar' groupId = group - artifactId = archivesBaseName + artifactId = jarAndArtifactName description = 'Synadia Communications Inc. JNATS JetStream Publish Extensions' url = 'https://github.com/synadia-io/orbit.java' licenses { diff --git a/js-publish-extensions/gradle/wrapper/gradle-wrapper.jar b/js-publish-extensions/gradle/wrapper/gradle-wrapper.jar index 490fda8..1b33c55 100644 Binary files a/js-publish-extensions/gradle/wrapper/gradle-wrapper.jar and b/js-publish-extensions/gradle/wrapper/gradle-wrapper.jar differ diff --git a/js-publish-extensions/gradle/wrapper/gradle-wrapper.properties b/js-publish-extensions/gradle/wrapper/gradle-wrapper.properties index 442d913..ca025c8 100644 --- a/js-publish-extensions/gradle/wrapper/gradle-wrapper.properties +++ b/js-publish-extensions/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/js-publish-extensions/gradlew b/js-publish-extensions/gradlew index 2fe81a7..23d15a9 100644 --- a/js-publish-extensions/gradlew +++ b/js-publish-extensions/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,80 +15,115 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,87 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/js-publish-extensions/gradlew.bat b/js-publish-extensions/gradlew.bat index 62bd9b9..db3a6ac 100644 --- a/js-publish-extensions/gradlew.bat +++ b/js-publish-extensions/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -54,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/js-publish-extensions/src/test/java/io/synadia/jnats/extension/PublishRetrierTests.java b/js-publish-extensions/src/test/java/io/synadia/jnats/extension/PublishRetrierTests.java index 6f356aa..0e6faab 100644 --- a/js-publish-extensions/src/test/java/io/synadia/jnats/extension/PublishRetrierTests.java +++ b/js-publish-extensions/src/test/java/io/synadia/jnats/extension/PublishRetrierTests.java @@ -1,5 +1,8 @@ package io.synadia.jnats.extension; +import io.nats.ConsoleOutput; +import io.nats.NatsRunnerUtils; +import io.nats.NatsServerRunner; import io.nats.client.*; import io.nats.client.api.PublishAck; import io.nats.client.api.StorageType; @@ -7,8 +10,6 @@ import io.nats.client.impl.Headers; import io.nats.client.impl.NatsMessage; import io.synadia.retrier.RetryConfig; -import nats.io.ConsoleOutput; -import nats.io.NatsServerRunner; import org.junit.jupiter.api.Test; import java.io.IOException; @@ -22,8 +23,8 @@ public class PublishRetrierTests { static { - NatsServerRunner.setDefaultOutputSupplier(ConsoleOutput::new); - NatsServerRunner.setDefaultOutputLevel(Level.WARNING); + NatsRunnerUtils.setDefaultOutputSupplier(ConsoleOutput::new); + NatsRunnerUtils.setDefaultOutputLevel(Level.WARNING); } interface SyncRetryFunction { @@ -74,7 +75,7 @@ public void testConfig() { @Test public void testRetryJsApis() throws Exception { try (NatsServerRunner runner = new NatsServerRunner(false, true)) { - try (Connection nc = Nats.connect(runner.getURI())) { + try (Connection nc = Nats.connect(runner.getNatsLocalhostUri())) { final JetStream js = nc.jetStream(); _testRetrySync(nc, subject -> PublishRetrier.publish(js, subject, null)); diff --git a/pcgroups-cli/build.gradle b/pcgroups-cli/build.gradle index 9946add..d92d1e1 100644 --- a/pcgroups-cli/build.gradle +++ b/pcgroups-cli/build.gradle @@ -20,7 +20,7 @@ dependencies { implementation project(':') // ':' means root project which is 'pcgroups' implementation 'info.picocli:picocli:4.7.5' - testImplementation 'io.nats:jnats-server-runner:3.1.0' + testImplementation 'io.nats:jnats-server-runner:3.1.1' testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1' testImplementation 'org.junit.platform:junit-platform-launcher:1.14.3' } diff --git a/pcgroups/build.gradle b/pcgroups/build.gradle index d672d1e..979c336 100644 --- a/pcgroups/build.gradle +++ b/pcgroups/build.gradle @@ -16,16 +16,13 @@ group = 'io.synadia' def isRelease = System.getenv("BUILD_EVENT") == "release" -def tc = System.getenv("TARGET_COMPATIBILITY"); -def targetCompat = tc == "21" ? JavaVersion.VERSION_21 : (tc == "17" ? JavaVersion.VERSION_17 : JavaVersion.VERSION_1_8) -def jarEnd = tc == "21" ? "-jdk21" : (tc == "17" ? "-jdk17" : "") -def jarAndArtifactName = "pcgroups" + jarEnd +def jarAndArtifactName = "pcgroups" version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" // version is the variable the build actually uses. java { sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = targetCompat + targetCompatibility = JavaVersion.VERSION_1_8 } repositories { @@ -35,10 +32,10 @@ repositories { } dependencies { - api 'io.nats:jnats:2.25.1' + api 'io.nats:jnats:2.26.2' api 'org.jspecify:jspecify:1.0.0' - testImplementation 'io.nats:jnats-server-runner:3.1.0' + testImplementation 'io.nats:jnats-server-runner:3.1.1' testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1' testImplementation 'org.junit.platform:junit-platform-launcher:1.14.3' } @@ -49,11 +46,12 @@ tasks.register('bundle', Bundle) { jar { bundle { - bnd("Bundle-Name": "io.synadia.partitioned.consumer.groups", + bnd("Automatic-Module-Name": "io.synadia.partitioned.consumer.groups", + "Bundle-Name": "io.synadia.partitioned.consumer.groups", "Bundle-Vendor": "synadia.io", "Bundle-Description": "NATS JetStream Partitioned Consumer Groups Library for Java", "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/pcgroups", - "Target-Compatibility": "Java " + targetCompat + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 ) } } diff --git a/request-many/build.gradle b/request-many/build.gradle index f3c0597..7ce6627 100644 --- a/request-many/build.gradle +++ b/request-many/build.gradle @@ -1,27 +1,30 @@ import aQute.bnd.gradle.Bundle -import org.gradle.internal.os.OperatingSystem plugins { id 'java' id 'java-library' id 'maven-publish' id 'jacoco' - id 'com.github.kt3k.coveralls' version '2.12.0' - id 'biz.aQute.bnd.builder' version '5.1.2' - id "org.gradle.test-retry" version "1.1.9" - id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' + id 'biz.aQute.bnd.builder' version '7.1.0' + id "org.gradle.test-retry" version "1.6.4" + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'signing' } def jarVersion = "0.1.2" group = 'io.synadia' -def isMerge = System.getenv("BUILD_EVENT") == "push" def isRelease = System.getenv("BUILD_EVENT") == "release" +def jarAndArtifactName = "request-many" + // version is the variable the build actually uses. version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" +System.out.println("Java: " + System.getProperty("java.version")) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) +System.out.println(group + ":" + jarAndArtifactName + ":" + version) + java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -38,12 +41,13 @@ repositories { } dependencies { - implementation 'io.nats:jnats:2.25.1' + implementation 'io.nats:jnats:2.26.2' - testImplementation 'io.nats:jnats-server-runner:1.2.8' - testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0' + testImplementation 'io.nats:jnats-server-runner:3.1.1' + testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1' + testImplementation 'org.junit.platform:junit-platform-launcher:1.14.3' testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.12.3' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:4.2.3' } sourceSets { @@ -65,13 +69,16 @@ tasks.register('bundle', Bundle) { } jar { - manifest { - attributes('Automatic-Module-Name': 'io.synadia.request.many') + bundle { + bnd("Automatic-Module-Name": "io.synadia.request.many", + "Bundle-Name": "io.synadia.request.many", + "Bundle-Vendor": "synadia.io", + "Bundle-Description": "Request Many Utility", + "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/request-many", + "Implementation-Version": jarVersion, + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 + ) } - bnd (['Implementation-Title': 'Request Many Utility', - 'Implementation-Version': jarVersion, - 'Implementation-Vendor': 'synadia.io'] - ) exclude("io/synadia/examples/**") } @@ -85,21 +92,6 @@ javadoc { source = sourceSets.main.allJava title = "Synadia Communications Inc. Request Many Utility" classpath = sourceSets.main.runtimeClasspath - doLast { - if (!OperatingSystem.current().isWindows()) { - exec { - println "Updating favicon on all html files" - workingDir 'build/docs/javadoc' - // Only on linux, mac at this point - commandLine 'find', '.', '-name', '*.html', '-exec', 'sed', '-i', '-e', 's###', '{}', ';' - } - copy { - println "Copying images to javadoc folder" - from 'src/main/javadoc/images' - into 'build/docs/javadoc' - } - } - } } tasks.register('examplesJar', Jar) { @@ -125,13 +117,13 @@ tasks.register('sourcesJar', Jar) { } jacoco { - toolVersion = "0.8.6" + toolVersion = "0.8.12" } jacocoTestReport { reports { - xml.enabled = true // coveralls plugin depends on xml format report - html.enabled = true + xml.required = true // coveralls plugin depends on xml format report + html.required = true } afterEvaluate { // only report on main library not examples classDirectories.setFrom(files(classDirectories.files.collect { @@ -164,10 +156,10 @@ publishing { artifact examplesJar artifact javadocJar pom { - name = 'request-many' + name = jarAndArtifactName packaging = 'jar' groupId = group - artifactId = archivesBaseName + artifactId = jarAndArtifactName description = 'Synadia Communications Inc. Request Many Utility' url = 'https://github.com/synadia-io/orbit.java' licenses { diff --git a/request-many/gradle/wrapper/gradle-wrapper.jar b/request-many/gradle/wrapper/gradle-wrapper.jar index 490fda8..1b33c55 100644 Binary files a/request-many/gradle/wrapper/gradle-wrapper.jar and b/request-many/gradle/wrapper/gradle-wrapper.jar differ diff --git a/request-many/gradle/wrapper/gradle-wrapper.properties b/request-many/gradle/wrapper/gradle-wrapper.properties index 442d913..ca025c8 100644 --- a/request-many/gradle/wrapper/gradle-wrapper.properties +++ b/request-many/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/request-many/gradlew b/request-many/gradlew index 2fe81a7..23d15a9 100644 --- a/request-many/gradlew +++ b/request-many/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,80 +15,115 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,87 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/request-many/gradlew.bat b/request-many/gradlew.bat index 62bd9b9..db3a6ac 100644 --- a/request-many/gradlew.bat +++ b/request-many/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -54,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/request-many/src/test/java/io/synadia/rm/RequestManyTests.java b/request-many/src/test/java/io/synadia/rm/RequestManyTests.java index a21272b..8b8b99d 100644 --- a/request-many/src/test/java/io/synadia/rm/RequestManyTests.java +++ b/request-many/src/test/java/io/synadia/rm/RequestManyTests.java @@ -1,9 +1,10 @@ package io.synadia.rm; +import io.nats.ConsoleOutput; +import io.nats.NatsRunnerUtils; +import io.nats.NatsServerRunner; import io.nats.client.*; import io.nats.client.impl.NatsMessage; -import nats.io.ConsoleOutput; -import nats.io.NatsServerRunner; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -509,17 +510,17 @@ private static Connection connect() throws Exception { } private static Options getOptions() { - return Options.builder().server(TS.getURI()).build(); + return Options.builder().server(TS.getNatsLocalhostUri()).build(); } @BeforeAll public static void beforeAll() { - NatsServerRunner.setDefaultOutputSupplier(ConsoleOutput::new); - NatsServerRunner.setDefaultOutputLevel(Level.WARNING); + NatsRunnerUtils.setDefaultOutputSupplier(ConsoleOutput::new); + NatsRunnerUtils.setDefaultOutputLevel(Level.WARNING); try { TS = NatsServerRunner.builder().build(); sleep(200); // just give the server some time to be running - NC = Nats.connect(Options.builder().server(TS.getURI()).build()); + NC = Nats.connect(Options.builder().server(TS.getNatsLocalhostUri()).build()); sleep(200); // just give the connection time to be ready DEFAULT_TIMEOUT = NC.getOptions().getConnectionTimeout().toMillis(); } diff --git a/retrier/build.gradle b/retrier/build.gradle index fe663de..006fd53 100644 --- a/retrier/build.gradle +++ b/retrier/build.gradle @@ -1,27 +1,30 @@ import aQute.bnd.gradle.Bundle -import org.gradle.internal.os.OperatingSystem plugins { id 'java' id 'java-library' id 'maven-publish' id 'jacoco' - id 'com.github.kt3k.coveralls' version '2.12.0' - id 'biz.aQute.bnd.builder' version '5.1.2' - id "org.gradle.test-retry" version "1.1.9" - id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' + id 'biz.aQute.bnd.builder' version '7.1.0' + id "org.gradle.test-retry" version "1.6.4" + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'signing' } def jarVersion = "0.2.2" group = 'io.synadia' -def isMerge = System.getenv("BUILD_EVENT") == "push" def isRelease = System.getenv("BUILD_EVENT") == "release" +def jarAndArtifactName = "retrier" + // version is the variable the build actually uses. version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" +System.out.println("Java: " + System.getProperty("java.version")) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) +System.out.println(group + ":" + jarAndArtifactName + ":" + version) + java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -38,12 +41,13 @@ repositories { } dependencies { - implementation 'io.nats:jnats:2.25.1' + implementation 'io.nats:jnats:2.26.2' - testImplementation 'io.nats:jnats-server-runner:1.2.8' - testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0' + testImplementation 'io.nats:jnats-server-runner:3.1.1' + testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1' + testImplementation 'org.junit.platform:junit-platform-launcher:1.14.3' testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.12.3' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:4.2.3' } sourceSets { @@ -65,13 +69,16 @@ tasks.register('bundle', Bundle) { } jar { - manifest { - attributes('Automatic-Module-Name': 'io.synadia.retrier') + bundle { + bnd("Automatic-Module-Name": "io.synadia.retrier", + "Bundle-Name": "io.synadia.retrier", + "Bundle-Vendor": "synadia.io", + "Bundle-Description": "Retrier Utility", + "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/retrier", + "Implementation-Version": jarVersion, + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 + ) } - bnd (['Implementation-Title': 'Retrier Utility', - 'Implementation-Version': jarVersion, - 'Implementation-Vendor': 'synadia.io'] - ) exclude("io/synadia/examples/**") } @@ -85,21 +92,6 @@ javadoc { source = sourceSets.main.allJava title = "Synadia Communications Inc. Retrier Utility" classpath = sourceSets.main.runtimeClasspath - doLast { - if (!OperatingSystem.current().isWindows()) { - exec { - println "Updating favicon on all html files" - workingDir 'build/docs/javadoc' - // Only on linux, mac at this point - commandLine 'find', '.', '-name', '*.html', '-exec', 'sed', '-i', '-e', 's###', '{}', ';' - } - copy { - println "Copying images to javadoc folder" - from 'src/main/javadoc/images' - into 'build/docs/javadoc' - } - } - } } tasks.register('examplesJar', Jar) { @@ -125,13 +117,13 @@ tasks.register('sourcesJar', Jar) { } jacoco { - toolVersion = "0.8.6" + toolVersion = "0.8.12" } jacocoTestReport { reports { - xml.enabled = true // coveralls plugin depends on xml format report - html.enabled = true + xml.required = true // coveralls plugin depends on xml format report + html.required = true } afterEvaluate { // only report on main library not examples classDirectories.setFrom(files(classDirectories.files.collect { @@ -164,10 +156,10 @@ publishing { artifact examplesJar artifact javadocJar pom { - name = 'retrier' + name = jarAndArtifactName packaging = 'jar' groupId = group - artifactId = archivesBaseName + artifactId = jarAndArtifactName description = 'Synadia Communications Inc. Retrier Utility' url = 'https://github.com/synadia-io/orbit.java' licenses { diff --git a/retrier/gradle/wrapper/gradle-wrapper.jar b/retrier/gradle/wrapper/gradle-wrapper.jar index 490fda8..1b33c55 100644 Binary files a/retrier/gradle/wrapper/gradle-wrapper.jar and b/retrier/gradle/wrapper/gradle-wrapper.jar differ diff --git a/retrier/gradle/wrapper/gradle-wrapper.properties b/retrier/gradle/wrapper/gradle-wrapper.properties index 442d913..ca025c8 100644 --- a/retrier/gradle/wrapper/gradle-wrapper.properties +++ b/retrier/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/retrier/gradlew b/retrier/gradlew index 2fe81a7..23d15a9 100644 --- a/retrier/gradlew +++ b/retrier/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,80 +15,115 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,87 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/retrier/gradlew.bat b/retrier/gradlew.bat index 62bd9b9..db3a6ac 100644 --- a/retrier/gradlew.bat +++ b/retrier/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -54,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/schedule-message/build.gradle b/schedule-message/build.gradle index 406e1f3..a5ae443 100644 --- a/schedule-message/build.gradle +++ b/schedule-message/build.gradle @@ -16,20 +16,17 @@ group = 'io.synadia' def isRelease = System.getenv("BUILD_EVENT") == "release" -def tc = System.getenv("TARGET_COMPATIBILITY"); -def targetCompat = tc == "21" ? JavaVersion.VERSION_21 : (tc == "17" ? JavaVersion.VERSION_17 : JavaVersion.VERSION_1_8) -def jarEnd = tc == "21" ? "-jdk21" : (tc == "17" ? "-jdk17" : "") -def jarAndArtifactName = "schedule-message" + jarEnd +def jarAndArtifactName = "schedule-message" version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" // version is the variable the build actually uses. System.out.println("Java: " + System.getProperty("java.version")) -System.out.println("Target Compatibility: " + targetCompat) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) System.out.println(group + ":" + jarAndArtifactName + ":" + version) java { sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = targetCompat + targetCompatibility = JavaVersion.VERSION_1_8 } repositories { @@ -40,11 +37,11 @@ repositories { } dependencies { - implementation 'io.nats:jnats:2.25.3' + implementation 'io.nats:jnats:2.26.2' implementation 'org.jspecify:jspecify:1.0.0' implementation 'io.synadia:counters:0.2.2' - testImplementation 'io.nats:jnats-server-runner:3.1.0' + testImplementation 'io.nats:jnats-server-runner:3.1.1' testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1' testImplementation 'org.junit.platform:junit-platform-launcher:1.14.3' } @@ -69,11 +66,12 @@ tasks.register('bundle', Bundle) { jar { bundle { - bnd("Bundle-Name": "io.synadia.schedule.message", + bnd("Automatic-Module-Name": "io.synadia.schedule.message", + "Bundle-Name": "io.synadia.schedule.message", "Bundle-Vendor": "synadia.io", "Bundle-Description": "JetStream Scheduled Messages", "Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/schedule-message", - "Target-Compatibility": "Java " + targetCompat + "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 ) } } diff --git a/utils/build.gradle b/utils/build.gradle index ce382a0..61df37c 100644 --- a/utils/build.gradle +++ b/utils/build.gradle @@ -6,15 +6,13 @@ plugins { group = 'io.synadia' version = "0.0.0" -def tc = System.getenv("TARGET_COMPATIBILITY"); -def targetCompat = tc == "21" ? JavaVersion.VERSION_21 : (tc == "17" ? JavaVersion.VERSION_17 : JavaVersion.VERSION_1_8) System.out.println("Java: " + System.getProperty("java.version")) -System.out.println("Target Compatibility: " + targetCompat) +System.out.println("Target Compatibility: " + JavaVersion.VERSION_1_8) java { sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = targetCompat + targetCompatibility = JavaVersion.VERSION_1_8 } repositories { @@ -24,5 +22,5 @@ repositories { } dependencies { - implementation 'io.nats:jnats:2.25.1' + implementation 'io.nats:jnats:2.26.2' }