Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Android NDK patch so that Android NDK can be handled gracefully #1182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yukawa
Copy link
Collaborator

@yukawa yukawa commented Feb 14, 2025

Description

This is a preparation before removing the dependency on Docker from our Android build instructions (#1181).

Suppose we want to set 'path' attribute to android_ndk_repository_extension so that we can specify the actual path to the Android NDK in our MODULE.bazel.

  android_ndk_repository_extension = use_extension(
      "@rules_android_ndk//:extension.bzl",
      "android_ndk_repository_extension",
  )
  android_ndk_repository_extension.configure(
      path = "$WORKSPACE_ROOT/third_party/ndk/android-ndk-r28",
  )
  use_repo(android_ndk_repository_extension, "androidndk")

The problem is that there is currently no way to conditionally the the above path attribute depending on the host platform and/or the target platform. As a result, the above configuration takes effect not only on Linux but also on Windows environment, where we do not plan to support building libmozc.so right now.

To gracefully handle the above scenario, this commit updates our patch to rules_android_ndk to generate an empty BUILD.bazel file when an Android NDK does not exist at the location specified by ANDROID_NDK_HOME or the path attribute. Basically this is a superset of the behavior of the current patch, where an empty BUILD.bazel file is generated unless ANDROID_NDK_HOME is explicitly specified or the path attribute is set.

In general there should be no observable behavior change as long as the build is currently passing.

Issue IDs

Steps to test new behaviors (if any)

  • Steps:
    1. Confirm Linux and Android CI is still passing in GitHub Actions

@yukawa yukawa force-pushed the upadte_rules_android_ndk_patch branch from 7f4cf94 to 4957ca0 Compare February 14, 2025 09:08
This is a preparation before removing the dependency on Docker from our
Android build instructions (google#1181).

Suppose we want to specify 'path' attribute to
'android_ndk_repository_extension' so that we can specify the actual
path to the Android NDK in our MODULE.bazel.

  android_ndk_repository_extension = use_extension(
      "@rules_android_ndk//:extension.bzl",
      "android_ndk_repository_extension",
  )
  android_ndk_repository_extension.configure(
      path = "$WORKSPACE_ROOT/third_party/ndk/android-ndk-r28",
  )
  use_repo(android_ndk_repository_extension, "androidndk")

The problem is that there is currently no way to conditionally the the
above path attribute depending on the host platform and/or the target
platform. As a result, the above configuration takes effect not only on
Linux but also on Windows environment, where we do not plan to support
building libmozc.so right now.

To gracefully handle the above scenario, this commit updates our patch
to 'rules_android_ndk' to generate an empty BUILD.bazel file when an
Android NDK does not exist at the location specified by ANDROID_NDK_HOME
or the path attribute. Basically this is a superset of the behavior of
the current patch, where an empty BUILD.bazel file is generated unless
ANDROID_NDK_HOME is explicitly specified or the path attribute is set.

In general there should be no observable behavior change as long as the
build is currently passing.
@yukawa yukawa force-pushed the upadte_rules_android_ndk_patch branch from 4957ca0 to 33410cd Compare February 14, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant