Conversation
Author
|
@keith, would you be interested in receiving a contribution like this? A similar change was also accepted into rules_android_ndk, although this change here does not require the change mentioned in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds public labels that downstream Bazel modules can use to export the locations of the downloaded Android SDK and NDK to local build tools, including Gradle and Android Studio.
At Microblink, we use Bazel to build and test C++ code, while our Android developers prefer Android Studio and Gradle for app development. The Android development experience does not yet have feature parity across these workflows. Sharing Bazel's NDK lets the Gradle builds use the same native toolchain as our Bazel C++ tests, with its version managed in one place.
The SDK and NDK can be consumed independently. Our app workflow uses Android Studio's SDK and CMake installation together with Bazel's NDK. Exporting the Bazel-managed SDK is also useful for projects whose requirements are covered by its configured packages; this does not add CMake or turn the installation into an SDK Manager-managed SDK.
The changes are:
@androidndk//:ndk_rootand@androidsdk//:sdk_rootas single-file markers, with platform-selecting aliases. A downstream executable can resolve the marker's physical parent directory atbazel runtime and write the path to a properties file consumed by Gradle.package.xmlmetadata when absent so Gradle can discover decimal API levels such as37.0.@androidndk//:all_files, including the clang and sysroot subpackages, for consumers that need the complete file set.The properties-file generator remains a downstream concern. These labels provide the installation discovery interface; consumers choose their property names and SDK/NDK integration independently. Exported machine-local paths are generated at runtime and must be refreshed after version or cache changes.
Validation:
bazel test //tests:valid_labels_build_test --lockfile_mode=offon macOS.git diff --check.The downstream integration tests and Gradle projects are outside this repository; the label regression coverage is included here.
This contribution comes from a hybrid Bazel/Gradle workflow. Feedback on whether this local integration interface fits the project's scope, and on the shape of the public labels, is welcome.
AI disclosure: the entire implementation was generated by AI (OpenAI Codex), including the code, documentation, and test changes. The PR description was also written by Codex. The development-app validation above was performed by the developer; broader QA validation remains pending.