Building vendor variants of a module on Android P

1,318 views
Skip to first unread message

Priyanka Bose

unread,
May 22, 2018, 10:14:45 AM5/22/18
to Android Building
Hi,

We are using the Android P preview release where we see that soong build system has been changed to no longer depend on subdirs , 
and as I understand it will include all the Android.bp files from the root directory in the Android.bp list.
Actually we are working on a vendor variant of  libart.so and till lately we could use the conditional environment variable setting to check which source code to be built.
Thus excluding the Android.bp files for the core variant . 
For eg: we have a Module A in both the Android.bp files  located in different folders for Core and our vendor variant.
We used to read which variant to be built/enabled with an environment variable setting and include those Android.bp for the variant folder .

But with the latest master of Android P , this seems to be not possible and we end up in multiple definitions since we have the similar module names in the Android.bp files for
both core and vendor variants.
I see there is a new feature called VNDK , i tried to use it with "vendor: true" in Android.bp file but that seems to also not help me.

Can you let me know if an VNDK is an option we can use for this or any suggestions ?

Regards,
Priyanka

Wesolowski, Krzysztof

unread,
May 22, 2018, 1:54:00 PM5/22/18
to android-...@googlegroups.com
If you are only after avoiding module name clashes you can look at soong namespaces

BR, K

Get Outlook for Android


From: android-...@googlegroups.com <android-...@googlegroups.com> on behalf of Priyanka Bose <dolab...@gmail.com>
Sent: Tuesday, May 22, 2018 12:08:02 PM
To: Android Building
Subject: [android-building] Building vendor variants of a module on Android P
 
--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
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 android-buildi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Priyanka Bose

unread,
May 24, 2018, 11:20:47 AM5/24/18
to Android Building
Hi,

Thanks for the info , that helped for the multiple definition errors with regards to the modules .

I added something like this in the beginning of the Android.bp file :

soong_namespace {
}

Though the multiple definition issues is no longer seen but later the build fails with ninja errors stating multiple rules for same binary.

Something like :
ninja: error: out/soong/build.ninja:455718: multiple rules generate out/soong/host/linux-x86/nativetest64/art_dex2oat_tests/dex2oat_image_test [-w dupbuild=err] .

So I am not sure even if soong_namespace works with this situation

Regards,
Priyanka

Priyanka Bose

unread,
May 25, 2018, 10:49:46 AM5/25/18
to Android Building
Hi,

Actually I investigated a bit more and it looks like though the soong detects that the modules are on different namespace , but since the Ninja build system builds for all targets,
and it fails identify that those they are same binaries/modules ,they are on different namespaces

ninja: error: out/soong/build.ninja:455718: multiple rules generate out/soong/host/linux-x86/nativetest64/art_dex2oat_tests/dex2oat_image_test [-w dupbuild=err] .

I am not sure then how can we build both core and vendor modules with same names ..Even I tried enabling vndk in the core lib, but it finally ends with the above 
errors of ninja.

Any help is appreciated thanks !

Regards
Priyanka

Priyanka Bose

unread,
May 29, 2018, 12:45:18 PM5/29/18
to Android Building
So is there any way that we can build the same module name (but on different soong namespaces) for same ninja targets ? Currently the ninja build system does not allow the same modules to be built on the targets stating multiple rules error .

Actually I might be wrong here, but can anyone help me to understand that when soong_namespace gives the utility to define same module names for different namespaces then should'nt the ninja build rules also try to identify if the similar modules being built are located on separate soong namespaces or not ?

Colin Cross

unread,
May 29, 2018, 1:38:18 PM5/29/18
to android-...@googlegroups.com
soong-namespaces are designed for dealing with multiple products.  To make this work you would need to put art in it's own namespace (taking it out of the default namespace), and then select your namespace instead of art's namespace.  But this is likely to be a large undertaking, as art is part of the core platform and may be expected in the default namespace by other modules.

Since you have the code and are making modifications to a core module, why not make your changes in the art directory?  Even better, upstream your changes to AOSP and then you won't have to have a vendor variant.


On Tue, May 29, 2018 at 9:45 AM Priyanka Bose <dolab...@gmail.com> wrote:
So is there any way that we can build the same module name (but on different soong namespaces) for same ninja targets ? Currently the ninja build system does not allow the same modules to be built on the targets stating multiple rules error .

Actually I might be wrong here, but can anyone help me to understand that when soong_namespace gives the utility to define same module names for different namespaces then should'nt the ninja build rules also try to identify if the similar modules being built are located on separate soong namespaces or not ?

Reply all
Reply to author
Forward
0 new messages