Re: [android-building] How to add relative path for srcs:[] in Android.bp

2019-10-17 Thread 'Dan Willemsen' via Android Building
Here's an example of using a filegroup for this --
cts/hostsidetests/media/common/**/*.java is used by two modules under
cts/hostsidetests/media/app/...

So we've got the filegroup that defines all the files in the common
directory:
cts/hostsidetests/media/Android.bp

filegroup {
name: "CtsMediaSessionTestCommon",
srcs: ["common/**/*.java"],
}

And then used in the srcs list with ":CtsMediaSessionTestCommon":
cts/hostsidetests/media/app/MediaSessionTest/Android.bp

android_test_helper_app {
name: "CtsMediaSessionHostTestApp",
defaults: ["cts_defaults"],
test_suites: [
"cts",
"vts",
"general-tests",
],
srcs: [
"src/**/*.java",

*":CtsMediaSessionTestCommon",*],
static_libs: [
"androidx.test.rules",
"compatibility-device-util-axt",
],
sdk_version: "test_current",
min_sdk_version: "26",
}

In this case, it may have been possible to instead refactor the common file
into a library that would be used instead (and then only compiling the
files once instead of 2 times), but both would function.

- Dan

On Thu, Oct 17, 2019 at 3:08 PM REGURI AKANKSHA 
wrote:

> Thanks,Dan I was able to tackle the above error. I am new to these things.
> Can u explain this  filegroup with an example, like by defining some
> module, that would be really helpful
> Thanks in advance
>
> On Thu, Oct 17, 2019 at 10:19 PM 'Dan Willemsen' via Android Building <
> android-building@googlegroups.com> wrote:
>
>> We don't allow references outside of the current directory and its
>> subdirectories in Soong. We require the directory with the sources to
>> opt-into being used by others, either by directly defining the modules, or
>> by defining filegroup modules that can be used in the src[s] fields via
>> ":myfilegroup" (colon-prefixed module name). This way we can actually let
>> you control who uses files within your directory (via visibility), and
>> tools like `mma` and `atest` are more likely to be able to handle
>> "build/test everything in this directory" properly.
>>
>> So in this case, either move the Android.bp up to the parent path (which
>> usually makes sense for parents, or for apps that have "src" / "jni" /
>> "res" dirs, as we do automatically look for files in the same directory for
>> some things), or define a filegroup in the parent and use it below (this
>> can be more useful if the same file is used by multiple children, though it
>> may make more sense to use a static library or something more specific).
>>
>> That error is that you have multiple definitions of the same module, and
>> is unlikely to be related to just moving an Android.bp upwards (unless it
>> was below a `soong_namespace {}` definition, but that means you weren't
>> using that Android.bp in the first place).
>>
>> - Dan
>>
>>
>> On Tue, Oct 15, 2019 at 8:27 AM   wrote:
>>
>>> hello,
>>> say in a Android.bp file srcs:["../../../a.cpp"]
>>> I am getting the error Path is outside directory "../../../a.cpp"? How
>>> to overcome this?
>>>
>>> Later I tried declaring Android.bp in to a parent folder so that
>>> srcs:["a.cpp"] but then ,
>>> FAILED:
>>> build/make/core/base_rules.mk:325: error: /gps-noship/cacert_location:
>>> MODULE.TARGET.ETC.cacert_location.pem already defined by /prebuilt_HY11.
>>> 02:01:45 ckati failed with: exit status 1
>>>
>>>  failed to build some targets (02:16 (mm:ss)) 
>>>
>>> How to overcome these?
>>> Thanks in advance
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the "Android
>>> Building" mailing list.
>>> To post to this group, send email to android-building@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/android-building/75ea2ea6-f85b-4577-a98c-1fd42f867150%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> --
>> You received this message because you are subscribed to the "Android
>> Building" mailing list.
>> To post to this group, send email to android-building@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-building+unsubscr...@googlegroups.com
>> For more 

Re: [android-building] How to add relative path for srcs:[] in Android.bp

2019-10-17 Thread REGURI AKANKSHA
Thanks,Dan I was able to tackle the above error. I am new to these things.
Can u explain this  filegroup with an example, like by defining some
module, that would be really helpful
Thanks in advance

On Thu, Oct 17, 2019 at 10:19 PM 'Dan Willemsen' via Android Building <
android-building@googlegroups.com> wrote:

> We don't allow references outside of the current directory and its
> subdirectories in Soong. We require the directory with the sources to
> opt-into being used by others, either by directly defining the modules, or
> by defining filegroup modules that can be used in the src[s] fields via
> ":myfilegroup" (colon-prefixed module name). This way we can actually let
> you control who uses files within your directory (via visibility), and
> tools like `mma` and `atest` are more likely to be able to handle
> "build/test everything in this directory" properly.
>
> So in this case, either move the Android.bp up to the parent path (which
> usually makes sense for parents, or for apps that have "src" / "jni" /
> "res" dirs, as we do automatically look for files in the same directory for
> some things), or define a filegroup in the parent and use it below (this
> can be more useful if the same file is used by multiple children, though it
> may make more sense to use a static library or something more specific).
>
> That error is that you have multiple definitions of the same module, and
> is unlikely to be related to just moving an Android.bp upwards (unless it
> was below a `soong_namespace {}` definition, but that means you weren't
> using that Android.bp in the first place).
>
> - Dan
>
>
> On Tue, Oct 15, 2019 at 8:27 AM   wrote:
>
>> hello,
>> say in a Android.bp file srcs:["../../../a.cpp"]
>> I am getting the error Path is outside directory "../../../a.cpp"? How to
>> overcome this?
>>
>> Later I tried declaring Android.bp in to a parent folder so that
>> srcs:["a.cpp"] but then ,
>> FAILED:
>> build/make/core/base_rules.mk:325: error: /gps-noship/cacert_location:
>> MODULE.TARGET.ETC.cacert_location.pem already defined by /prebuilt_HY11.
>> 02:01:45 ckati failed with: exit status 1
>>
>>  failed to build some targets (02:16 (mm:ss)) 
>>
>> How to overcome these?
>> Thanks in advance
>>
>> --
>> --
>> You received this message because you are subscribed to the "Android
>> Building" mailing list.
>> To post to this group, send email to android-building@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/android-building/75ea2ea6-f85b-4577-a98c-1fd42f867150%40googlegroups.com
>> 
>> .
>>
> --
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to android-building@googlegroups.com
> To unsubscribe from this group, send email to
> android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-building/CALQgHd%3DXqqOGRCSHorr1UFV%3Dok%3DLHqEGmRrru9vGP%2BswDiZTxw%40mail.gmail.com
> 
> .
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to android-building@googlegroups.com
To unsubscribe from this group, send email to
android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/CA%2BVoWj7h3XMDiJY5ukqeMJnt7PPxAfLtrExG0BnLPY_%3DGp9Uyw%40mail.gmail.com.


Re: [android-building] Adding dependencies for Header Libraries

2019-10-17 Thread 'Dan Willemsen' via Android Building
Why does a header library need another module to be compiled first? It's
not actually compiling anything. I'm assuming you actually want to export
the dependencies that generated some header files? Depending on the full
compilation of a dependency will cause your builds to be more linear (and
thus slower).

If you're generating headers, adding them to LOCAL_GENERATED_SOURCES will
add the appropriate dependencies. They need to be in the proper location in
order for the include directories to be handled anyways.

There is LOCAL_EXPORT_C_INCLUDE_DEPS, but unless you're doing something
really weird, you shouldn't need to do that. If you're just re-exporting
another module's generated header files, that module should be setting up
the exported dependencies, and we'll automatically pass those along.


In Soong, this is a bit more standardized, as you're rarely writing the
explicit rules. Anything that looks like a genrule (implements
SourceFileGenerator
)
can be used in generated_headers / export_generated_headers:

cc_library_headers {
name: "my_header_library",
...
generated_headers: ["my_genrule_type_module"],
export_generated_headers: ["my_genrule_type_module"],
}

- Dan

On Wed, Oct 16, 2019 at 9:58 AM Vinayak Soni 
wrote:

> Hi,
>
> Suppose my header library depends on another module to be compiled first.
> For other modules, you can add LOCAL_ADDITIONAL_DEPENDENCIES but that does
> not work for HEADER_LIBRARIES. Is there a way this can be done?
>
> TIA,
> Vinayak
>
> --
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to android-building@googlegroups.com
> To unsubscribe from this group, send email to
> android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-building/8735b4b2-0a0c-4a0c-a422-88d2b5037330%40googlegroups.com
> 
> .
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to android-building@googlegroups.com
To unsubscribe from this group, send email to
android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/CALQgHd%3DGrwTMkzQt1BdJB%2BjPJqZnyDjBo-QvfqNc_4Vfr3wZMA%40mail.gmail.com.


Re: [android-building] writing header libraries in Android.bp

2019-10-17 Thread 'Dan Willemsen' via Android Building
COPY_HEADERS is deprecated in Make, and unsupported in Soong. Use a header
library instead. That may require re-arranging your source tree, or
creating a directory full of symlinks, as we don't support rewriting the
directory structures the same was as COPY_HEADERS, you just export
everything under a directory.

I had written some about this in our best practices doc:
https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers

- Dan

On Mon, Oct 14, 2019 at 9:46 AM REGURI AKANKSHA 
wrote:

> How to write headers in Android.bp?
>
> say Android.mk has header of this type
> include $(CLEAR_VARS)
> LOCAL_COPY_HEADERS_TO := x
> LOCAL_COPY_HEADERS:= y
> LOCAL_PROPRIETARY_MODULE := z
> include $(BUILD_COPY_HEADERS)
>
> How to write such headers in Android.bp? i know that LOCAL_COPY_HEADERS is
> deprecated in Soong, but have no idea of how to write to Android.bp
> Thanks in Advance
>
> --
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to android-building@googlegroups.com
> To unsubscribe from this group, send email to
> android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-building/2ac5ecc7-d171-4d9e-9a6c-a92fd9612cfa%40googlegroups.com
> 
> .
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to android-building@googlegroups.com
To unsubscribe from this group, send email to
android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/CALQgHdmv%2BqMn8%2BdhaXDWZvn_n%2BaTCmu67PJ8tiuuK4KufDtSPA%40mail.gmail.com.


Re: [android-building] How to add relative path for srcs:[] in Android.bp

2019-10-17 Thread 'Dan Willemsen' via Android Building
We don't allow references outside of the current directory and its
subdirectories in Soong. We require the directory with the sources to
opt-into being used by others, either by directly defining the modules, or
by defining filegroup modules that can be used in the src[s] fields via
":myfilegroup" (colon-prefixed module name). This way we can actually let
you control who uses files within your directory (via visibility), and
tools like `mma` and `atest` are more likely to be able to handle
"build/test everything in this directory" properly.

So in this case, either move the Android.bp up to the parent path (which
usually makes sense for parents, or for apps that have "src" / "jni" /
"res" dirs, as we do automatically look for files in the same directory for
some things), or define a filegroup in the parent and use it below (this
can be more useful if the same file is used by multiple children, though it
may make more sense to use a static library or something more specific).

That error is that you have multiple definitions of the same module, and is
unlikely to be related to just moving an Android.bp upwards (unless it was
below a `soong_namespace {}` definition, but that means you weren't using
that Android.bp in the first place).

- Dan


On Tue, Oct 15, 2019 at 8:27 AM   wrote:

> hello,
> say in a Android.bp file srcs:["../../../a.cpp"]
> I am getting the error Path is outside directory "../../../a.cpp"? How to
> overcome this?
>
> Later I tried declaring Android.bp in to a parent folder so that
> srcs:["a.cpp"] but then ,
> FAILED:
> build/make/core/base_rules.mk:325: error: /gps-noship/cacert_location:
> MODULE.TARGET.ETC.cacert_location.pem already defined by /prebuilt_HY11.
> 02:01:45 ckati failed with: exit status 1
>
>  failed to build some targets (02:16 (mm:ss)) 
>
> How to overcome these?
> Thanks in advance
>
> --
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to android-building@googlegroups.com
> To unsubscribe from this group, send email to
> android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-building/75ea2ea6-f85b-4577-a98c-1fd42f867150%40googlegroups.com
> 
> .
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to android-building@googlegroups.com
To unsubscribe from this group, send email to
android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/CALQgHd%3DXqqOGRCSHorr1UFV%3Dok%3DLHqEGmRrru9vGP%2BswDiZTxw%40mail.gmail.com.


Re: [android-building] sub_dir unrecognized property

2019-10-17 Thread 'Dan Willemsen' via Android Building
LOCAL_MODULE_PATH wasn't strictly necessary in make either -- if you had
set `LOCAL_PROPRIETARY_MODULE := true` like the `proprietary: true` in the
Android.bp, it would get installed into the correct location. The
`androidmk` tool tries to auto-fix some cases of LOCAL_MODULE_PATH, but it
can't understand everything. So the `prebuilt_etc` module that you wrote
should install into /vendor/etc/location.pem (or /system/vendor if there's
no vendor partition).

What will break is the "../" in the src field -- we don't allow references
outside of the current directory and its subdirectories in Soong. We
require the directory with the sources to opt-into being used by others,
either by directly defining the modules, or by defining filegroup modules
that can be used in the src[s] fields via ":myfilegroup" (colon-prefixed
module name). This way we can actually let you control who uses files
within your directory (via visibility), and tools like `mma` and `atest`
are more likely to be able to handle "build/test everything in this
directory" properly.

- Dan

On Thu, Oct 17, 2019 at 9:35 AM Akanksha  wrote:

> Hello, I am trying to convert Android.mk to Android.bp files here is a
> sample .mk module
>
> include $(CLEAR_VARS)
> LOCAL_MODULE:= location.pem
> LOCAL_MODULE_OWNER  := x
> LOCAL_MODULE_TAGS   := optional
> LOCAL_MODULE_CLASS  := ETC
> LOCAL_SRC_FILES :=
> ../../.././target/product/msmnile/vendor/etc/location.pem
> LOCAL_MODULE_PATH   := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)/etc
> include $(BUILD_PREBUILT)
>
> when i Convert this to
>
> prebuilt_etc {
> name: "location.pem",
> owner: "x",
>
> src: "../../.././target/product/msmnile/vendor/etc/location.pem",
> proprietary: true,
>
> }  it works fine but when included sub_dir inplace of LOCAL_MODULE_PATH I
> am getting "sub_dir " unrecognized property
>
> How to change LOCAL_MODULE_PATH module descriptor in Android.bp,
> Thanks in advance:)
>
> --
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to android-building@googlegroups.com
> To unsubscribe from this group, send email to
> android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-building/051f8105-57ee-4f3a-aabe-3359dec9142d%40googlegroups.com
> 
> .
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to android-building@googlegroups.com
To unsubscribe from this group, send email to
android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/CALQgHdnaa9XvJphVbXE9F4Zxr3U7YAZemA26_DUCr4V8czvnZQ%40mail.gmail.com.


[android-building] sub_dir unrecognized property

2019-10-17 Thread Akanksha
Hello, I am trying to convert Android.mk to Android.bp files here is a 
sample .mk module

include $(CLEAR_VARS)
LOCAL_MODULE:= location.pem
LOCAL_MODULE_OWNER  := x
LOCAL_MODULE_TAGS   := optional
LOCAL_MODULE_CLASS  := ETC
LOCAL_SRC_FILES := 
../../.././target/product/msmnile/vendor/etc/location.pem
LOCAL_MODULE_PATH   := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)/etc
include $(BUILD_PREBUILT)

when i Convert this to 

prebuilt_etc {
name: "location.pem",
owner: "x",

src: "../../.././target/product/msmnile/vendor/etc/location.pem",
proprietary: true,

}  it works fine but when included sub_dir inplace of LOCAL_MODULE_PATH I 
am getting "sub_dir " unrecognized property

How to change LOCAL_MODULE_PATH module descriptor in Android.bp, 
Thanks in advance:)

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to android-building@googlegroups.com
To unsubscribe from this group, send email to
android-building+unsubscr...@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-building+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/051f8105-57ee-4f3a-aabe-3359dec9142d%40googlegroups.com.