From 6e3de505f88041d83842e0e6d3d0c79dd60cf55c Mon Sep 17 00:00:00 2001 From: Shawn Chen Date: Wed, 18 Nov 2026 18:44:38 +1300 Subject: [PATCH] Prepare standalone artifacts for Maven Central release --- .github/workflows/build.yml | 7 ++- .github/workflows/release.yml | 18 +++--- .gitignore | 2 + CHDB_JAVA_V1_WORK_PLAN.md | 2 +- README.md | 25 ++++----- chdb-arrow/pom.xml | 3 + chdb-jdbc/pom.xml | 3 + chdb-native-linux-aarch64-gnu/pom.xml | 1 + chdb-native-linux-x86_64-gnu/pom.xml | 1 + chdb-native-macos-aarch64/pom.xml | 1 + chdb-native-macos-x86_64/pom.xml | 1 + docs/publishing.md | 31 ++++++++--- docs/release-readiness.md | 58 +++++++++++++++---- pom.xml | 53 +++++++++++++----- scripts/check-consumer-poms.py | 80 +++++++++++++++++++++++++++ scripts/test_consumer_poms.py | 62 +++++++++++++++++++++ scripts/verify-consumer.sh | 42 +++++++------- 17 files changed, 312 insertions(+), 78 deletions(-) create mode 100644 scripts/check-consumer-poms.py create mode 100644 scripts/test_consumer_poms.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 672aff4..627ab2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,6 +33,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Test consumer POM release checks + run: python3 -m unittest discover -s scripts -p 'test_consumer_poms.py' + - uses: actions/setup-java@v4 with: distribution: temurin @@ -279,8 +282,8 @@ jobs: - name: Consume the driver as a repository artifact # Issue #10: nothing had ever depended on this as a published artifact, and a reactor - # build cannot find the things a consumer hits -- the POMs come from target/, the BOM is - # never imported, and the native libraries are read from a directory rather than + # build cannot find the things a consumer hits -- reactor POMs can hide broken + # published dependencies, and native libraries are read from a directory rather than # unpacked from a JAR in a local repository. # # The script deploys to a throwaway file:// repository and resolves from it in a project diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 743faa3..7634727 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -482,15 +482,17 @@ jobs: # chdb-integration-tests are not published, and the integration suite has already run # on each platform's own runner, where it could actually exercise that platform. # - # `verify`, not `package`, for the dry run: signing is bound to verify, so `package` - # would silently produce no .asc files and prove nothing. + # Exercise the deploy lifecycle even in a dry run. Plugin 0.12.0 skipUpload + # suppresses both release uploads and deferred snapshot uploads. run: | set -euo pipefail - GOAL=deploy - if [ "$DRY_RUN" = "true" ]; then GOAL=verify; fi - echo "mvn -Prelease $GOAL for $VERSION ($CHANNEL)" - mvn $MAVEN_ARGS -Prelease "$GOAL" \ - -pl .,chdb-bom,chdb-jdbc,chdb-arrow,chdb-native-macos-aarch64,chdb-native-macos-x86_64,chdb-native-linux-x86_64-gnu,chdb-native-linux-aarch64-gnu + MODULES=chdb-jdbc,chdb-arrow,chdb-native-macos-aarch64,chdb-native-macos-x86_64,chdb-native-linux-x86_64-gnu,chdb-native-linux-aarch64-gnu + # Validate flattened POMs before anything can be uploaded. The deploy invocation + # regenerates them from the same checkout using the same release profile. + mvn $MAVEN_ARGS -Prelease process-resources -pl "$MODULES" -am + python3 scripts/check-consumer-poms.py --version "$VERSION" + mvn $MAVEN_ARGS -Prelease deploy -DskipUpload="$DRY_RUN" \ + -pl ".,$MODULES" - name: What was produced if: always() @@ -534,7 +536,9 @@ jobs: path: | **/target/*.asc **/target/*.pom + **/.flattened-pom.xml **/target/native/META-INF/chdb/native/*/*/manifest.properties **/target/native/META-INF/chdb/native/*/*/sha256sums.txt if-no-files-found: warn + include-hidden-files: true retention-days: 90 diff --git a/.gitignore b/.gitignore index 09fc27e..2fe9369 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ target/ build/ *.class +.flattened-pom.xml +__pycache__/ # Native artefacts: 350 MB of engine and a built shim. Produced by # scripts/build-native.sh into /target/native, never committed. diff --git a/CHDB_JAVA_V1_WORK_PLAN.md b/CHDB_JAVA_V1_WORK_PLAN.md index 9e5b500..664a1d8 100644 --- a/CHDB_JAVA_V1_WORK_PLAN.md +++ b/CHDB_JAVA_V1_WORK_PLAN.md @@ -518,7 +518,7 @@ Exit condition: a Java user who knows nothing about the implementation can insta - [ ] Publish a Maven snapshot. - [ ] Have at least two external Java projects try the snapshot. -- [ ] Verify the POM transitive dependencies and the BOM. +- [ ] Verify standalone consumer POMs and transitive dependencies without an internal parent or BOM (Central plan A). - [ ] Verify sources, javadoc, signatures, licences and the SBOM. - [ ] Verify that a Maven Central download checksums identically to the CI artifact. - [ ] Verify the real download and first load on all four platforms. diff --git a/README.md b/README.md index b555c97..038a003 100644 --- a/README.md +++ b/README.md @@ -77,35 +77,32 @@ Building for several platforms — a CI matrix, or a distribution your users ins architecture — declare the driver plus each native package you need: ```xml - - - - com.clickhouse.chdb - chdb-bom - 1.1.0-rc.1 - pom - import - - - + + 1.1.0-rc.1 + - com.clickhouse.chdb + com.clickhouse.chdb chdb-jdbc + ${chdb.version} com.clickhouse.chdb chdb-native-linux-x86_64-gnu + ${chdb.version} com.clickhouse.chdb chdb-native-macos-aarch64 + ${chdb.version} ``` -The BOM keeps the driver and every native package on one version, which they must be. +Use the same `chdb.version` for the driver, optional Arrow module and all native packages. +The Central publishing configuration selects six library modules with standalone consumer POMs; the internal +parent and BOM are not published. Existing RC coordinates remain available from the RC repository. **A native package is large**, because it contains the whole engine: about 110 MiB for macOS arm64, 127 MiB for macOS x86_64, 157 MiB for Linux aarch64 and 176 MiB for Linux x86_64 @@ -317,7 +314,7 @@ The resulting package is stamped `engine.source=local` and must not be published chdb-jdbc/ pure-Java driver, loader and type mapping chdb-jni/ the JNI shim (C++17, ~1400 lines) chdb-native-/ one Maven package per platform -chdb-bom/ keeps them all on one version +chdb-bom/ legacy RC BOM (not published to Central) chdb-integration-tests/ tests that need a real engine chdb-examples/ runnable examples scripts/engine.properties the pinned engine version and its checksums diff --git a/chdb-arrow/pom.xml b/chdb-arrow/pom.xml index e57d104..355c7a2 100644 --- a/chdb-arrow/pom.xml +++ b/chdb-arrow/pom.xml @@ -9,6 +9,9 @@ 1.1.0-SNAPSHOT chdb-arrow + + false + chDB Arrow Optional Apache Arrow Java integration for chDB. diff --git a/chdb-jdbc/pom.xml b/chdb-jdbc/pom.xml index ed495ca..9950e5a 100644 --- a/chdb-jdbc/pom.xml +++ b/chdb-jdbc/pom.xml @@ -11,6 +11,9 @@ chdb-jdbc + + false + jar chDB JDBC Driver diff --git a/chdb-native-linux-aarch64-gnu/pom.xml b/chdb-native-linux-aarch64-gnu/pom.xml index db3a655..959d3c4 100644 --- a/chdb-native-linux-aarch64-gnu/pom.xml +++ b/chdb-native-linux-aarch64-gnu/pom.xml @@ -20,6 +20,7 @@ + false linux-aarch64-gnu linux aarch64 diff --git a/chdb-native-linux-x86_64-gnu/pom.xml b/chdb-native-linux-x86_64-gnu/pom.xml index 8be1ffc..7e1b389 100644 --- a/chdb-native-linux-x86_64-gnu/pom.xml +++ b/chdb-native-linux-x86_64-gnu/pom.xml @@ -20,6 +20,7 @@ + false linux-x86_64-gnu linux x86_64 diff --git a/chdb-native-macos-aarch64/pom.xml b/chdb-native-macos-aarch64/pom.xml index 18931f3..270e2b4 100644 --- a/chdb-native-macos-aarch64/pom.xml +++ b/chdb-native-macos-aarch64/pom.xml @@ -20,6 +20,7 @@ + false macos-aarch64 macos aarch64 diff --git a/chdb-native-macos-x86_64/pom.xml b/chdb-native-macos-x86_64/pom.xml index 1a2bbd3..99444c6 100644 --- a/chdb-native-macos-x86_64/pom.xml +++ b/chdb-native-macos-x86_64/pom.xml @@ -20,6 +20,7 @@ + false macos-x86_64 macos x86_64 diff --git a/docs/publishing.md b/docs/publishing.md index 5ab0cfe..7904972 100644 --- a/docs/publishing.md +++ b/docs/publishing.md @@ -1,13 +1,28 @@ # Publishing runbook -Everything needed to publish `com.clickhouse.chdb` artifacts. The first test version is -`1.0.0-rc.1`, published to GitHub Packages; stable releases go to Maven Central once the -ClickHouse Publisher Pro setup is ready. +Everything needed to publish `com.clickhouse.chdb` artifacts. The current RC is +`1.1.0-rc.1` on `maven.chdb.io`; the first stable release targets Maven Central after the +credentials, configuration and release-readiness gates are complete. --- ## Status +**Central preparation update (2026-11-18):** the Central configuration now selects only JDBC, +Arrow and the four native platform modules. `flatten-maven-plugin` generates standalone +consumer POMs during ordinary builds as well as releases, so neither the internal parent nor +BOM is published to Central. The RC workflow below retains its historical parent/BOM layout. +`scripts/check-consumer-poms.py` rejects unflattened or incomplete consumer metadata before +Central upload. `checksums=required` avoids optional SHA-256/SHA-512 sidecars; GPG signatures +remain required. The native libraries' embedded SHA-256 verification is unchanged. + +The Central plugin is pinned to `0.12.0`. A workflow dry run executes `deploy` with +`-DskipUpload=true`, exercising staging without sending releases or snapshots to Central. +It does not validate the account token or replace Sonatype's server-side validation. CI +still stores native staging files and release metadata as GitHub Actions artifacts. +Actual uploads keep `autoPublish=false`; release bundles wait for manual Portal approval. +See `docs/release-readiness.md` for the current blockers and release-owner decisions. + | | | |---|---| | POM metadata Central requires | **done** — ``, ``, ``, ``, `` | @@ -15,9 +30,9 @@ ClickHouse Publisher Pro setup is ready. | GPG signing | **done and verified** — signs jar, sources, javadoc and pom | | Publishing plugin | **done** — `central-publishing-maven-plugin`, `autoPublish=false` | | Third-party licence inventory | **done** — generated from the engine, shipped in the package, drift-tested | -| `com.clickhouse.chdb` namespace | **pending** — stable releases use the ClickHouse Central workspace | +| `com.clickhouse.chdb` namespace | **confirmed in preceding Portal review** — Central upload not yet exercised | | A way to stage all four platforms for one release | **done** — `.github/workflows/release.yml`, issue #15 | -| GitHub Packages RC publishing | **implemented** — `.github/workflows/rc-release.yml` | +| Public Maven RC repository | **implemented** — `.github/workflows/rc-release.yml` stages for `maven.chdb.io` | | Proof that the artifacts work when consumed from a repository | **done, locally** — `scripts/verify-consumer.sh`, issue #10 | | GPG key for the project | **not started** — needs a decision about whose key | | Position on the LGPL components | **not started** — needs chdb-io | @@ -113,8 +128,8 @@ and the publishing plugin talks to Sonatype. What it adds: - `maven-gpg-plugin` at `verify`, with `--pinentry-mode loopback` so the passphrase can come from a CI secret rather than a terminal. -- `central-publishing-maven-plugin` with `autoPublish=false`. A release here spans seven - modules plus their parent POM and hundreds of megabytes; it cannot be unpublished. A human +- `central-publishing-maven-plugin` with `autoPublish=false`. A release here spans six + library modules and hundreds of megabytes; it cannot be unpublished. A human confirming the bundle in the portal is worth the extra step, at least until several releases have gone out uneventfully. - Sources and javadoc jars. `chdb-jdbc` and `chdb-arrow` produce real ones. The four native packages produce @@ -376,7 +391,7 @@ Each step can invalidate the next, so: ``` That deploys to a throwaway `file://` repository and resolves from it in a project outside - this checkout, with its own empty local repository — so the POMs, the BOM import, the + this checkout, with its own empty local repository — so the standalone POMs (no parent/BOM), the transitive `chdb-jdbc` dependency, the unpack-from-JAR path and both "wrong platform package" error messages are all exercised against a repository rather than a reactor. What it cannot exercise is a network transfer: a `file://` deploy is a copy. **So the only thing diff --git a/docs/release-readiness.md b/docs/release-readiness.md index 41724c8..eac7bc6 100644 --- a/docs/release-readiness.md +++ b/docs/release-readiness.md @@ -16,6 +16,42 @@ restating. --- +## Central preparation checkpoint — 2026-11-18 + +The Central path uses plan A: six JAR modules (JDBC, Arrow and four native platforms), +standalone flattened consumer POMs, and no published parent or BOM. The legacy RC publishing +workflow retains its original parent/BOM coordinates for compatibility. Use one `chdb.version` +property in consumer projects instead of importing a BOM. + +Verified against `chdb-io/chdb-java` on this date: `maven-central` environment is absent, +repository-level secrets are absent, and the current maintainer has write but not admin access. +Inherited organization secrets were not verified. Namespace publishing access was confirmed +in the preceding Portal review; a successful Central upload has not yet been demonstrated. + +The release owner still needs to identify the project signing key, arrange the environment's +four secrets and reviewers with an administrator, and supply evidence for the licence, +external-consumer and concurrent-soak gates below. Never place credentials in this file. +The work plan also requires at least one week of RC soak and external validation. The +`v1.1.0-rc.1` publication on 2026-11-17 does not complete that window before 2026-11-24. +Any change to that gate must be an explicit release-owner decision, not an assumption in CI. + +Keep POMs at `1.1.0-SNAPSHOT` for the dry run and real snapshot validation. Only then prepare +the `1.1.0` release commit, its successful four-platform `build`, and its matching tag. +Each remote mutation requires separate user confirmation under the machine's standing rules. + +Local preparation checks passed on macOS ARM64 with engine `26.11.1`: + +- Seven regression tests for the consumer POM validator and all six generated release POMs. +- Java 11: 178 JDBC unit tests and all 30 Arrow tests, including 29 native integration tests. +- A fresh `file://` consumer repository: no parent/BOM, transitive JDBC, native extraction + checksum verification, correct query results, loader error paths and Arrow reading. +- Three-module signed snapshot dry run (JDBC, Arrow, macOS ARM64): twelve GPG signatures + verified with an isolated disposable test key. `skipUpload=true` stopped snapshot deployment; + publishing endpoints were also overridden to an unreachable localhost port for this test. + +These checks are not a four-platform CI dry run, a production-key check, a network upload, +two independent external-project reports, legal approval, or a long-running concurrent soak. + ## Running order The release owner selected `v1.1.0` as the first stable Java version on 2026-11-17, @@ -65,8 +101,9 @@ not whether to carry on. | `CENTRAL_TOKEN_PASSWORD` | portal token password | **Done when:** `release.yml` run with `channel=snapshot` and `dry_run=true` produces a `.asc` -for every artifact. That exercises staging on all four platforms, signing and packaging, and -uploads nothing. +for every library artifact. It exercises all four platforms, standalone POM validation, signing +and the deploy lifecycle using Central plugin `0.12.0` with `skipUpload=true`. No artifacts +are sent to Central; ordinary GitHub Actions staging and metadata artifacts are still uploaded. ### 4. Enable SNAPSHOTs for the namespace and publish a snapshot @@ -256,9 +293,9 @@ scripts/verify-consumer.sh ``` It deploys to a throwaway `file://` repository, builds a consumer project outside this checkout -with its own empty local repository, imports the BOM, declares exactly one platform package with -no version, and runs a query. It asserts that the POMs resolve from a repository, that the BOM -supplies the versions, that `chdb-jdbc` arrives transitively, that the libraries are unpacked +with its own empty local repository, declares exactly one platform package with an explicit +version property, and runs a query. It asserts that standalone POMs resolve without a parent +or BOM, that `chdb-jdbc` arrives transitively, that the libraries are unpacked from the JAR rather than read from `target/`, that their checksums match what `scripts/build-native.sh` staged, and that the "no platform package" and "wrong platform package" errors each name the coordinate the machine actually needs. `build` runs it on all @@ -266,8 +303,8 @@ four platforms, so the answer cannot go stale between releases. **What the gate found on its first run**, which is the part issue #10 asks for: -- The BOM import and the transitive `chdb-jdbc` dependency were already right, and are now - asserted rather than assumed. +- Originally this checked a BOM import. Plan A now checks resolution without any parent or + BOM and preserves the transitive `chdb-jdbc` assertion. - **A snapshot deploy does not write the filenames a reactor build uses.** It writes `chdb-jdbc---1.jar` plus a `maven-metadata.xml` that maps `-SNAPSHOT` onto that timestamp; without the metadata a consumer gets a 404 for a version that is demonstrably @@ -444,8 +481,9 @@ them found real defects when first run. profile, the signing, the licence inventory, the four-platform assembly, and a local proof that the artifacts work when consumed from a repository rather than from the reactor. -What is left is a DNS record on `chdb.org`, a decision about whose key signs, a licence answer -from whoever owns the engine, two projects willing to depend on a snapshot, and a concurrent -soak. The **Running order** at the top of this file is the sequence, because each of those can +What remains is the configured Central publishing environment and production signing key, +a licence answer from whoever owns the engine, two projects willing to depend on a snapshot, +and concurrent soak plus the RC validation window. Namespace access was confirmed in the +preceding Portal review. The **Running order** at the top of this file is the sequence, because each gate can invalidate the next; §3.1 is the part of Track 3 that blocks, and §3.2 is the part that does not. diff --git a/pom.xml b/pom.xml index 323eaa6..7af2782 100644 --- a/pom.xml +++ b/pom.xml @@ -76,6 +76,8 @@ 5.10.2 3.2.5 3.2.5 + + true @@ -103,6 +105,35 @@ + + + org.codehaus.mojo + flatten-maven-plugin + 1.7.3 + + ossrh + inherited + + + remove + remove + remove + + + + + flatten-consumer-pom + process-resources + flatten + + + clean-consumer-pom + clean + clean + + + + @@ -165,7 +196,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.11.0 + 0.12.0 @@ -199,6 +230,7 @@ sign + ${maven.deploy.skip} false - + VALIDATED diff --git a/scripts/check-consumer-poms.py b/scripts/check-consumer-poms.py new file mode 100644 index 0000000..71f7ac1 --- /dev/null +++ b/scripts/check-consumer-poms.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +"""Reject non-standalone consumer POMs before any Central upload.""" + +import argparse +from pathlib import Path +import sys +import xml.etree.ElementTree as ET + +NS = {"m": "http://maven.apache.org/POM/4.0.0"} +MODULES = ( + "chdb-jdbc", "chdb-arrow", "chdb-native-macos-aarch64", + "chdb-native-macos-x86_64", "chdb-native-linux-x86_64-gnu", + "chdb-native-linux-aarch64-gnu", +) + + +def check(path, module, version): + text = path.read_text(encoding="utf-8") + pom = ET.fromstring(text) + errors = [] + for name, expected in (("groupId", "com.clickhouse.chdb"), + ("artifactId", module), ("version", version)): + if pom.findtext(f"m:{name}", namespaces=NS) != expected: + errors.append(f"wrong {name}, expected {expected}") + for name in ("parent", "build", "repositories", "pluginRepositories"): + if pom.find(f"m:{name}", NS) is not None: + errors.append(f"consumer POM must not contain {name}") + if "${" in text: + errors.append("unresolved Maven property") + for name in ("name", "description", "url", "licenses/license/name", + "licenses/license/url", "scm/url", "developers/developer/name"): + query = "/".join(f"m:{part}" for part in name.split("/")) + if not (pom.findtext(query, namespaces=NS) or "").strip(): + errors.append(f"missing Central metadata: {name}") + dependencies = pom.findall("m:dependencies/m:dependency", NS) + jdbc = [] + for dep in dependencies: + group = dep.findtext("m:groupId", namespaces=NS) + artifact = dep.findtext("m:artifactId", namespaces=NS) + dep_version = dep.findtext("m:version", namespaces=NS) + if group == "com.clickhouse.chdb": + if artifact not in MODULES or dep_version != version: + errors.append(f"invalid chDB dependency: {artifact}:{dep_version}") + if artifact == "chdb-jdbc": + jdbc.append(dep) + if dep.findtext("m:scope", namespaces=NS) == "test": + errors.append("test dependency leaked into consumer POM") + if module != "chdb-jdbc": + if len(jdbc) != 1: + errors.append("expected exactly one transitive JDBC dependency") + elif (jdbc[0].findtext("m:scope", default="compile", namespaces=NS) + not in ("compile", "runtime") + or jdbc[0].findtext("m:optional", default="false", namespaces=NS) != "false"): + errors.append("JDBC dependency must be non-optional and available at runtime") + return errors + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--version", required=True) + parser.add_argument("--root", type=Path, default=Path(__file__).resolve().parent.parent) + parser.add_argument("--modules", nargs="+", choices=MODULES, default=MODULES) + args = parser.parse_args() + failed = False + for module in args.modules: + path = args.root / module / ".flattened-pom.xml" + try: + errors = check(path, module, args.version) + except (OSError, ET.ParseError) as exc: + errors = [str(exc)] + for error in errors: + print(f"{module}: {error}", file=sys.stderr) + failed |= bool(errors) + if not errors: + print(f"{module}: standalone consumer POM verified") + return int(failed) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/test_consumer_poms.py b/scripts/test_consumer_poms.py new file mode 100644 index 0000000..cccad05 --- /dev/null +++ b/scripts/test_consumer_poms.py @@ -0,0 +1,62 @@ +"""Regression tests for the pre-upload consumer POM gate, with no Maven/network needed.""" + +import importlib.util +from pathlib import Path +import tempfile +import unittest + +SPEC = importlib.util.spec_from_file_location( + "consumer_poms", Path(__file__).with_name("check-consumer-poms.py")) +CHECKS = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(CHECKS) + +POM = ''' +4.0.0com.clickhouse.chdb +chdb-arrow1.1.0 +ArrowArrow integrationhttps://chdb.io +Apache-2.0https://example.com/license +https://github.com/chdb-io/chdb-java +chDB +com.clickhouse.chdb +chdb-jdbc1.1.0 +''' + + +class ConsumerPomChecks(unittest.TestCase): + def check(self, text): + with tempfile.TemporaryDirectory() as directory: + pom = Path(directory) / "consumer.pom" + pom.write_text(text, encoding="utf-8") + return CHECKS.check(pom, "chdb-arrow", "1.1.0") + + def test_standalone_pom_is_accepted(self): + self.assertEqual([], self.check(POM)) + + def test_parent_build_and_repository_leaks_are_rejected(self): + for element in ("parent", "build", "repositories", "pluginRepositories"): + with self.subTest(element=element): + self.assertTrue(self.check(POM.replace("", f"<{element}/>"))) + + def test_unresolved_version_is_rejected(self): + self.assertTrue(self.check(POM.replace("1.1.0", "${project.version}"))) + + def test_wrong_release_version_is_rejected(self): + self.assertTrue(self.check(POM.replace("1.1.0", "1.1.1"))) + + def test_internal_coordinate_is_rejected(self): + self.assertTrue(self.check(POM.replace("chdb-jdbc", "chdb-bom"))) + + def test_missing_central_metadata_is_rejected(self): + self.assertTrue(self.check(POM.replace("chDB", ""))) + + def test_missing_or_optional_jdbc_is_rejected(self): + self.assertTrue(self.check(POM.replace("", "").replace( + "", ""))) + for element in ("true", "provided", + "test"): + with self.subTest(element=element): + self.assertTrue(self.check(POM.replace("", element + ""))) + + +if __name__ == "__main__": + unittest.main() diff --git a/scripts/verify-consumer.sh b/scripts/verify-consumer.sh index 81edcfe..700cebe 100755 --- a/scripts/verify-consumer.sh +++ b/scripts/verify-consumer.sh @@ -10,7 +10,7 @@ # anything: # # 1. do the POMs resolve from a repository rather than from target/? -- yes, checked below -# 2. does the BOM do what a BOM should when imported? -- yes, checked below +# 2. can consumers resolve without an internal parent or BOM? -- yes, checked below # 3. does declaring exactly one platform package yield a working # driver, and what is the error when someone declares none or # the wrong one? -- checked below @@ -167,7 +167,7 @@ step "Deploying to a throwaway file:// repository" ( cd "$ROOT" mvn "${MVN_FLAGS[@]}" deploy \ - -pl ".,chdb-bom,chdb-jdbc,chdb-arrow,${MODULE}" \ + -pl ".,chdb-jdbc,chdb-arrow,${MODULE}" \ -DskipTests \ -Dmaven.install.skip=true \ -DaltDeploymentRepository="chdb-verify::file://${REPO}" @@ -176,8 +176,6 @@ step "Deploying to a throwaway file:// repository" # Every artifact a consumer needs has to be in there, POM included -- a jar with no POM # resolves for a direct dependency and then fails to bring in chdb-jdbc. for coord in \ - "com/clickhouse/chdb/chdb-java-parent/${VERSION}" \ - "com/clickhouse/chdb/chdb-bom/${VERSION}" \ "com/clickhouse/chdb/chdb-jdbc/${VERSION}" \ "com/clickhouse/chdb/chdb-arrow/${VERSION}" \ "com/clickhouse/chdb/${MODULE}/${VERSION}"; do @@ -185,7 +183,13 @@ for coord in \ # A JAR with no POM resolves for a direct dependency and then quietly brings in nothing. compgen -G "${REPO}/${coord}/*.pom" > /dev/null || die "no POM published at ${coord}" done -ok "parent, BOM, driver, Arrow and ${MODULE} are in the repository, each with a POM" +for internal in chdb-java-parent chdb-bom; do + [ ! -e "${REPO}/com/clickhouse/chdb/${internal}" ] \ + || die "internal ${internal} must not be published" +done +python3 "${SCRIPT_DIR}/check-consumer-poms.py" --version "$VERSION" \ + --modules chdb-jdbc chdb-arrow "$MODULE" +ok "driver, Arrow and ${MODULE} have standalone POMs; no parent or BOM was published" case "$VERSION" in *-SNAPSHOT) @@ -212,8 +216,7 @@ printf 'native jar: %s MB\n' "$(( $(wc -c < "$NATIVE_JAR") / 1024 / 1024 ))" step "Building a consumer project outside this checkout" -# The shape the README tells a user to write: import the BOM, declare one platform package, -# name no versions. If the BOM does not manage the versions this will not resolve. +# Declare exactly one platform package and a shared version property, with no BOM. cat > "${CONSUMER}/pom.xml" < @@ -232,7 +235,7 @@ cat > "${CONSUMER}/pom.xml" < + fetched from Central or a mirror. --> central https://repo.maven.apache.org/maven2 @@ -249,23 +252,15 @@ cat > "${CONSUMER}/pom.xml" < - - - - com.clickhouse.chdb - chdb-bom - ${VERSION} - pom - import - - - + + ${VERSION} + - com.clickhouse.chdb ${MODULE} + \${chdb.version} @@ -276,6 +271,7 @@ cat > "${CONSUMER}/pom.xml" < com.clickhouse.chdb chdb-arrow + \${chdb.version} @@ -293,7 +289,11 @@ EOF ) > "${WORK}/resolve.log" 2>&1 || { tail -40 "${WORK}/resolve.log"; die "the consumer could not resolve its dependencies; see ${WORK}/resolve.log"; } CP="$(cat "${WORK}/cp.txt")" -ok "resolved with no version declared, so the imported BOM supplied it" +ok "resolved with one platform dependency and no parent or BOM" +for internal in chdb-java-parent chdb-bom; do + [ ! -e "${CONSUMER_M2}/com/clickhouse/chdb/${internal}" ] \ + || die "consumer tried to resolve internal ${internal}" +done case "$CP" in *"/com/clickhouse/chdb/chdb-arrow/"*.jar*) die "the platform-only graph unexpectedly contains chdb-arrow; it cannot prove the native POM brings JDBC" ;;