Android.bp file copy issue

1,757 views
Skip to first unread message

Kyle Cai

unread,
Oct 9, 2019, 4:09:51 PM10/9/19
to Android Building
Hi, 

I'm not sure if this is the right place to ask about android.bp files. Here is an issue that I'm seeing and I can't figure out why I'm seeing this. My .bp file has the following two sections, one for regular android build and one for android go:

prebuilt_etc {
    name: "sysconfig_google",
    product_specific: true,
    sub_dir: "sysconfig",
    src: "google.xml",
    filename_from_src: true,
}

prebuilt_etc {
    name: "sysconfig_google_go",
    product_specific: true,
    sub_dir: "sysconfig",
    src: "google_go.xml",
    filename: "google.xml",
}

The intention is that if I'm making a regular build, a gms.mk file is used and it calls sysconfig_google. If I'm making a Go build, the gms_go.mk file is used, and that calls  sysconfig_google_go. In the source directory there is "google.xml" and "google_go.xml" and depending on which is called, it should go to the destination directory as "google.xml". However, currently when I build a regular build (non-Go), I see in the destination directory that the google.xml file has the content of the google_go.xml file. Any idea why it's doing that? 

Thanks,

Kyle 

Dan Willemsen

unread,
Oct 9, 2019, 4:24:32 PM10/9/19
to Android Building
Modules must have unique output names, as the installation rules are always defined. You should be seeing warnings during the build startup about duplicate rules for target:

build/make/core/base_rules.mk:481: warning: overriding commands for target `out/target/product/<device>/product/etc/sysconfig/google.xml'
build/make/core/base_rules.mk:481: warning: ignoring old commands for target `out/target/product/<device>/product/etc/sysconfig/google.xml'


That's saying that there are two ways to build a specific installation file, and we may pick one or the other (fairly arbitrarily, and sometimes using a mix of the two rules).

- 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/a37db4cd-f4b0-43bf-a507-964f552873f1%40googlegroups.com.

Kyle Cai

unread,
Oct 9, 2019, 6:59:07 PM10/9/19
to Android Building
Thanks Dan for the reply. Yes I do see the warning msgs you pointed out. 

Now the question is how should I fix this given that the destination file has to be google.xml? I believe previously with .mk files this was not an issue?

Thanks in advance.

Kyle 

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,
Oct 9, 2019, 7:05:48 PM10/9/19
to Android Building
The same definition would be a problem in Android.mk too -- in fact, this warning is coming from the makefile system (since the makefile system still handles installation for both Make and Soong).

It looks like inside Google, we're not defining `prebuilt_etc` or `BUILD_PREBUILT` definitions for this file, instead we're installing it via PRODUCT_COPY_FILES in your product configuration. That way every product can choose how to install that file.

Or you could "hide" one of the modules from Make using soong namespaces, only turning on the one that you want for a particular device. Then make will only create a single installation rule. (I haven't tried it, but it should work -- this is how we handle more complicated modules that need to be different per device)

- 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/4499c9d7-c210-4f99-8dd6-dc7c4acb3888%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages