diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml new file mode 100644 index 00000000..dd272813 --- /dev/null +++ b/.github/workflows/publish-snapshot.yml @@ -0,0 +1,67 @@ +name: publish snapshot + +# Publishes the selected branch's -SNAPSHOT build to the Central Portal snapshot repository +# (docs/plans/publishing.md, Phase 3). Run by hand from the Actions tab; nothing triggers it +# automatically. Snapshots are not signed, so no GPG key is involved. The Central user token +# comes from the MAVEN_CENTRAL_USERNAME and MAVEN_CENTRAL_PASSWORD repository secrets, which +# .mvn/settings.xml maps to the `central` server. + +on: + workflow_dispatch: + +# One publish at a time per branch, so two runs cannot interleave their uploads. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +permissions: + contents: read + +jobs: + publish: + name: publish snapshot + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + cache: maven + - name: Refuse anything but a -SNAPSHOT version + id: coordinates + # A release goes through -Prelease and the Portal's Publish button, never this workflow. + run: | + group=$(./mvnw -B -ntp -q -N help:evaluate -Dexpression=project.groupId -DforceStdout) + version=$(./mvnw -B -ntp -q -N help:evaluate -Dexpression=project.version -DforceStdout) + echo "coordinates: $group:*:$version" + case "$version" in + *-SNAPSHOT) ;; + *) echo "::error::$version is not a -SNAPSHOT version"; exit 1 ;; + esac + echo "group=$group" >> "$GITHUB_OUTPUT" + echo "version=$version" >> "$GITHUB_OUTPUT" + - name: Require the Central token + env: + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + # Unset, settings.xml would send the literal ${env...} text and fail late with a 401. + run: | + if [ -z "$MAVEN_CENTRAL_USERNAME" ] || [ -z "$MAVEN_CENTRAL_PASSWORD" ]; then + echo "::error::set the MAVEN_CENTRAL_USERNAME and MAVEN_CENTRAL_PASSWORD secrets" + exit 1 + fi + - name: Build, test, and deploy + env: + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + # deploy runs the unit tests and gates first, so a broken build is never published. + run: ./mvnw -B -ntp -s .mvn/settings.xml deploy + - name: Summarize the published coordinates + env: + GROUP: ${{ steps.coordinates.outputs.group }} + VERSION: ${{ steps.coordinates.outputs.version }} + run: scripts/snapshot-summary.sh "$GROUP" "$VERSION" >> "$GITHUB_STEP_SUMMARY" diff --git a/.mvn/settings.xml b/.mvn/settings.xml new file mode 100644 index 00000000..a7a2b84c --- /dev/null +++ b/.mvn/settings.xml @@ -0,0 +1,16 @@ + + + + + + + central + ${env.MAVEN_CENTRAL_USERNAME} + ${env.MAVEN_CENTRAL_PASSWORD} + + + diff --git a/docs/plans/overall.md b/docs/plans/overall.md index d944a83d..dba23332 100644 --- a/docs/plans/overall.md +++ b/docs/plans/overall.md @@ -1048,6 +1048,7 @@ in CI; at least two "pgjdbc can't do this cleanly" capabilities documented. - [ ] **N7.1** Reproducible builds, signing, Maven Central (C24.8); semver + changelog. The reproducible `project.build.outputTimestamp` is set; GPG signing, Central deployment wiring, and the semver/changelog policy remain. + The step-by-step is `docs/plans/publishing.md`. Wire the revapi (or japicmp) binary-compatibility gate as part of this, not after it: it diffs against the last released artifact, so the first release is the moment it becomes possible, and it is what makes the Stable tier mean diff --git a/docs/plans/publishing.md b/docs/plans/publishing.md new file mode 100644 index 00000000..560e823f --- /dev/null +++ b/docs/plans/publishing.md @@ -0,0 +1,262 @@ +# Plan: publishing to Maven Central (N7.1 / C24.8) + +Status: **snapshots rehearsed; releases deferred.** The POM wiring (steps 6a +to 10) is done, and a first snapshot was published under `io.github.sehrope` +from a local deploy (step 11). The groupId swap (6c) has since been dropped, +so the build is `org.postgresql` again, and `publish-snapshot.yml` publishes +one by hand (step 19) once the repository holds a token with rights on +`org.postgresql` (step 22). No signing key exists yet, so Phases 4 and 5 wait. +The running status is in [`overall.md`](overall.md) under N7.1. + +The approach: rehearse the whole pipeline in a fork under a personal +`io.github.` namespace, snapshots first and then a real release, and +merge the wiring back once it works. The final coordinates are `org.postgresql` +(ADR-0022); the fork differs from upstream only in the groupId literal and the +credentials, so the merge is the groupId swap plus whatever landed in the POMs. + +## What gets published + +Five artifacts: `postgresql-client-parent` (POM only, but every module's POM +points at it so it must be on Central), `postgresql-client-protocol`, +`postgresql-client`, `postgresql-client-jdbc`, and +`postgresql-client-pgjdbc-compat`. `postgresql-client-bench`, +`postgresql-client-bench-jmh`, `postgresql-client-coverage`, and +`postgresql-client-native-smoke` set `maven.deploy.skip` and never ship. + +Open question, to settle before the first non-snapshot release: whether the +compat module belongs in a public release at all. It is a migration aid, not a +certified drop-in, and it publishes classes under pgjdbc's own package names, so +adding it next to real pgjdbc produces a split package. Options are to ship it, +ship it with an explicit warning in its POM description, or skip it until it is +certified. Snapshots can carry it either way. + +## How the Central Portal works (verified 2026-10-23) + +- OSSRH is gone (retired 2025-06-30). Everything goes through the Central + Publisher Portal at central.sonatype.com, authenticated by a user token. +- A release deploy creates a *deployment* that is validated and then waits in + VALIDATED state until someone presses Publish in the Portal UI or calls the + publish endpoint. Drop discards it. This is `publishingType=USER_MANAGED`, the + default; `AUTOMATIC` skips the human step. Validated deployments are kept 90 + days. +- The Portal login has no second factor of its own; a Central account is as + strong as the GitHub or Google account linked to it. There is no OIDC or + trusted-publishing flow: CI holds a user token as a secret. +- Snapshots: enabled per namespace in the Portal UI, pushed to + `https://central.sonatype.com/repository/maven-snapshots/`, no validation and + no signing, purged after 90 days. +- Releases: every file needs a detached PGP `.asc` and the public key must be on + `keyserver.ubuntu.com`, `keys.openpgp.org`, or `pgp.mit.edu`. The POM needs + `name`, `description`, `url`, `licenses`, `scm`, and `developers`, and each + jar needs sources and javadoc jars. Sigstore signatures are accepted only in + addition to PGP; GitHub artifact attestations are not consumed by Central or + by Maven at all. +- `central-publishing-maven-plugin` (`org.sonatype.central`, 0.9.0) replaces + the deploy plugin, bundles the whole reactor, and uploads it at the end of the + build. It routes `-SNAPSHOT` versions to the snapshot repository on its own. + +## How pgjdbc publishes (for reference, checked 2026-10-23) + +pgjdbc is Gradle, so the plugins differ, but the shape is the one to copy. The +publishing logic is in `build-logic/publishing/src/main/kotlin/` and +`build-logic/root-build/`, with knobs declared in `build-logic/build-parameters/`. + +- **Central Portal via `com.gradleup.nmcp` 1.5.0.** The root project applies + `nmcp.aggregation` and configures `centralPortal` with username and password + read from the `CENTRAL_PORTAL_USERNAME` / `CENTRAL_PORTAL_PASSWORD` + environment variables, a `publishingType` build parameter (`AUTOMATIC` by + default, `MANUAL` available), and a 60-minute `validationTimeout`. Each + published subproject applies `build-logic.publish-to-central`, which pulls + `maven-publish`, `signing`, and `nmcp`. +- **Snapshot vs release is a build parameter.** `-Prelease` (default false) + switches the version suffix. Without it, the publish plugin registers a + `centralSnapshots` Maven repository at + `https://central.sonatype.com/repository/maven-snapshots` with + `PasswordCredentials`, fed from Gradle properties + `centralSnapshotsUsername` / `centralSnapshotsPassword`. With it, signing is + configured instead and the Portal upload is used. So snapshots never sign + and releases never go to the snapshot repository, by construction. +- **Signing.** Build parameters `signing.pgp.enabled` (`AUTO`, meaning on + for releases, or `OFF`) and `signing.pgp.implementation` (`IN_MEMORY` + default, or `GPG_CLI`). In-memory signing reads `SIGNING_PGP_PRIVATE_KEY` + and `SIGNING_PGP_PASSPHRASE` from the environment and fails the build with a + Gradle Problems report if either is missing. `GPG_CLI` is the local escape + hatch. The key itself is generated and maintained *inside* GitHub Actions by + the reusable workflow `vlsi/provision-release-pgp-key` + (`pgp-key-maintenance.yaml`, `workflow_dispatch` only): key name "pgjdbc + releases", email `pgjdbc-releases@jdbc.postgresql.org`, five-year lifetime, + uploaded to `keyserver.ubuntu.com`, `keys.openpgp.org`, and `pgp.mit.edu`. + Rerunning extends the expiry, so any committer can renew without holding the + key. It needs a fine-grained token with `secrets: write` and + `variables: write` (`RELEASE_PGP_SECRET_UPDATE_TOKEN`). +- **Artifacts and POM.** `withSourcesJar()` always, `withJavadocJar()` unless + `skipJavadoc`. The POM block sets name, description, inceptionYear, url, + licenses, organization, developers (seven named committers), issueManagement, + mailingLists, and scm with `tag` fixed to `HEAD`. Dependency versions in the + POM come from Gradle's resolution result rather than declared ranges. +- **A local staging copy.** `build-logic.publish-to-tmp-maven-repo` adds a + `tmp-maven` repository under `build/local-maven-repo`, cleaned before each + publish. The release workflow publishes to Central and to `tmp-maven` in the + same Gradle run, so the jar and `.asc` attached to the GitHub release are + byte-for-byte what went to Central. A `createReleaseBundle` task gathers + every publishable artifact into `build/release` and mentions SLSA + attestation in its description, but `release.yml` runs no attestation step + today. +- **`nightlysnapshot.yml`** runs on every push to `master`, first checks the + two secrets exist and skips cleanly if not, then runs + `publishAllPublicationsToCentralSnapshotsRepository` with the Portal token + (still stored as `NEXUS_USERNAME` / `NEXUS_PASSWORD`) mapped to the Gradle + properties through `ORG_GRADLE_PROJECT_*`. +- **`release.yml`** is `workflow_dispatch` only with an optional version input + (default from `gradle.properties`). It refuses to run off `master` or + `release/**`, refuses an existing `REL` tag, and bumps the version + through a GitHub App token. The publish step runs + `publishAggregationToCentralPortal` with `release=true` and + `centralPortalPublishingType=AUTOMATIC`, so the manual dispatch is the human + gate rather than the Portal's Publish button. It publishes *before* tagging, + so a failed upload leaves no tag to clean up, then creates the GitHub release + with release-drafter, attaches the staged jar and signature, and bumps to the + next snapshot. Permissions are `contents: write` only: no `id-token`, no + environment protection. + +Worth adopting from that: the generated-in-CI key with the extend-on-rerun +workflow (no developer ever holds the release key), the fail-loud check for +missing signing secrets, the secrets-present guard on the snapshot job, the +branch and tag guards, publishing before tagging, and attaching the same bytes +that went to Central to the GitHub release. The snapshot/release split is +simpler for us: the Central plugin routes `-SNAPSHOT` on its own, and the +`release` profile is what adds signing. Worth doing differently: keep +`autoPublish` off, at least until the pipeline has run clean a few times, so +the Portal's Publish button stays as a second look. + +## Phase 1: account and namespace (once, in the Portal) + +1. Log in at central.sonatype.com, open View Namespaces, Add Namespace, enter + `io.github.`. `io.github.` verifies automatically if the Central + account was created through GitHub login; `io.github.` never does. +2. If it shows Unverified, create a public repository named exactly the + verification key under that account (works for an org too), wait for the + check, then delete the repository. +3. On the namespace's dropdown, choose Enable SNAPSHOTs. +4. Generate a user token at central.sonatype.com/usertoken. Both halves are shown + once; save them. +5. Export the token halves as `MAVEN_CENTRAL_USERNAME` and + `MAVEN_CENTRAL_PASSWORD`. The committed `.mvn/settings.xml` maps them to + the `central` server, and every deploy passes it with + `-s .mvn/settings.xml`. It is not in `.mvn/maven.config`: `-s` replaces + `~/.m2/settings.xml` (mirrors, proxies) rather than merging with it, so it + would change every build. Other builds never read the credentials; with + the variables unset, only a deploy fails (401). + +## Phase 2: fork POM changes + +6a. Done: every inter-module dependency's `` is `${project.groupId}` + (15 blocks across the root `dependencyManagement` and the module POMs), so + publishing under other coordinates means editing the root `` and + the `` blocks and nothing else. Parent references cannot be + properties, which is why those stay literal. +6b. Done: `maven.deploy.skip` on `postgresql-client-coverage`, matching the + other three build-only modules; without it a deploy pushed the coverage + POM. +6c. Done for the rehearsal, then dropped (step 21): swap the groupId, the one + spot: + + ```sh + git grep -l 'org.postgresql' -- pom.xml '*/pom.xml' \ + | xargs sed -i 's|org.postgresql|io.github.NAME|' + ``` + + After 6a this hits the root `` and the nine `` blocks and + nothing else; no dependency in the reactor shares that literal. Keep this + as its own commit so it can be reverted cleanly at merge time. +7. Done: ``, `` (`connection`, `developerConnection`, `url`, `tag`), + and `` in the root POM, pointing at `github.com/pgjdbc/pg-java` + so they carry over at merge time. The `child.*.inherit.append.path` + attributes stop the modules appending their artifactId to the URLs. +8. Done: `central-publishing-maven-plugin` 0.9.0 in the root `` + with `true`, `publishingServerId` `central`, + `autoPublish` false, and the four build-only modules in `excludeArtifacts`. +9. Done: a `release` profile in the root POM with `maven-source-plugin` + (`jar-no-fork`), `maven-javadoc-plugin` (`jar`), and `maven-gpg-plugin` + 3.2.7 (`sign`, `bestPractices` true, passphrase from + `MAVEN_GPG_PASSPHRASE`). The build-only modules skip all three. +10. Done: `./mvnw -ntp -DskipTests -Prelease -Dgpg.skip package` passes with + doclint at `all,-missing`. Missing comments were the bulk of the findings; + the rest (an unescaped `<<`, a link into `java.sql` from core, two broken + `{@link}`s) were fixed in their own commits. + +## Phase 3: first snapshot + +11. `./mvnw -ntp -s .mvn/settings.xml deploy` with the version still + `0.1.0-SNAPSHOT`. No signing, no validation. +12. Check the Portal lists exactly the five artifacts above. If a build-only + module appears, the plugin ignored `maven.deploy.skip`, and each of the four + POMs needs `true` instead. +13. Resolve it from a scratch project: + + ```xml + + central-portal-snapshots + https://central.sonatype.com/repository/maven-snapshots/ + true + + ``` + +## Phase 4: signing key (once) + +Two ways; pick one. + +14a. Local key: `gpg --gen-key` with a project identity, then + `gpg --keyserver keys.openpgp.org --send-keys KEYID` (keys.openpgp.org + serves the identity only after the confirmation email is answered). Export + with `gpg --export-secret-keys -a KEYID` and store it, the passphrase, and + the Central token as GitHub Actions secrets. +14b. CI-held key, pgjdbc style: add a `pgp-key-maintenance.yaml` that calls + `vlsi/provision-release-pgp-key` (digest-pinned) with the project's key + name and email, give it a fine-grained token with `secrets: write` and + `variables: write`, and dispatch it once. The private key lands in + `RELEASE_PGP_PRIVATE_KEY` and never leaves Actions; rerun to extend. + Preferable for upstream, since no individual holds the `org.postgresql` + release key. Local releases are then impossible by design, which is the + point. + +## Phase 5: first release + +15. Set the version with `./mvnw versions:set -DnewVersion=0.1.0`, commit, tag + `v0.1.0`. (Or publish before tagging, as pgjdbc does; either way the tag + must not exist before the upload succeeds.) +16. `./mvnw -ntp -s .mvn/settings.xml -Prelease deploy` with + `MAVEN_GPG_PASSPHRASE` set (and the key imported, for 14a). `waitUntil` + defaults to `validated`, so the build returns once the Portal accepts the + bundle. +17. In the Portal, inspect the VALIDATED deployment and press Publish. Central + releases are immutable: a bad `0.1.0` can only be followed by `0.1.1`. +18. Bump to `0.2.0-SNAPSHOT`, commit, and confirm the step 11 deploy (no + `-Prelease`) still lands snapshots. + +## Phase 6: CI (optional for the fork, required upstream) + +19. Done: `publish-snapshot.yml`, run by hand (`workflow_dispatch`) on the + selected branch. It refuses a non-SNAPSHOT version and missing secrets, + then runs `./mvnw -B -ntp -s .mvn/settings.xml deploy`, which tests before + it uploads. The token comes from the `MAVEN_CENTRAL_USERNAME` and + `MAVEN_CENTRAL_PASSWORD` repository secrets. A push trigger after the `ci` + workflow passes can come later; manual is enough while releases are + deferred. +20. `release.yml`: `workflow_dispatch` with a version input, guard the branch + and the tag as pgjdbc does, run step 16 with the key from secrets, then + tag and create the GitHub release only after the upload succeeded. Leave + `autoPublish` off so the Portal's Publish button remains the gate; flip it + once the workflow has run clean several times, if the manual dispatch is + judged gate enough. `actions/attest` can be added for provenance at no + cost, but nothing in the Maven ecosystem consumes it. + +## Phase 7: merge back + +21. Done: the step 6c commit was dropped rather than reverted, so the branch + carries steps 7 through 10 and 19 plus the doclint fixes, under + `org.postgresql`. +22. Upstream needs its own `central` token with rights on `org.postgresql` and + its own signing key (14b). Everything else carries over unchanged. +23. Tick N7.1 in `overall.md`. Wire the revapi/japicmp gate next, as N7.1 says: + the first published artifact is what makes it possible. diff --git a/pom.xml b/pom.xml index c8acabeb..d8cd2a28 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,12 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + child.project.url.inherit.append.path="false"> 4.0.0 + org.postgresql postgresql-client-parent 0.1.0-SNAPSHOT @@ -12,6 +15,8 @@ postgresql-client (parent) A modern, PostgreSQL-specific database driver for the JVM. + https://github.com/pgjdbc/pg-java + The PostgreSQL License @@ -20,6 +25,23 @@ + + + + sehrope + Sehrope Sarkuni + + + + + scm:git:https://github.com/pgjdbc/pg-java.git + scm:git:git@github.com:pgjdbc/pg-java.git + https://github.com/pgjdbc/pg-java + HEAD + + postgresql-client-protocol postgresql-client @@ -56,6 +78,11 @@ 0.10.0 3.5.0 + + 0.9.0 + 3.3.1 + 3.11.2 + 3.2.7 - org.postgresql + ${project.groupId} postgresql-client-protocol ${project.version} - org.postgresql + ${project.groupId} postgresql-client ${project.version} - org.postgresql + ${project.groupId} postgresql-client-jdbc ${project.version} - org.postgresql + ${project.groupId} postgresql-client-pgjdbc-compat ${project.version} @@ -367,6 +394,27 @@ + + + org.sonatype.central + central-publishing-maven-plugin + ${central-publishing-maven-plugin.version} + true + + central + false + + + postgresql-client-bench + postgresql-client-bench-jmh + postgresql-client-coverage + postgresql-client-native-smoke + + + @@ -439,5 +487,64 @@ + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + + all,-missing + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + true + + + + sign-artifacts + verify + + sign + + + + + + + diff --git a/postgresql-client-bench-jmh/pom.xml b/postgresql-client-bench-jmh/pom.xml index d2bbe1e3..a556a171 100644 --- a/postgresql-client-bench-jmh/pom.xml +++ b/postgresql-client-bench-jmh/pom.xml @@ -25,17 +25,21 @@ true + + true + true + true 1.37 - org.postgresql + ${project.groupId} postgresql-client - org.postgresql + ${project.groupId} postgresql-client-protocol diff --git a/postgresql-client-bench/pom.xml b/postgresql-client-bench/pom.xml index 4c5e6a0a..bf372a5d 100644 --- a/postgresql-client-bench/pom.xml +++ b/postgresql-client-bench/pom.xml @@ -23,6 +23,10 @@ true + + true + true + true diff --git a/postgresql-client-coverage/pom.xml b/postgresql-client-coverage/pom.xml index 0b588c6d..c2fd7702 100644 --- a/postgresql-client-coverage/pom.xml +++ b/postgresql-client-coverage/pom.xml @@ -16,24 +16,33 @@ postgresql-client coverage Aggregates per-module JaCoCo coverage into one combined report. Not published. + + + true + + true + true + true + + - org.postgresql + ${project.groupId} postgresql-client-protocol - org.postgresql + ${project.groupId} postgresql-client - org.postgresql + ${project.groupId} postgresql-client-jdbc - org.postgresql + ${project.groupId} postgresql-client-pgjdbc-compat diff --git a/postgresql-client-jdbc/pom.xml b/postgresql-client-jdbc/pom.xml index c0a1f3e8..d7dd8dc3 100644 --- a/postgresql-client-jdbc/pom.xml +++ b/postgresql-client-jdbc/pom.xml @@ -17,7 +17,7 @@ - org.postgresql + ${project.groupId} postgresql-client diff --git a/postgresql-client-jdbc/src/main/java/org/postgresql/client/jdbc/SqlLiteral.java b/postgresql-client-jdbc/src/main/java/org/postgresql/client/jdbc/SqlLiteral.java index 2163f22c..84c37f99 100644 --- a/postgresql-client-jdbc/src/main/java/org/postgresql/client/jdbc/SqlLiteral.java +++ b/postgresql-client-jdbc/src/main/java/org/postgresql/client/jdbc/SqlLiteral.java @@ -2,7 +2,7 @@ /** * A bound parameter value that knows its own SQL-literal rendering, used by - * {@link java.sql.PreparedStatement#toString()}'s interpolated form. The pgjdbc compat layer's + * {@code PreparedStatement.toString()}'s interpolated form. The pgjdbc compat layer's * {@code PGobject} implements this so vendor values render the way pgjdbc renders them (a quoted, * type-cast literal); values with no special rendering use the driver's defaults. */ diff --git a/postgresql-client-jdbc/src/main/java/org/postgresql/client/jdbc/batch/BatchRewriteSetting.java b/postgresql-client-jdbc/src/main/java/org/postgresql/client/jdbc/batch/BatchRewriteSetting.java index dc0a4281..b62b1384 100644 --- a/postgresql-client-jdbc/src/main/java/org/postgresql/client/jdbc/batch/BatchRewriteSetting.java +++ b/postgresql-client-jdbc/src/main/java/org/postgresql/client/jdbc/batch/BatchRewriteSetting.java @@ -4,7 +4,7 @@ /** * The parsed value of the {@code rewriteBatchUsingArrays} connection property, which selects a - * {@link BatchArrayRewriter} (ADR-0014). This classifies the property text; resolving a {@link #LATEST} + * {@link BatchArrayRewriter} (ADR-0014). This classifies the property text; resolving a {@link Mode#LATEST} * or {@link Mode#PINNED} setting to a concrete rewriter happens later against the rewriter registry. * *
    @@ -49,7 +49,7 @@ public boolean enabled() { /** * Parses a {@code rewriteBatchUsingArrays} property value. A null, blank, or off-like value is - * {@link #DISABLED}; an on-like value is {@link #LATEST}; anything else is a {@link Mode#PINNED} + * {@link #DISABLED}; an on-like value is {@link Mode#LATEST}; anything else is a {@link Mode#PINNED} * selector (the original, untrimmed-of-case token, whitespace-trimmed). */ public static BatchRewriteSetting fromProperty(String value) { diff --git a/postgresql-client-native-smoke/pom.xml b/postgresql-client-native-smoke/pom.xml index c3a29aa7..c87a8d9f 100644 --- a/postgresql-client-native-smoke/pom.xml +++ b/postgresql-client-native-smoke/pom.xml @@ -20,17 +20,21 @@ true + + true + true + true - org.postgresql + ${project.groupId} postgresql-client-jdbc - org.postgresql + ${project.groupId} postgresql-client-pgjdbc-compat diff --git a/postgresql-client-pgjdbc-compat/pom.xml b/postgresql-client-pgjdbc-compat/pom.xml index f201e963..1ea3e689 100644 --- a/postgresql-client-pgjdbc-compat/pom.xml +++ b/postgresql-client-pgjdbc-compat/pom.xml @@ -20,7 +20,7 @@ - org.postgresql + ${project.groupId} postgresql-client-jdbc diff --git a/postgresql-client-protocol/src/main/java/org/postgresql/client/protocol/ProtocolConstants.java b/postgresql-client-protocol/src/main/java/org/postgresql/client/protocol/ProtocolConstants.java index 75ca2a26..a47ffbd9 100644 --- a/postgresql-client-protocol/src/main/java/org/postgresql/client/protocol/ProtocolConstants.java +++ b/postgresql-client-protocol/src/main/java/org/postgresql/client/protocol/ProtocolConstants.java @@ -38,13 +38,13 @@ public static int protocolMinor(int versionCode) { // -- Special request codes (sent in place of a protocol version). -- - /** CancelRequest code (80877102 = (1234 << 16) | 5678). */ + /** CancelRequest code ({@code 80877102 = (1234 << 16) | 5678}). */ public static final int CANCEL_REQUEST_CODE = (1234 << 16) | 5678; - /** SSLRequest code (80877103 = (1234 << 16) | 5679). */ + /** SSLRequest code ({@code 80877103 = (1234 << 16) | 5679}). */ public static final int SSL_REQUEST_CODE = (1234 << 16) | 5679; - /** GSSENCRequest code (80877104 = (1234 << 16) | 5680). */ + /** GSSENCRequest code ({@code 80877104 = (1234 << 16) | 5680}). */ public static final int GSSENC_REQUEST_CODE = (1234 << 16) | 5680; // -- Field/parameter format codes (int16 on the wire). -- diff --git a/postgresql-client/pom.xml b/postgresql-client/pom.xml index 49ed6785..a7285aac 100644 --- a/postgresql-client/pom.xml +++ b/postgresql-client/pom.xml @@ -17,7 +17,7 @@ - org.postgresql + ${project.groupId} postgresql-client-protocol diff --git a/postgresql-client/src/main/java/org/postgresql/client/core/PgComposite.java b/postgresql-client/src/main/java/org/postgresql/client/core/PgComposite.java index e0402382..0c164be9 100644 --- a/postgresql-client/src/main/java/org/postgresql/client/core/PgComposite.java +++ b/postgresql-client/src/main/java/org/postgresql/client/core/PgComposite.java @@ -10,7 +10,7 @@ * this shape (the type name comes from the catalog), and a bound parameter of this shape resolves * the composite's OID and per-field codecs by name to serialize the record text form * {@code (f0,f1,...)} -- so a decoded value can be re-bound unchanged. The JDBC layer maps it to - * and from {@link java.sql.Struct}. + * and from {@code java.sql.Struct}. * *

    Attributes may contain {@code null} (a SQL NULL field), so they are held in a null-tolerant * unmodifiable list rather than {@code List.copyOf}. diff --git a/scripts/snapshot-summary.sh b/scripts/snapshot-summary.sh new file mode 100755 index 00000000..8b904a05 --- /dev/null +++ b/scripts/snapshot-summary.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash +# +# Writes a Markdown summary of a published snapshot to stdout, for the publish-snapshot +# workflow's $GITHUB_STEP_SUMMARY. +# +# Usage: scripts/snapshot-summary.sh GROUP_ID VERSION +# +# The published artifacts are the parent plus every of the root pom.xml, minus the +# entries of its excludeArtifacts block (module directory names are the +# artifactIds in this build). Each one's timestamped build is read back from the snapshot +# repository's maven-metadata.xml; "-" means it could not be read. + +set -euo pipefail + +REPO_URL="https://central.sonatype.com/repository/maven-snapshots" + +main() { + if [ $# -ne 2 ]; then + echo "usage: $0 GROUP_ID VERSION" >&2 + exit 2 + fi + local group="$1" version="$2" + cd "$(dirname "$0")/.." + + local parent + parent=$(sed -n 's|^ \(.*\)$|\1|p' pom.xml | head -n 1) + local excluded + excluded=$(sed -n 's|^ *\(.*\)$|\1|p' pom.xml) + local artifacts=("$parent") + local module + for module in $(sed -n 's|^ *\(.*\)$|\1|p' pom.xml); do + if ! grep -qx "$module" <<<"$excluded"; then + artifacts+=("$module") + fi + done + + local group_path="${group//./\/}" + local commit="${GITHUB_SHA:-$(git rev-parse HEAD)}" + local ref="${GITHUB_REF_NAME:-$(git rev-parse --abbrev-ref HEAD)}" + + echo "## Published snapshot" + echo + echo "| | |" + echo "| --- | --- |" + echo "| Version | \`$version\` |" + echo "| Branch | \`$ref\` |" + echo "| Commit | \`${commit:0:12}\` |" + echo "| Repository | $REPO_URL |" + echo + echo "| Artifact | Coordinates | Build |" + echo "| --- | --- | --- |" + local artifact build + for artifact in "${artifacts[@]}"; do + build=$(snapshot_build "$group_path" "$artifact" "$version") + echo "| \`$artifact\` | \`$group:$artifact:$version\` | ${build:+\`}${build:--}${build:+\`} |" + done + echo + echo "### Using it" + echo + echo "Snapshots are not on Maven Central itself; add the snapshot repository:" + echo + echo '```xml' + echo "" + echo " " + echo " central-portal-snapshots" + echo " $REPO_URL/" + echo " false" + echo " true" + echo " " + echo "" + echo + echo "" + echo " $group" + echo " postgresql-client-jdbc" + echo " $version" + echo "" + echo '```' +} + +# The timestamped build (e.g. 0.1.0-20261129.191502-3) the version currently resolves to. +snapshot_build() { + local group_path="$1" artifact="$2" version="$3" + local metadata + metadata=$(curl -fsS --max-time 20 "$REPO_URL/$group_path/$artifact/$version/maven-metadata.xml" 2>/dev/null) || return 0 + local timestamp number + timestamp=$(sed -n 's|.*\(.*\).*|\1|p' <<<"$metadata" | head -n 1) + number=$(sed -n 's|.*\(.*\).*|\1|p' <<<"$metadata" | head -n 1) + if [ -n "$timestamp" ] && [ -n "$number" ]; then + echo "${version%-SNAPSHOT}-$timestamp-$number" + fi +} + +main "$@"