Some questions on Android.bp files

3,047 views
Skip to first unread message

jyoti kulkarni

unread,
Jul 30, 2019, 10:10:07 AM7/30/19
to Android Building
Hello Sir/madam,

Im trying to convert some of the .mk files to .bp 
I am using androidmk tool for initial conversion.

But later I m trying to change the converted files to add some more properties and some conditional statement.

I have below questions:
1. Any new property added is giving an error "unrecognized property" 
for eg: unrecognized property "host_required"

2. If I'am trying to include other .mk file in .bp its giving "Path Outside directory"
Iam trying to do something like this:
srcs: ["../Android.mk"]

Please help in addressing these questions.

Thanks

Dan Willemsen

unread,
Jul 30, 2019, 10:14:42 PM7/30/19
to Android Building
1. Which version of Android are you building against? host_required is only supported on AOSP master. Unknown properties are errors, as they're often typos.

2. Including Android.mk files from Android.bp files doesn't make sense, what are you trying to do?

We do forbid all path references that use ".." to escape the current directory however -- you either need to use a filegroup and a module reference ":filegroup_name", or move the contents of the Android.bp up a level. We saw this a lot in applications that had:

   foo/res/...
   foo/src/...
   foo/test/...

And had Android.mk files in the src and test directories that were using "../" to access the other dirs. The better way to handle that is to move those definitions up to a foo/Android.bp file.

There's some internal reasons why forbidding ".." helps a lot, but we also wanted it very obvious where to look to figure out who was using a particular file -- it may only be referenced by an Android.bp directly upwards in the tree. `mma` can work better this way, and we've implemented the concept of visibility so that modules can control who can use their files/outputs.

- Dan

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/8bbaf348-6e27-49c3-942e-67fc13b40330%40googlegroups.com.

jw wang

unread,
Aug 1, 2019, 2:32:28 AM8/1/19
to Android Building
Hi Google

I'm coming across two similar build break after converting the mk to bp :

1. 1. service/Android.bp:7:28: unrecognized property "optimize.proguard_flag_files

     2. /android_common/proguard_dictionary', needed by 'out/target/common/obj/APPS/AudioEFXService_intermediates/proguard_dictionary



I think the error comes from the optimize item which generated by androidtomk tool
 optimize: {
     proguard_flag_files: ["proguard.flags"],
     
    },

jyoti kulkarni

unread,
Aug 2, 2019, 12:22:19 PM8/2/19
to Android Building
Hello Dan,

Thanks for your inputs.
Currently I m still on Android P version.

And for me visibility property is not working, Is this available only on Q?
Are there any alternative to access "previous folder" header files in current .bp

Something like ../app/include giving me Path Outside the Directory, and using visibility dont work

Thanks
Jyoti 

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-...@googlegroups.com.

Dan Willemsen

unread,
Aug 5, 2019, 2:03:33 PM8/5/19
to Android Building
proguard_flag_files was a typo -- it should be proguard_flags_files. It was fixed here: https://android-review.googlesource.com/c/platform/build/soong/+/691330

- Dan

--
--
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

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/63281eff-1da3-40f8-83fd-9b19243d2e8f%40googlegroups.com.

Dan Willemsen

unread,
Aug 5, 2019, 2:10:51 PM8/5/19
to Android Building
And for me visibility property is not working, Is this available only on Q?

visibility is actually only available on master -- it was recently implemented, and didn't make it into Q. That only lets you limit visibility though, which it doesn't sound like what you're looking for.

Are there any alternative to access "previous folder" header files in current .bp

Something like ../app/include giving me Path Outside the Directory, and using visibility dont work

No, there's no way to allow "../" to work in Android.bp files. Move the definition up a level if you're the only one using those files, or use a filegroup to expose those as a set of files. Since you mention "include" -- if this is for C/C++ headers, you may want to read the best practices, and see if you should be exporting the header directories from a library instead of referencing paths directly. (A cc_library_headers may also work in your situation, but I highly suggest that those should only be used for truly header-only libraries).

- Dan 


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.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/a8e5b45d-2de7-4420-a0d5-f297b9e0f00e%40googlegroups.com.

jw wang

unread,
Aug 21, 2019, 12:56:14 PM8/21/19
to Android Building

Hi google

is there anything missing so I got this ?

ninja: error: 'out/soong/.intermediates/FOO/android_common/proguard_dictionary', needed by 'out/target/common/obj/APPS/FOO_intermediates/proguard_dictionary', missing and no known rule to make it
11:43:21 ninja failed with: exit status 1

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-...@googlegroups.com.

Amit Agrawal

unread,
Aug 26, 2019, 10:51:11 AM8/26/19
to Android Building
Hi wang,

I have also faced such issues. This comes when you are building a Module which is written in Android.bp and you want to include some dependency(a module like shared library) which is written in Android.mk. The soong build system can not resolve such dependencies. I haven't got any solution for this. Only way I have got is you need to convert all the dependencies to Android.bp.

Let me know if you find any solution other than this conversion to bp file.

Thanks,
Amit

jw wang

unread,
Sep 2, 2019, 11:25:20 AM9/2/19
to Android Building
Hello Amit Agrawal

I need to create some items as marked by red in the following to avoid proguard_dictionary', needed by 'out/target/common/obj/APPS/AudioEFXService_intermediates/proguard_dictionary

 optimize: {
        proguard_flags_files: ["proguard.flags"],
        enabled: false,
    },


but I don't know why it is acting like this way, anyone can explain ?
Reply all
Reply to author
Forward
0 new messages