diff --git a/.github/scripts/verify-central.sh b/.github/scripts/verify-central.sh index 98c15bbf2..90180c446 100755 --- a/.github/scripts/verify-central.sh +++ b/.github/scripts/verify-central.sh @@ -2,10 +2,11 @@ # Verifies the JPDFium artifact set, then runs a smoke against it. # MODE=staging Central Portal validated-deployment downloads (before release) # MODE=released repo1.maven.org (after the deployment is released) +# MODE=r2 the Stirling Maven repo at R2_REPO_URL (staging prefix or root) # Called by release.yml with VERSION and PLATFORM in the environment. set -euo pipefail -MODE="${MODE:?MODE must be staging or released}" +MODE="${MODE:?MODE must be staging, released or r2}" VERSION="${VERSION:?VERSION is required}" PLATFORM="${PLATFORM:?PLATFORM is required}" GROUP_PATH="com/stirling" @@ -21,6 +22,11 @@ case "$MODE" in REPO_URL="https://repo1.maven.org/maven2" PORTAL_TOKEN="" ;; + r2) + REPO_URL="${R2_REPO_URL:-https://maven.stirlingpdf.com}" + REPO_URL="${REPO_URL%/}" + PORTAL_TOKEN="" + ;; *) echo "ERROR: unknown MODE '$MODE'" >&2 exit 2 @@ -160,14 +166,20 @@ repositories { if (System.getenv("VERIFY_STAGING") == "true") { maven { url = uri(System.getenv("VERIFY_REPO_URL") + "/") - credentials(HttpHeaderCredentials::class) { - name = "Authorization" - value = System.getenv("VERIFY_TOKEN") + if (!System.getenv("VERIFY_TOKEN").isNullOrEmpty()) { + credentials(HttpHeaderCredentials::class) { + name = "Authorization" + value = System.getenv("VERIFY_TOKEN") + } + authentication { create("header") } } - authentication { create("header") } } } - mavenCentral() + mavenCentral { + if (System.getenv("VERIFY_STAGING") == "true") { + content { excludeGroup("com.stirling") } + } + } } dependencies { @@ -249,7 +261,7 @@ if [ "$VIPS_SUPPORTED" != "1" ]; then export VERIFY_VIPS=false fi -if [ "$MODE" = "staging" ]; then +if [ "$MODE" = "staging" ] || [ "$MODE" = "r2" ]; then export VERIFY_STAGING=true export VERIFY_REPO_URL="$REPO_URL" export VERIFY_TOKEN="$PORTAL_TOKEN" diff --git a/.github/workflows/mirror-central-to-r2.yml b/.github/workflows/mirror-central-to-r2.yml new file mode 100644 index 000000000..0309d5326 --- /dev/null +++ b/.github/workflows/mirror-central-to-r2.yml @@ -0,0 +1,102 @@ +name: Copy Central releases to maven.stirlingpdf.com + +on: + workflow_dispatch: + inputs: + versions: + description: 'Versions to copy: all, or a list such as 1.2.0,1.3.0' + required: true + default: 'all' + latest: + description: 'With all, copy only this many of the newest versions (smoke needs 1.1.0 or newer)' + required: false + default: '5' + destination: + description: 'Bucket prefix to copy to, e.g. staging/mirror-test/. Empty is the live repo root.' + required: false + default: '' + smoke: + description: 'Also run the six-platform smoke against each copied version' + required: false + default: false + type: boolean + dryRun: + description: 'Only list what would be copied' + required: false + default: false + type: boolean + +permissions: + contents: read + +jobs: + copy: + name: Copy from Maven Central + runs-on: ubuntu-latest + environment: maven + concurrency: + group: stirling-maven + cancel-in-progress: false + outputs: + versions: ${{ steps.mirror.outputs.versions }} + url: ${{ steps.mirror.outputs.url }} + steps: + - name: Refuse smoke for releases older than its artifact set + if: ${{ inputs.smoke && inputs.versions != 'all' }} + env: + VERSIONS: ${{ inputs.versions }} + run: | + for v in $(echo "$VERSIONS" | tr -s ', ' '\n'); do + if [ "$(printf '%s\n1.1.0\n' "$v" | sort -V | head -1)" != 1.1.0 ]; then + echo "ERROR: smoke expects the jpdfium-vips modules added in 1.1.0; $v predates them. Copy it without smoke." + exit 1 + fi + done + + - id: mirror + uses: Stirling-Tools/maven-r2-publish/mirror@137b6b342d035155657660adf93da370b518ed8d # main + with: + group: com.stirling + artifact: jpdfium + versions: ${{ inputs.versions }} + latest: ${{ inputs.latest }} + destination: ${{ inputs.destination }} + dry-run: ${{ inputs.dryRun }} + endpoint: ${{ secrets.R2_ENDPOINT }} + access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} + secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} + bucket: ${{ vars.R2_BUCKET || 'stirling-maven' }} + + smoke: + name: Smoke ${{ matrix.version }} (${{ matrix.platform }}) + needs: copy + if: ${{ inputs.smoke && !inputs.dryRun && needs.copy.outputs.versions != '[]' }} + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.copy.outputs.versions) }} + platform: [linux-x64, linux-arm64, darwin-x64, darwin-arm64, windows-x64, windows-arm64] + include: + - { platform: linux-x64, runner: ubuntu-24.04 } + - { platform: linux-arm64, runner: ubuntu-24.04-arm } + - { platform: darwin-x64, runner: macos-15-intel } + - { platform: darwin-arm64, runner: macos-15 } + - { platform: windows-x64, runner: windows-latest } + - { platform: windows-arm64, runner: windows-11-arm } + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7.0.1 + + - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v5.7.0 + with: + distribution: ${{ matrix.platform == 'windows-arm64' && 'microsoft' || 'temurin' }} + java-version: '25' + + - name: Verify every artifact and run the smoke + shell: bash + env: + MODE: r2 + R2_REPO_URL: ${{ needs.copy.outputs.url }} + VERSION: ${{ matrix.version }} + PLATFORM: ${{ matrix.platform }} + run: bash .github/scripts/verify-central.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d1d57158..bf4246943 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release to Central Portal +name: Release to maven.stirlingpdf.com on: push: @@ -8,18 +8,8 @@ on: version: description: 'Version to publish (e.g. 1.0.0). If omitted on tag push, derived from the tag.' required: false - autoRelease: - description: 'Auto-release to Maven Central without manual Publish click' - required: false - default: 'false' - type: boolean - verifyReleased: - description: 'Run the Maven Central probe after a manual release' - required: false - default: 'false' - type: boolean dryRun: - description: 'Build everything and publish to Maven Local instead of Central Portal' + description: 'Build, stage and verify, then delete the staging copy without releasing' required: false default: false type: boolean @@ -618,7 +608,7 @@ jobs: needs: build-natives if: always() # build whatever platform legs succeeded; others just fail that leg # CLI binaries are a release nicety, not the critical path: a failed leg - # must never block the Central Portal publish. PR regressions are still + # must never block the Maven release publish. PR regressions are still # caught hard by the dedicated cli.yml workflow. continue-on-error: true strategy: @@ -967,8 +957,10 @@ jobs: publish: needs: [build-natives, build-vips-natives, cli-binaries] runs-on: ubuntu-latest - permissions: - contents: write + environment: maven + outputs: + version: ${{ steps.v.outputs.version }} + staging-url: ${{ steps.stage.outputs.staging-url }} steps: - uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7.0.1 @@ -1000,13 +992,6 @@ jobs: path: .artifacts pattern: natives-* - - name: Download all CLI binaries - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.1 - continue-on-error: true # CLI legs can fail independently; natives still publish - with: - path: .artifacts - pattern: cli-* - - name: Flatten into native/dist// run: | mkdir -p native/dist @@ -1029,27 +1014,30 @@ jobs: REF="${GITHUB_REF_NAME}" VERSION="${REF#v}" fi - if [ -z "$VERSION" ]; then - echo "ERROR: could not resolve version" + if ! [[ "$VERSION" =~ ^[0-9A-Za-z._-]+$ ]]; then + echo "ERROR: '$VERSION' is not a valid release version" exit 1 fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "Publishing version: $VERSION" - - name: Publish to Central Portal - if: inputs.dryRun != true + - name: Build the signed release repo env: - CENTRAL_PORTAL_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }} - CENTRAL_PORTAL_PASSWORD: ${{ secrets.CENTRAL_PORTAL_PASSWORD }} GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} VERSION: ${{ steps.v.outputs.version }} - run: | - ARGS=(publishAllToCentralPortal "-Pjpdfium.version=$VERSION") - if [ "${{ inputs.autoRelease }}" = "true" ]; then - ARGS+=(-PautoRelease=true) - fi - ./gradlew "${ARGS[@]}" --no-daemon --stacktrace + run: ./gradlew publishAllToR2Staging "-Pjpdfium.version=$VERSION" --no-daemon --stacktrace + + - name: Stage on the Stirling Maven repo + id: stage + uses: Stirling-Tools/maven-r2-publish/release@137b6b342d035155657660adf93da370b518ed8d # main + with: + step: stage + repo-dir: build/r2-repo + endpoint: ${{ secrets.R2_ENDPOINT }} + access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} + secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} + bucket: ${{ vars.R2_BUCKET || 'stirling-maven' }} - name: Publish to Maven Local (dry run) if: inputs.dryRun == true @@ -1057,52 +1045,23 @@ jobs: VERSION: ${{ steps.v.outputs.version }} run: ./gradlew publishToMavenLocal "-Pjpdfium.version=$VERSION" --no-daemon --stacktrace - - name: Attach CLI binaries to GitHub Release - if: startsWith(github.ref, 'refs/tags/') && inputs.dryRun != true - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - TAG="${GITHUB_REF_NAME}" - mkdir -p dist/cli - # Download-artifact nests each artifact under .artifacts/cli-/. - for d in .artifacts/cli-*; do - [ -d "$d" ] || continue - cp -v "$d"/jpdfium-* dist/cli/ 2>/dev/null || true - done - if ls dist/cli/* >/dev/null 2>&1; then - gh release view "$TAG" >/dev/null 2>&1 || \ - gh release create "$TAG" --title "JPDFium ${TAG#v}" --generate-notes - gh release upload "$TAG" dist/cli/* --clobber - echo "Attached CLI binaries to release $TAG:" >> $GITHUB_STEP_SUMMARY - ls -la dist/cli/ >> $GITHUB_STEP_SUMMARY - else - echo "No CLI binaries built for this release." >> $GITHUB_STEP_SUMMARY - fi - - name: Summary env: VERSION: ${{ steps.v.outputs.version }} + STAGING_URL: ${{ steps.stage.outputs.staging-url }} run: | - if [ "${{ inputs.dryRun }}" = "true" ]; then - echo "### Dry run: published com.stirling:*:$VERSION to Maven Local" >> "$GITHUB_STEP_SUMMARY" - else - echo "### Published com.stirling:*:$VERSION" >> "$GITHUB_STEP_SUMMARY" - echo "" >> "$GITHUB_STEP_SUMMARY" - if [ "${{ inputs.autoRelease }}" = "true" ]; then - echo "Auto-release enabled - artifacts will land on Maven Central in 10–30 min." >> "$GITHUB_STEP_SUMMARY" - else - echo "Review and click **Publish** at https://central.sonatype.com/publishing/deployments" >> "$GITHUB_STEP_SUMMARY" - fi - fi + { + echo "### Staged com.stirling:*:$VERSION" + echo "" + echo "$STAGING_URL - released to the root once every platform verifies." + } >> "$GITHUB_STEP_SUMMARY" # ── Pre-release verification: every artifact in the staged deployment ── verify-staging: name: Verify staged artifacts (${{ matrix.platform }}) needs: publish - # Automatic deployments can already be published by this point. Verify them - # through Maven Central below, rather than the validated-deployment endpoint. - if: inputs.dryRun != true && inputs.autoRelease != true && (startsWith(github.ref, 'refs/tags/') || inputs.version != '') + if: startsWith(github.ref, 'refs/tags/') || inputs.version != '' strategy: fail-fast: false matrix: @@ -1122,35 +1081,147 @@ jobs: distribution: ${{ matrix.platform == 'windows-arm64' && 'microsoft' || 'temurin' }} java-version: '25' - - name: Resolve version - id: v + - name: Verify every staged artifact and run the smoke shell: bash env: - INPUT_VERSION: ${{ inputs.version }} + MODE: r2 + R2_REPO_URL: ${{ needs.publish.outputs.staging-url }} + VERSION: ${{ needs.publish.outputs.version }} + PLATFORM: ${{ matrix.platform }} + run: bash .github/scripts/verify-central.sh + + # ── Release: copy the verified staging set to the root, then drop staging ── + promote: + name: Release to maven.stirlingpdf.com + needs: [publish, verify-staging] + if: ${{ !inputs.dryRun }} + runs-on: ubuntu-latest + environment: maven + concurrency: + group: stirling-maven + cancel-in-progress: false + steps: + - name: Release the verified staging set + uses: Stirling-Tools/maven-r2-publish/release@137b6b342d035155657660adf93da370b518ed8d # main + with: + step: promote + endpoint: ${{ secrets.R2_ENDPOINT }} + access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} + secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} + bucket: ${{ vars.R2_BUCKET || 'stirling-maven' }} + + attach-cli: + name: Attach CLI binaries to the GitHub release + needs: [publish, promote] + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7.0.1 + with: + persist-credentials: false + + - name: Download all CLI binaries + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.1 + continue-on-error: true # CLI legs can fail independently; the release still ships + with: + path: .artifacts + pattern: cli-* + + - name: Attach CLI binaries to GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "$INPUT_VERSION" ]; then - VERSION="$INPUT_VERSION" + TAG="${GITHUB_REF_NAME}" + mkdir -p dist/cli + # Download-artifact nests each artifact under .artifacts/cli-/. + for d in .artifacts/cli-*; do + [ -d "$d" ] || continue + cp -v "$d"/jpdfium-* dist/cli/ 2>/dev/null || true + done + if ls dist/cli/* >/dev/null 2>&1; then + gh release view "$TAG" >/dev/null 2>&1 || \ + gh release create "$TAG" --title "JPDFium ${TAG#v}" --generate-notes + gh release upload "$TAG" dist/cli/* --clobber + echo "Attached CLI binaries to release $TAG:" >> "$GITHUB_STEP_SUMMARY" + ls -la dist/cli/ >> "$GITHUB_STEP_SUMMARY" else - REF="${GITHUB_REF_NAME}" - VERSION="${REF#v}" + echo "No CLI binaries built for this release." >> "$GITHUB_STEP_SUMMARY" fi - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - name: Verify every staged artifact and run the smoke - shell: bash + publish-central: + name: Publish to Maven Central + needs: [publish, promote] + runs-on: ubuntu-latest + continue-on-error: true + concurrency: + group: central-portal + cancel-in-progress: false + steps: + - uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7.0.1 + with: + persist-credentials: false + + - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v5.7.0 + with: + distribution: 'temurin' + java-version: '25' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@c0152e9a6b68fc2b5c1f256331f2e8f82b68ad62 # v6.3.0 + with: + cache-disabled: true + + - name: Install jextract + # jpdfium/build.gradle.kts uses jextract to generate JpdfiumH.java + # FFM bindings from native/bridge/include/jpdfium.h. Without it the + # publish job fails on compileJava with `cannot find symbol JpdfiumH` + # - the natives jars (built earlier in this run) ship fine but the + # main jpdfium.jar can't be built without bindings. Mirrors the + # snapshot.yml + publish-github-packages.yml jextract install step. + run: | + JEXTRACT_URL="https://download.java.net/java/early_access/jextract/25/2/openjdk-25-jextract+2-4_linux-x64_bin.tar.gz" + mkdir -p "$HOME/jextract-install" + curl -fsSL --retry 5 --retry-all-errors --retry-delay 3 --max-time 120 "$JEXTRACT_URL" -o /tmp/jextract.tar.gz + tar -xzf /tmp/jextract.tar.gz -C "$HOME/jextract-install" --strip-components=1 + echo "JEXTRACT_HOME=$HOME/jextract-install" >> "$GITHUB_ENV" + + - name: Download all native artifacts + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.1 + with: + path: .artifacts + pattern: natives-* + + - name: Flatten into native/dist// + run: | + mkdir -p native/dist + for d in .artifacts/natives-*; do + plat="${d##*natives-}" + mkdir -p "native/dist/$plat" + cp -v "$d"/* "native/dist/$plat/" + done + echo "--- final layout ---" + find native/dist -type f | sort + + - name: Publish to Central Portal env: - MODE: staging - VERSION: ${{ steps.v.outputs.version }} - PLATFORM: ${{ matrix.platform }} CENTRAL_PORTAL_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }} CENTRAL_PORTAL_PASSWORD: ${{ secrets.CENTRAL_PORTAL_PASSWORD }} - run: bash .github/scripts/verify-central.sh + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} + VERSION: ${{ needs.publish.outputs.version }} + run: ./gradlew publishAllToCentralPortal "-Pjpdfium.version=$VERSION" -PautoRelease=true --no-daemon --stacktrace - # ── Post-release verification: probe Maven Central once it is released ── - verify-released: + - name: Summary + env: + VERSION: ${{ needs.publish.outputs.version }} + run: echo "### Sent com.stirling:*:$VERSION to Maven Central; it appears there in 10-30 min" >> "$GITHUB_STEP_SUMMARY" + + verify-central: name: Verify Maven Central (${{ matrix.platform }}) - needs: publish - if: inputs.dryRun != true && (inputs.autoRelease == true || inputs.verifyReleased == true) + needs: [publish, publish-central] + continue-on-error: true strategy: fail-fast: false matrix: @@ -1170,24 +1241,26 @@ jobs: distribution: ${{ matrix.platform == 'windows-arm64' && 'microsoft' || 'temurin' }} java-version: '25' - - name: Resolve version - id: v - shell: bash - env: - INPUT_VERSION: ${{ inputs.version }} - run: | - if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "$INPUT_VERSION" ]; then - VERSION="$INPUT_VERSION" - else - REF="${GITHUB_REF_NAME}" - VERSION="${REF#v}" - fi - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - name: Probe Maven Central and run the smoke shell: bash env: MODE: released - VERSION: ${{ steps.v.outputs.version }} + VERSION: ${{ needs.publish.outputs.version }} PLATFORM: ${{ matrix.platform }} run: bash .github/scripts/verify-central.sh + + cleanup-staging: + name: Delete the staging copy + needs: [publish, verify-staging, promote] + if: ${{ always() && needs.publish.result == 'success' && needs.verify-staging.result != 'failure' && needs.promote.result != 'failure' }} + runs-on: ubuntu-latest + environment: maven + steps: + - name: Delete this run's staging copy + uses: Stirling-Tools/maven-r2-publish/release@137b6b342d035155657660adf93da370b518ed8d # main + with: + step: cleanup + endpoint: ${{ secrets.R2_ENDPOINT }} + access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} + secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} + bucket: ${{ vars.R2_BUCKET || 'stirling-maven' }} diff --git a/CHANGELOG.md b/CHANGELOG.md index c0e77b467..1881a5e40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ below ships in 1.3.0. Every incompatible change is listed here under "Removed" or "Changed", and [compatibility.md](docs/compatibility.md) states the policy in full. -This file covers library releases on Maven Central (the `v*.*.*` tags). +This file covers library releases (the `v*.*.*` tags), published to +https://maven.stirlingpdf.com and mirrored to Maven Central. Infrastructure tags such as `pdfium-*` and `vips-*` are prebuild inputs for the publishing workflows, not library releases, so they are not listed here. @@ -88,6 +89,11 @@ publishing workflows, not library releases, so they are not listed here. ### Changed +- Releases publish to https://maven.stirlingpdf.com first and are then mirrored + to Maven Central. Add `maven("https://maven.stirlingpdf.com")` to your + repositories to get a release as soon as it is out; earlier releases are there + too. Runtime native downloads (`jpdfium.native.download`) now default to this + repository. - Compression no longer degrades an image that is already below the resize threshold unless the caller opts in. `CompressPreset.WEB`, `SCREEN`, `PRINT` and `CompressOptions.builder().maxImageDpi(...)` keep their historic @@ -114,7 +120,6 @@ publishing workflows, not library releases, so they are not listed here. Form XObjects, patterns, Type 3 glyphs and annotation appearances are always converted, so `convertForms` and `convertLosslessImages` no longer affect PDF/X output. - - `PdfMerge.mergeFilesToFile` and `PdfSplit.extractPageRangeToFile` write their staging file without fsync and flush once when they publish the output, which now gets the destination's permissions as other saves do. They previously diff --git a/README.md b/README.md index 6eb06ad69..da5101e21 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,9 @@ plugins { } repositories { + maven("https://maven.stirlingpdf.com") { + content { includeGroup("com.stirling") } + } mavenCentral() } diff --git a/build.gradle.kts b/build.gradle.kts index 5d3680cc7..6f5e21ef9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -328,3 +328,24 @@ tasks.register("publishAllToCentralPortal") { dependsOn(subprojects.filter { it.plugins.hasPlugin("maven-publish") }.map { "${it.path}:publishAllPublicationsToCentralPortalRepository" }) finalizedBy("finalizePortalDeployment") } + +// Release layout for https://maven.stirlingpdf.com; release.yml uploads it with +// Stirling-Tools/maven-r2-publish. +val r2StagingDir = layout.buildDirectory.dir("r2-repo") + +subprojects { + plugins.withId("maven-publish") { + extensions.configure { + repositories.maven { + name = "r2Staging" + url = uri(r2StagingDir) + } + } + } +} + +tasks.register("publishAllToR2Staging") { + group = "publishing" + description = "Publish all modules into build/r2-repo for upload to the Stirling Maven repo" + dependsOn(subprojects.map { sub -> sub.tasks.matching { it.name == "publishAllPublicationsToR2StagingRepository" } }) +} diff --git a/docs/configuration.md b/docs/configuration.md index 7e5585bd2..b9427cc52 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -53,7 +53,7 @@ These bound concurrent admission, not memory. Two operations admitted together m | `jpdfium.native.sweep` | `true` | Set to `false` to disable cleanup of stale cache entries. | | `jpdfium.native.download` | `false` | Set to `true` to download a missing native module at runtime. | | `jpdfium.native.version` | Version stamped in the JAR | Version to download at runtime. | -| `jpdfium.native.repo` | Maven Central | Repository URL for runtime downloads. | +| `jpdfium.native.repo` | `https://maven.stirlingpdf.com` | Repository URL for runtime downloads. | `jpdfium.native.verify=marker` weakens cache-integrity verification. See [native-loading.md](native-loading.md) for the trust model before using it. diff --git a/docs/installation.md b/docs/installation.md index 9899ca377..2aba1c769 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,6 +1,6 @@ # Installation -JPDFium publishes to Maven Central under the `com.stirling` group. The current release is **1.3.1**. +JPDFium publishes to https://maven.stirlingpdf.com under the `com.stirling` group. Each release is then also sent to Maven Central, but that copy is best effort: a release can be on maven.stirlingpdf.com before, or without, reaching Central. The current release is **1.3.1**. ## Requirements @@ -26,6 +26,13 @@ Java 25 is the version JPDFium is built and tested against. Earlier releases are Windows x64. Substitute the native module for your platform from the table below. ```kotlin +repositories { + maven("https://maven.stirlingpdf.com") { + content { includeGroup("com.stirling") } + } + mavenCentral() +} + dependencies { implementation(platform("com.stirling:jpdfium-bom:1.3.1")) implementation("com.stirling:jpdfium") @@ -38,6 +45,13 @@ dependencies { Windows x64. ```xml + + + stirling + https://maven.stirlingpdf.com + + + diff --git a/docs/native-loading.md b/docs/native-loading.md index 262598123..95d358e82 100644 --- a/docs/native-loading.md +++ b/docs/native-loading.md @@ -8,9 +8,9 @@ Packaging depends on your deployment model; see [deployment.md](deployment.md). ## Downloading at runtime -As an alternative to bundling, JPDFium can download the matching native artifact from Maven Central the first time it runs and reuse the cached copy afterwards. +As an alternative to bundling, JPDFium can download the matching native artifact from https://maven.stirlingpdf.com, or the repository set in `jpdfium.native.repo`, the first time it runs and reuse the cached copy afterward. -This is disabled by default. Enable it only when network access to Maven Central is acceptable at runtime: +This is disabled by default. Enable it only when network access to the configured repository is acceptable at runtime: ```bash java -Djpdfium.native.download=true --enable-native-access=ALL-UNNAMED -jar app.jar diff --git a/examples/render-first-page/README.md b/examples/render-first-page/README.md index 49152a391..883cc7f22 100644 --- a/examples/render-first-page/README.md +++ b/examples/render-first-page/README.md @@ -1,6 +1,6 @@ # Render the first page -A minimal JPDFium consumer project. It resolves `com.stirling:jpdfium` from Maven Central and renders `sample.pdf` (the JPDFium logo) to a PNG at 150 DPI. +A minimal JPDFium consumer project. It resolves `com.stirling:jpdfium` from https://maven.stirlingpdf.com and renders `sample.pdf` (the JPDFium logo) to a PNG at 150 DPI. From the repository root: diff --git a/examples/render-first-page/build.gradle.kts b/examples/render-first-page/build.gradle.kts index eef2274a6..6147c4bba 100644 --- a/examples/render-first-page/build.gradle.kts +++ b/examples/render-first-page/build.gradle.kts @@ -6,6 +6,9 @@ plugins { } repositories { + maven("https://maven.stirlingpdf.com") { + content { includeGroup("com.stirling") } + } mavenCentral() } diff --git a/jpdfium/src/main/java/stirling/software/jpdfium/panama/NativeDownloader.java b/jpdfium/src/main/java/stirling/software/jpdfium/panama/NativeDownloader.java index 16a04af1e..b61e83ff1 100644 --- a/jpdfium/src/main/java/stirling/software/jpdfium/panama/NativeDownloader.java +++ b/jpdfium/src/main/java/stirling/software/jpdfium/panama/NativeDownloader.java @@ -31,9 +31,9 @@ *

Off by default. When {@code -Djpdfium.native.download=true} is set and * the classpath has no natives jar for the current platform, the matching * {@code com.stirling:jpdfium-natives-:} jar is fetched - * from Maven Central (or {@code -Djpdfium.native.repo=...}), cached under the - * native cache root for offline reuse, and loaded through the same - * checksum-verified extraction path as a bundled jar. + * from https://maven.stirlingpdf.com (or {@code -Djpdfium.native.repo=...}), + * cached under the native cache root for offline reuse, and loaded through + * the same checksum-verified extraction path as a bundled jar. * *

Trust model: TLS authenticates the repository (plain http is refused * except for loopback test servers), and every extracted file is still @@ -50,7 +50,7 @@ final class NativeDownloader { static final String ENABLE_PROPERTY = "jpdfium.native.download"; static final String VERSION_PROPERTY = "jpdfium.native.version"; static final String REPO_PROPERTY = "jpdfium.native.repo"; - static final String DEFAULT_REPO = "https://repo1.maven.org/maven2"; + static final String DEFAULT_REPO = "https://maven.stirlingpdf.com"; static final String GROUP_PATH = "com/stirling"; static final String VERSION_RESOURCE = "jpdfium-version.properties"; diff --git a/jpdfium/src/test/java/stirling/software/jpdfium/panama/NativeDownloaderTest.java b/jpdfium/src/test/java/stirling/software/jpdfium/panama/NativeDownloaderTest.java index 2ba759492..b924e1595 100644 --- a/jpdfium/src/test/java/stirling/software/jpdfium/panama/NativeDownloaderTest.java +++ b/jpdfium/src/test/java/stirling/software/jpdfium/panama/NativeDownloaderTest.java @@ -113,6 +113,12 @@ void jarUrlUsesCentralLayout() { NativeDownloader.jarUrl("windows-x64", "1.1.5", "https://repo1.maven.org/maven2")); } + @Test + void repoBaseDefaultsToTheStirlingRepository() { + System.clearProperty(NativeDownloader.REPO_PROPERTY); + assertEquals("https://maven.stirlingpdf.com", NativeDownloader.repoBase()); + } + @Test void repoBaseTrimsSlashesAndRejectsPlainHttp() { System.setProperty(NativeDownloader.REPO_PROPERTY, "https://repo1.maven.org/maven2///");