Skip to content

Commit 873c804

Browse files
authored
fix: bundle codeanalyzer-java JAR in published wheels (#284) (#285)
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.
1 parent b7b56f6 commit 873c804

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,25 @@ jobs:
6565
- name: Build Package
6666
run: uv build
6767

68+
- name: Verify the codeanalyzer JAR is bundled
69+
# Guard against the hatchling/.gitignore regression (issue #284): a jarless wheel
70+
# installs fine but fails at runtime with "codeanalyzer jar not found". Fail the
71+
# release here rather than publish a broken artifact to PyPI.
72+
run: |
73+
set -euo pipefail
74+
jar_re='codeanalyzer/jar/codeanalyzer-[0-9][^/]*\.jar$'
75+
ok=1
76+
for f in dist/*.whl; do
77+
unzip -l "$f" | grep -qE "$jar_re" || { echo "::error::$f is missing the codeanalyzer JAR"; ok=0; }
78+
done
79+
for f in dist/*.tar.gz; do
80+
tar tzf "$f" | grep -qE "$jar_re" || { echo "::error::$f is missing the codeanalyzer JAR"; ok=0; }
81+
done
82+
if [ "$ok" -ne 1 ]; then
83+
echo "Refusing to publish a jarless release."; exit 1
84+
fi
85+
echo "codeanalyzer JAR present in wheel and sdist ✓"
86+
6887
- name: Read Changelog Entry
6988
id: changelog_reader
7089
uses: mindsers/changelog-reader-action@v2

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
- **Published wheels bundle the `codeanalyzer-java` JAR again.** Every hatchling-built wheel/sdist
12+
since v1.2.0 shipped without the JAR, so `pip install cldk` + `CLDK.java(...)` raised
13+
`CodeanalyzerExecutionException: codeanalyzer jar not found`. The root `.gitignore` `*.jar` rule
14+
was applied at build time while the nested `!codeanalyzer-*.jar` negation (which keeps the JAR in
15+
git) was not honored, silently dropping the JAR from any build run inside a git repo — i.e. CI. A
16+
`[tool.hatch.build] artifacts` rule force-includes it, and the release workflow now fails if a
17+
built artifact is missing the JAR. (#284)
18+
1019
## [v1.4.3] - 2026-07-14
1120

1221
### Fixed

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ test = [
7474
requires = ["hatchling"]
7575
build-backend = "hatchling.build"
7676

77+
# The codeanalyzer-java JAR is force-included here: it lives under a `*.jar` .gitignore
78+
# (re-included for git via a nested `!codeanalyzer-*.jar`), but hatchling honors the root
79+
# ignore and not the nested negation, so without this it is silently dropped from every
80+
# wheel/sdist built inside a git repo (i.e. in CI). See issue #284.
81+
[tool.hatch.build]
82+
artifacts = ["cldk/analysis/java/codeanalyzer/jar/*.jar"]
83+
7784
[tool.hatch.build.targets.wheel]
7885
packages = ["cldk"]
7986

0 commit comments

Comments
 (0)