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
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
ref: ${{ inputs.commit || 'main' }}

version-and-tag:
needs: [ get-configs, validate ]
needs: [ get-configs ]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -330,8 +330,10 @@ jobs:
env:
ORG_GRADLE_PROJECT_signingKey: ${{ steps.signing-secrets.outputs.signing_key }}
ORG_GRADLE_PROJECT_signingPassword: ${{ steps.signing-secrets.outputs.signing_password }}
RELEASE_TAG: ${{ inputs.tag }}
run: |
set -euo pipefail
./generate-version-properties.sh "$RELEASE_TAG"
gradle --no-daemon --console=plain centralBundle
ls -lh build/central/

Expand Down
17 changes: 3 additions & 14 deletions src/bindings-jvm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ GENERATED_DIR="$SCRIPT_DIR/generated"
RELEASE_DIR="$WORKSPACE/target/release"
KOTLIN_SRC="$SCRIPT_DIR/src/main/kotlin"

JNA_VERSION="5.19.1"
GSON_VERSION="2.14.0"

ARCH="$(uname -m)"
# Normalize to JNA's resource-prefix arch tokens (its canonical form)
case "$ARCH" in
Expand Down Expand Up @@ -94,17 +91,9 @@ mkdir -p "$NATIVES_DIR"
cp "$RELEASE_DIR/$LIB_NAME" "$NATIVES_DIR/"

# ── Generate version.properties ────────────────────────────────────────────────
# Cargo.toml is the single source of truth for the version; JNA/Gson versions are
# owned here. The Gradle build reads these (build.gradle.kts) for the coordinates and
# POM dependency versions, so nothing is hardcoded and versions cannot drift.
VERSION=$(grep '^version' "$WORKSPACE/Cargo.toml" | head -1 | sed 's/.*"\(.*\)".*/\1/')
echo "Generating version.properties (version ${VERSION})..."
cat > "$SCRIPT_DIR/version.properties" <<EOF
# Generated by build.sh — do not edit manually. Version from Cargo.toml; dep versions from build.sh.
publishVersion=${VERSION}
jnaVersion=${JNA_VERSION}
gsonVersion=${GSON_VERSION}
EOF
"$SCRIPT_DIR/generate-version-properties.sh"
JNA_VERSION=$(grep '^jnaVersion=' "$SCRIPT_DIR/version.properties" | cut -d= -f2)
GSON_VERSION=$(grep '^gsonVersion=' "$SCRIPT_DIR/version.properties" | cut -d= -f2)

# ── Compile + package JAR via Gradle ───────────────────────────────────────────
# Gradle compiles the generated Kotlin (resolving JNA/Gson), bundles the .kt sources,
Expand Down
18 changes: 18 additions & 0 deletions src/bindings-jvm/generate-version-properties.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Usage: generate-version-properties.sh [publish-version] (defaults to the Cargo.toml version)
set -euo pipefail

VERSION_PROPERTIES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

JNA_VERSION="5.19.1"
GSON_VERSION="2.14.0"

VERSION="${1:-$(grep '^version' "$VERSION_PROPERTIES_DIR/../Cargo.toml" | head -1 | sed 's/.*"\(.*\)".*/\1/')}"

echo "Generating version.properties (version ${VERSION})..."
cat > "$VERSION_PROPERTIES_DIR/version.properties" <<EOF
# Generated by generate-version-properties.sh — do not edit manually.
publishVersion=${VERSION}
jnaVersion=${JNA_VERSION}
gsonVersion=${GSON_VERSION}
EOF
Loading