Skip to content

Commit

Permalink
Fix github release flow (#78)
Browse files Browse the repository at this point in the history
* Properly set release test command
* Correctly generate WORKSPACE stub in release_prep.sh
* Adjust example WORKSPACE stub to make example WORKSPACE generation
more straightforward.
* Make release_prep.sh executable

Github workflow-based releases working properly in my fork:
https://github.com/ted-xie/rules_android_ndk/releases/tag/v0.1.7
  • Loading branch information
ted-xie authored Jul 22, 2024
1 parent e57cdcc commit 461e8c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.github
examples
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ jobs:
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v6
with:
release_files: rules_android_ndk-*.tar.gz
bazel_test_command: "cd examples/basic && bazel build java/com/app --android_platforms=//:arm64-v8a"
8 changes: 4 additions & 4 deletions .github/workflows/release_prep.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cat << EOF
2. Add to your \`MODULE.bazel\` file:
\`\`\`starlark
bazel_dep(name = "com_myorg_rules_android_ndk", version = "${TAG:1}")
bazel_dep(name = "rules_android_ndk", version = "${TAG:1}")
\`\`\`
## Using WORKSPACE
Expand All @@ -32,12 +32,12 @@ Paste this snippet into your \`WORKSPACE.bazel\` file:
\`\`\`starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_myorg_rules_android_ndk",
name = "rules_android_ndk",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/myorg/rules_android_ndk/releases/download/${TAG}/${ARCHIVE}",
url = "https://github.com/bazelbuild/rules_android_ndk/releases/download/${TAG}/${ARCHIVE}",
)
EOF

awk 'f;/--SNIP--/{f=1}' e2e/smoke/WORKSPACE.bazel
awk 'f;/--SNIP--/{f=1}' examples/basic/WORKSPACE
echo "\`\`\`"
17 changes: 9 additions & 8 deletions examples/basic/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# NDK

local_repository(
name = "rules_android_ndk",
path = "../..",
)

load("@rules_android_ndk//:rules.bzl", "android_ndk_repository")

android_ndk_repository(name = "androidndk")

register_toolchains("@androidndk//:all")

# rules_android and Android SDK

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

RULES_ANDROID_COMMIT = "dd7b90c91fdc4edeca90ba9ebffa3c469b426a35"

http_archive(
Expand Down Expand Up @@ -43,3 +37,10 @@ register_toolchains(
"@rules_android//toolchains/android:android_default_toolchain",
"@rules_android//toolchains/android_sdk:android_sdk_tools",
)

# --SNIP--: Everything below this lines goes into the example WORKSPACE snippet in the release notes.
load("@rules_android_ndk//:rules.bzl", "android_ndk_repository")

android_ndk_repository(name = "androidndk")

register_toolchains("@androidndk//:all")

0 comments on commit 461e8c9

Please sign in to comment.