Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
66 changes: 42 additions & 24 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
buildifier: latest
matrix:
bazel: [
7.4.1,
8.0.0,
# TODO: re-enable last_green once bazelbuild/rules_android#328 is resolved.
# last_green,
7.x,
Comment thread
ted-xie marked this conversation as resolved.
8.x,
9.*
]

# WORKSPACE is only supported in Bazel 7.x and 8.x (removed in 9.x)
matrix_workspace: &matrix_workspace
bazel: ${{ bazel }}
matrix:
bazel: [7.x, 8.x]

basic_example: &basic_example
working_directory: examples/basic
build_flags:
Expand All @@ -34,17 +39,27 @@ cpu_features: &cpu_features
- "--incompatible_disallow_empty_glob"
- "--incompatible_enable_android_toolchain_resolution"
- "--platforms=//:arm64-v8a"
- "--enable_bzlmod=False"
- "--enable_workspace=True"
build_targets:
- "//:all"

ubuntu2004: &ubuntu2004
platform: ubuntu2004
cpu_features_bzlmod: &cpu_features_bzlmod
working_directory: examples/cpu_features
build_flags:
- "--incompatible_disallow_empty_glob"
Comment thread
agluszak marked this conversation as resolved.
Outdated
- "--incompatible_enable_android_toolchain_resolution"
Comment thread
agluszak marked this conversation as resolved.
Outdated
- "--platforms=//:arm64-v8a"
build_targets:
- "//:all"

ubuntu2404: &ubuntu2404
platform: ubuntu2404
environment:
ANDROID_NDK_HOME: /opt/android-ndk-r25b

macos: &macos
platform: macos
platform: macos_arm64
environment:
ANDROID_NDK_HOME: /Users/buildkite/android-ndk-r25b

Expand All @@ -55,37 +70,40 @@ windows: &windows
BAZELCI_LOCAL_RUN: true

tasks:
basic_example_ubuntu2004:
name: Basic Example
bazel: ${{ bazel }}
<<: [*ubuntu2004, *basic_example]
basic_example_bzlmod_ubuntu2004:
basic_example_ubuntu2404:
name: Basic Example (WORKSPACE)
<<: [*matrix_workspace, *ubuntu2404, *basic_example]
basic_example_bzlmod_ubuntu2404:
name: Basic Example Bzlmod
bazel: ${{ bazel }}
<<: [*ubuntu2004, *basic_example_bzlmod]
<<: [*ubuntu2404, *basic_example_bzlmod]
basic_example_macos:
name: Basic Example
bazel: ${{ bazel }}
<<: [*macos, *basic_example]
name: Basic Example (WORKSPACE)
<<: [*matrix_workspace, *macos, *basic_example]
basic_example_bzlmod_macos:
name: Basic Example Bzlmod
bazel: ${{ bazel }}
<<: [*macos, *basic_example_bzlmod]
basic_example_windows:
name: Basic Example
bazel: ${{ bazel }}
<<: [*windows, *basic_example]
name: Basic Example (WORKSPACE)
<<: [*matrix_workspace, *windows, *basic_example]
basic_example_bzlmod_windows:
name: Basic Example Bzlmod
bazel: ${{ bazel }}
<<: [*windows, *basic_example_bzlmod]


cpu_features_ubuntu2004:
name: CPU Features
cpu_features_ubuntu2404:
name: CPU Features (WORKSPACE)
<<: [*matrix_workspace, *ubuntu2404, *cpu_features]
cpu_features_bzlmod_ubuntu2404:
name: CPU Features Bzlmod
bazel: ${{ bazel }}
<<: [*ubuntu2004, *cpu_features]
<<: [*ubuntu2404, *cpu_features_bzlmod]
cpu_features_macos:
name: CPU Features
name: CPU Features (WORKSPACE)
<<: [*matrix_workspace, *macos, *cpu_features]
cpu_features_bzlmod_macos:
name: CPU Features Bzlmod
bazel: ${{ bazel }}
<<: [*macos, *cpu_features]
<<: [*macos, *cpu_features_bzlmod]
2 changes: 2 additions & 0 deletions BUILD.ndk_clang.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Declarations for the NDK's Clang directory."""

load("@rules_cc//cc/toolchains:cc_toolchain.bzl", "cc_toolchain")
load("@rules_cc//cc/toolchains:cc_toolchain_suite.bzl", "cc_toolchain_suite")
load("@@{repository_name}//:ndk_cc_toolchain_config.bzl", "ndk_cc_toolchain_config_rule")
load("//:target_systems.bzl", "TARGET_SYSTEM_NAMES")

Expand Down
11 changes: 2 additions & 9 deletions examples/basic/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
# For bazel 5.3.0, not necessary for 6.0.0+
build --define=android_incremental_dexing_tool=d8_dexbuilder
build --define=android_dexmerger_tool=d8_dexmerger

# TODO: Remove once https://github.com/bazelbuild/rules_android/issues/219 is resolved.
common --experimental_google_legacy_api
common --experimental_enable_android_migration_apis

common --android_sdk=@androidsdk//:sdk
common --java_runtime_version=remotejdk_17
common --tool_java_runtime_version=remotejdk_17
2 changes: 1 addition & 1 deletion examples/basic/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use_repo(android_ndk_repository_extension, "androidndk")

register_toolchains("@androidndk//:all")

bazel_dep(name = "rules_android", version = "0.6.0")
bazel_dep(name = "rules_android", version = "0.7.1")

register_toolchains(
"@rules_android//toolchains/android:android_default_toolchain",
Expand Down
5 changes: 3 additions & 2 deletions examples/basic/java/com/app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@

<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="21" />
android:targetSdkVersion="34" />

<application android:label="Bazel Test App" >
<activity
android:name="com.app.MainActivity"
android:label="Bazel Test App" >
android:label="Bazel Test App"
android:exported="true" >
Comment thread
ted-xie marked this conversation as resolved.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
2 changes: 2 additions & 0 deletions examples/basic/java/com/app/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ android_library(
cc_library(
name = "jni",
srcs = ["jni.cc"],
target_compatible_with = ["@platforms//os:android"],
deps = [":jni_dep"],
)

Expand All @@ -33,4 +34,5 @@ cc_library(
srcs = ["jni_dep.cc"],
hdrs = ["jni_dep.h"],
linkopts = ["-llog"],
target_compatible_with = ["@platforms//os:android"],
)
2 changes: 1 addition & 1 deletion examples/basic/java/com/app/jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <jni.h>
#include "jni.h"
Comment thread
agluszak marked this conversation as resolved.
Outdated
#include <string>

#include "java/com/app/jni_dep.h"
Expand Down
14 changes: 14 additions & 0 deletions examples/cpu_features/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module(name = "cpu_features_example")

bazel_dep(name = "platforms", version = "0.0.10")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the latest versions for platforms and rules_cc.

bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "rules_android_ndk", version = "0.1.2")
local_path_override(
module_name = "rules_android_ndk",
path = "../..",
)

android_ndk_repository_extension = use_extension("@rules_android_ndk//:extension.bzl", "android_ndk_repository_extension")
use_repo(android_ndk_repository_extension, "androidndk")

register_toolchains("@androidndk//:all")