Skip to content

fix: bundle codeanalyzer-java JAR in published wheels (#284) - #285

Merged
rahlk merged 1 commit into
mainfrom
fix/issue-284
Jul 22, 2026
Merged

fix: bundle codeanalyzer-java JAR in published wheels (#284)#285
rahlk merged 1 commit into
mainfrom
fix/issue-284

Conversation

@rahlk

Copy link
Copy Markdown
Collaborator

Fixes#284.

Problem

Every hatchling-built wheel/sdist since v1.2.0 ships without the bundled
codeanalyzer-java JAR. After a plain pip install cldk, CLDK.java(...) fails at runtime with
CodeanalyzerExecutionException: codeanalyzer jar not found. Verified on PyPI — 1.4.0–1.4.3 and
2.0.0rc1 wheels are all ~176 KB (jarless); the setuptools-era wheels (≤ 1.1.3) were 26–56 MB.

Root cause

  • Root .gitignore has *.jar; the nested cldk/analysis/java/codeanalyzer/jar/.gitignore
    re-includes the JAR with !codeanalyzer-*.jar. git honors that negation (the JAR is tracked
    in every tag); hatchling applies the root *.jar at build time but does not honor the
    nested negation, so it drops the JAR.
  • Hatchling only applies .gitignore exclusion when a .git dir is present — which CI has — so a
    git archive/source-tarball build keeps the JAR while the CI build drops it. That false negative
    hid the bug for 5 releases.
  • release.yml already injects the JAR before uv build; hatchling discarded it anyway.

Fix

  • pyproject.toml: [tool.hatch.build] artifacts = ["cldk/analysis/java/codeanalyzer/jar/*.jar"]
    force-includes the VCS-ignored JAR in both wheel and sdist.
  • release.yml: a "Verify the codeanalyzer JAR is bundled" step fails the release before
    publishing if any built artifact is missing the JAR — so this can never silently regress again.

Verification

Built in the real repo (has .git → CI condition):

uv build
# before: cldk-*-py3-none-any.whl = 176081 B -> NO jar (byte-identical to published 1.4.3)
# after: cldk-*-py3-none-any.whl = 32416976 B -> cldk/analysis/java/codeanalyzer/jar/codeanalyzer-2.4.1.jar

Both wheel and sdist now contain the JAR; the guard grep passes on both.

Follow-up

1.4.3 is already published jarless and cannot be re-uploaded — this needs a 1.4.4 release cut
after merge.

Hatchling applied the root .gitignore `*.jar` rule at build time but did not
honor the nested `!codeanalyzer-*.jar` negation that keeps the JAR tracked in
git, so every wheel/sdist built inside a git repo (CI) silently dropped the JAR.
Published wheels since v1.2.0 were jarless, making `CLDK.java(...)` fail with
"codeanalyzer jar not found" after a plain `pip install cldk`.
Force-include the JAR via `[tool.hatch.build] artifacts`, and add a release
guard that fails before publishing if a built artifact is missing the JAR.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Published wheels since v1.2.0 omit the bundled codeanalyzer-java JAR

1 participant

@rahlk