Giter VIP home page Giter VIP logo

Comments (11)

ted-xie avatar ted-xie commented on September 24, 2024

@ahumesky @meisterT

from rules_android.

ahumesky avatar ahumesky commented on September 24, 2024

I think that's referenced here:
https://github.com/bazelbuild/bazel/blob/d0e29582a2e788e8acdaf53fe30ab7f7dc592df3/tools/android/BUILD.tools#L448

For the starlark rules at least, I think we can point them here instead:

name = "compiler_annotation_processor",

from rules_android.

ahumesky avatar ahumesky commented on September 24, 2024

Hm, we appear to already be doing that:

default = "//tools/android:compiler_annotation_processor",

from rules_android.

ahumesky avatar ahumesky commented on September 24, 2024

So probably coming from the parts of android_binary that are still in native:

native.android_binary(

from rules_android.

ahumesky avatar ahumesky commented on September 24, 2024

But I think we could replace this:

https://github.com/bazelbuild/bazel/blob/d0e29582a2e788e8acdaf53fe30ab7f7dc592df3/tools/android/BUILD.tools#L446-L449

with this:

java_plugin(
name = "compiler_annotation_processor",
generates_api = True,
processor_class = "android.databinding.annotationprocessor.ProcessDataBinding",
visibility = ["//visibility:public"],
deps = [
"@bazel_tools//src/tools/android/java/com/google/devtools/build/android:all_android_tools",
],
)

and change the name to match the existing alias, it should "just work"

from rules_android.

telescopic avatar telescopic commented on September 24, 2024

Hi folks,
quick question - i'm new to bzlmod and trying to setup my android project using bzlmod.

I'm not sure if there's an equivalent to WORKSPACE's android_sdk_repository in bzlmod? When i try to build android_library targets with my MODULE.bazel depending on rules_android module i run into the following error:

While resolving toolchains for target //:sample: No matching toolchains found for types @bazel_tools//tools/android:sdk_toolchain_type.

Wondering if this is related to this issue. i.e. it's not possible yet to setup android projects using bzlmod?

from rules_android.

Bencodes avatar Bencodes commented on September 24, 2024

@telescopic Bzlmod works now but you will need to be using the latest Bazel rolling release until the actual fix get backported into the 6.x release track.

from rules_android.

telescopic avatar telescopic commented on September 24, 2024

@Bencodes thanks for your reply - is there any documentation surrounding the same?

from rules_android.

Bencodes avatar Bencodes commented on September 24, 2024

@telescopic not much documentation right now.

Bzlmod doesn't actually seem to be fully working if you are using rules_android at HEAD. If you are still using the native rules it's possible to get everything working. Example: https://github.com/robolectric/robolectric-bazel/tree/master/examples/simple

from rules_android.

bdleitner avatar bdleitner commented on September 24, 2024

bzlmod support doesn't seem to be working at all:
I created a minimal example showing that following the basic instructions on the main README here leads to the repo not being found.

EDIT
Huh apparently I had a problem with my bazelrc (failed to include line-continuations), adding those in so the flags were all present I ended up with a different error:

ERROR: no such package '@@android_gmaven_r8//jar': The repository '@@android_gmaven_r8' could not be resolved: Repository '@@android_gmaven_r8' is not defined
ERROR: D:/_bazel_out/lbijidmj/external/androidsdk/BUILD.bazel:31:25: no such package '@@android_gmaven_r8//jar': The repository '@@android_gmaven_r8' could not be resolved: Repository '@@android_gmaven_r8' is not defined and referenced by 
'@@androidsdk//:d8_jar_import'

from rules_android.

ted-xie avatar ted-xie commented on September 24, 2024

Hi @bdleitner,

The README is sadly not entirely up to date, especially for bzlmod integration. We will address documentation shortcomings later this year as part of the overall rules maturation process. I have a change in progress that adds the following lines to MODULE.bazel for the example app that should address the issue you're seeing.

remote_android_extensions = use_extension("@bazel_tools//tools/android:android_extensions.bzl", "remote_android_tools_extensions")
use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")

from rules_android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.