I've done something similar recently. Essentially, Android NDK is not exactly the same as the AOSP soong build system. To use bazel to build a library for AOSP, I had to bent Android NDK a little bit.
These involve the following steps: 1. Change __config so it uses __ instead of __ndk for _LIBCPP_ABI_NAMESPACE so it matches with AOSP 2. Update NDK's libc.a, libc++_static.a, and libc++_shared.so with the one in AOSP 3. Uses the existing android_binary project to build an apk with jni so it links the .so files for you. You then can find the .so files in the intermediate directory in Bazel-out. Then, you can includes the .so files by using cc_prebuilt_library_shared in an Android.bp file. On Friday, June 16, 2023 at 9:47:39 AM UTC-7 Joshua Puerta wrote: > Hi Android Build group, > > I hope this is the proper group to ask the question. Long story short, I'd > like to know if it's possible to build projects contained in external and > vendor directories using AOSP's Bazel. I read that is possible to build > kernels (Kleaf) but it was futile for me to build some external and custom > libs with it (even if I can build them using bazel in non-AOSP context). > > In case that it's already supported, I'd like to know which modifications > need to be done (or directly how to do it properly). Any tip and/or link to > some repo/doc is more than welcomed. > > In case that it's not yet supported, I'd like to know if it's included in > the roadmap, and if we are far away from it. > > For more context, we are trying to build a modified version of Tensorflow > Lite lib. So far we are able to build it using CMake and the NDK, and > include it somehow. As TFLite supports Bazel, we wanted to build it > properly inside AOSP rather than including precompiled libs. I also found > that there is a Tensorflow project in /external with several Android > Blueprint files, which I guess I can port somehow to our TFLite, but I'd > prefer to keep the same build system to minimize efforts. > > Thanks for your time and best regards, > > Extra ball: Is there any priority/control when selecting a build system > for a project? If project X contains .mk, .bp and BUILD files, which system > is going to be used? Bazel > Soong > .mk? > > > > > -- -- You received this message because you are subscribed to the "Android Building" mailing list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-building?hl=en --- You received this message because you are subscribed to the Google Groups "Android Building" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/e7ca9a40-1777-4939-8327-d3e3654d29acn%40googlegroups.com.
