Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,15 @@ jobs:
exit 1
fi
done
echo "Committed jar carries all three platform natives."
if ! unzip -Z1 "$jar" | grep -q '\.class$'; then
echo "::error::committed jar contains no compiled .class output; the JVM build did not compile"
exit 1
fi
if ! unzip -Z1 "$jar" | grep -q '\.kt$'; then
echo "::error::committed jar contains no .kt sources; the source bundling step did not run"
exit 1
fi
echo "Committed jar carries all three platform natives plus compiled classes and sources."

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6.2.0
Expand Down
16 changes: 15 additions & 1 deletion src/bindings-jvm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,28 @@ EOF
echo "Compiling and packaging JAR via Gradle..."
gradle --no-daemon --console=plain jar

# ── Verify the JAR carries compiled classes and sources ──────────────────────
# A jar that bundles the .kt sources but not the compiled .class output (e.g. a
# Gradle source-set regression that drops the compilation output) still packages,
# uploads, and publishes successfully, then fails every consumer at class-load time.
# Assert both are present so that failure surfaces here rather than downstream.
# There are no .java entries by design — the bindings are Kotlin-only.
CLASS_COUNT=$(jar tf "$JAR_FILE" | grep -c '\.class$' || true)
KT_COUNT=$(jar tf "$JAR_FILE" | grep -c '\.kt$' || true)
if [ "$CLASS_COUNT" -eq 0 ] || [ "$KT_COUNT" -eq 0 ]; then
echo "Error: $JAR_FILE is missing compiled output — $CLASS_COUNT .class and $KT_COUNT .kt entries (both must be non-zero)." >&2
exit 1
fi

# ── Summary ───────────────────────────────────────────────────────────────────
KT_SIZE=$(find "$GENERATED_DIR" -name '*.kt' -type f -exec cat {} + | wc -c | awk '{printf "%.1fM", $1/1048576}')
LIB_SIZE=$(du -sh "$RELEASE_DIR/$LIB_NAME" | cut -f1)
JAR_SIZE=$(du -sh "$JAR_FILE" | cut -f1)

echo ""
echo "Build complete: $GENERATED_DIR"
echo " Kotlin sources: $KT_SIZE"
echo " Kotlin sources: $KT_SIZE ($KT_COUNT .kt files bundled)"
echo " Compiled classes: $CLASS_COUNT .class entries bundled"
echo " Native library: $LIB_SIZE ($LIB_NAME, bundled in jar)"
echo " JAR: $JAR_SIZE ($(basename "$JAR_FILE"))"
echo ""
Expand Down
8 changes: 8 additions & 0 deletions src/bindings-jvm/merge-jars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ OUT_JAR="$OUT_DIR/$(basename "$OUT_JAR")"

BASE_JAR="$1"; shift
echo "Base jar (classes + sources + native): $BASE_JAR"

base_classes="$(unzip -Z1 "$BASE_JAR" | grep -c '\.class$' || true)"
base_sources="$(unzip -Z1 "$BASE_JAR" | grep -c '\.kt$' || true)"
if [ "$base_classes" -eq 0 ] || [ "$base_sources" -eq 0 ]; then
echo "Error: base jar $BASE_JAR is missing compiled output — $base_classes .class and $base_sources .kt entries (both must be non-zero)." >&2
exit 1
fi

cp "$BASE_JAR" "$OUT_JAR"

for jar_file in "$@"; do
Expand Down
Loading