Commit graph

166 commits

Author SHA1 Message Date
Jooyung Han
9c80baeccf apex: add llndk libs as requireNativeLibs
"use_vendor: true" APEX modules may bundle vendor variants of cc
modules, which can depend on llndk stubs.

In that case, those llndk libraries should be also counted as required
libraries. (stored in 'requireNativeLibs' key in apex_manifest.json)

Bug: 138695532
Test: m nothing (runs soong tests)
Change-Id: If7ad4dec0e723c8d0c73ca60453b555063e14694
2019-08-20 17:30:57 +09:00
Treehugger Robot
dcea882ef9 Merge "Build native coverage variant of APEXes when needed" 2019-08-15 00:08:59 +00:00
Treehugger Robot
f02f30952d Merge "java_import can be included in apex" 2019-08-13 04:18:29 +00:00
Jiyong Park
9e6c242856 java_import can be included in apex
java_import can be included in apex via 'java_libs' property.

Bug: 139175488
Test: m (apex_test.go updated)
Change-Id: I3680a47cdac93b0cb2d41da8df3f8defa2bbe670
2019-08-13 09:36:39 +09:00
Jiyong Park
ee9a98d88e Build native coverage variant of APEXes when needed
When the native coverage is enabled, APEXes (and files there) are built
for native coverage as well.

Bug: 138952487
Test: make -j NATIVE_COVERAGE=true COVERAGE_PATHS='*' com.android.resolv
find out -name "*.gcno" | grep DnsResolver shows files

Test: libnetd_resolv.zip is found under
$(TARGET_OUT)/apex/com.android.resolv/lib directory

Change-Id: I97bcee9bf8ffc0dc71453abbdb613ed56ea2cdb4
2019-08-13 08:55:08 +09:00
Jooyung Han
d363955938 Soong: Add test for apex
This test checks if "runtime_libs" dep of "cc_library" is respected.

Test: m (run soong tests)

Change-Id: I4b81fc548761be9b284d15c61c62718df72d409f
2019-08-09 12:59:09 +09:00
Jooyung Han
07149d36aa Add TEST_MAPPING for build/soong/apex
build/soong/apex is highly coupled with system/apex.
So it is reasonable to "import" presubmit tests from system/apex.

Test: atest --test-mapping build/soong/apex
Bug: 138984456
Change-Id: I7447e04a63b86486daef0f2a7642842101c0029f
2019-08-07 17:33:24 +09:00
Treehugger Robot
d62b4af8b7 Merge changes from topic "put-dep-in-apex"
* changes:
  Add jsonmodify tool
  Put dependency in apex_manifest.json
2019-08-06 00:21:11 +00:00
Kun Niu
a535be6012 Merge "Build module from source branch instead of using prebuilds when coverage is enabled." 2019-08-05 18:04:49 +00:00
Kun Niu
10c9f83f26 Build module from source branch instead of using prebuilds when coverage is enabled.
Test: successfully get coverage data from coverage build.
Bug: 137865099
Change-Id: I7df96c2b2c2ec2859393fb2c19ffe1081d112c96
2019-08-02 10:13:46 -07:00
Jooyung Han
e16330393a Put dependency in apex_manifest.json
To generate ld.config.txt dynamically(b/123722631), each APEX should
provide some dependency information:
a) list of libraries which other APEXes(or system) can use from this apex
b) list of libraries which this apex uses from other APEXes(or system)

This change puts dependency information in apex_manifest.json at
build-time with two additional keys:
a) provideNativeLibs
b) requireNativeLibs

Bug: 138695532
Test: m (runs soong tests)
Test: find $OUT/apex -name apex_manifest.json  -exec cat {} \;
 (shows contents of apex_manifest.json files)

Change-Id: Iaad12c8c35454222ad177ce923cce76ef12a8a5a
2019-08-01 23:45:37 +09:00
Roland Levillain
ec5fc70856 Merge "Materialize the copy commands of an APEX rule as a Ninja response file." 2019-08-01 13:51:22 +00:00
Roland Levillain
96cf4d4646 Materialize the copy commands of an APEX rule as a Ninja response file.
For some APEX packages (i.e. the Runtime Testing APEX), the set of
files to copy can be so large that the copy commands (which are part
of the Ninja shell command executed for an APEX package) may exceed
the maximum length of argument to the exec() functions (ARG_MAX). To
work around this limitation, record these copy commands in a Ninja
response file (rspfile) and `source` this file in the Ninja command to
execute them.

Test: m nothing (`apex/apex_test.go` amended)
Test: m com.android.runtime.testing (with CL https://android-review.googlesource.com/c/platform/art/+/1008034/ cherry-picked)
Bug: 129534335
Change-Id: I09ff2d9cf66bfd4cbc12cb724a45d455d08da0b2
2019-07-31 17:22:00 +01:00
Roland Levillain
4644b22b75 Fix some typos in error messages in apex/apex.go.
Test: m
Change-Id: Iee54bd0e2e0d6651d82b7fbae246f20643e49ceb
2019-07-31 14:09:17 +01:00
Treehugger Robot
a822256e15 Merge "Delete prebuilt APEXes when installing source-built APEXes" 2019-07-31 07:03:49 +00:00
Jiyong Park
03b68ddd10 Delete prebuilt APEXes when installing source-built APEXes
To build the platform for ASAN, we do

`m && SANITIZE_TARGET='addresss' m`

However, at the end of the second build, the system partition could have
conflicting APEXes; prebuilt APEXes from the first build and
source-built APEXes from the second build. Since the file names for the
prebuilt and the source-built are different (e.g.
com.google.android.media.apex v.s. com.android.media.apex), we end up
having two files for the same APEX. This is confusing apexd at runtime
and the device fails to boot.

To fix this, when building a non-prebuilt APEX, the prebuilt APEX might
have been installed by the previous build is deleted.

Bug: 138146044
Test: lunch aosp_cf_x86_pasan; m && SANITIZE_TARGET='address' m
check that out/target/product/vsoc_x86/system/apex has
com.android.*.apex only.

Change-Id: Ib5a021a297cf0173ea5a3b50e9398b1cf295c558
2019-07-30 13:52:15 +09:00
Roland Levillain
f89cd0949c Handle test_per_src modules as indirect dependencies in APEXes.
In `apex.apexBundle.GenerateAndroidBuildActions`, we used to pass the
"all tests" ("") module as `module` for all `apexFile` objects created
from a test module using `test_per_src: true`.  An immediate issue of
this situation was that the "" module is hidden from Make, which made
all the generated `apexFile` objects hidden from Make too. This would
break the construction of flattened APEXes, as they rely on Make logic
to install their files.

Instead of collecting `test_per_src` test variations' output files in
`cc.Module.GenerateAndroidBuildActions` and using them in
`apex.apexBundle.GenerateAndroidBuildActions` as part of handling the
"" variation as a direct dependency of an `apexBundle`, process them
as indirect dependencies (and do nothing for the "" variation direct
dependency).

Adjust the indirect dependency logic in
`apex.apexBundle.GenerateAndroidBuildActions` to allow not only
shared/runtime native libraries as indirect dependencies of an
`apexBundle`, but also `test_per_src` tests.

Test: m (`apex/apex_test.go` amended)
Bug: 129534335
Change-Id: I845e0f0dd3a98d61d0b7118c5eaf61f3e5335724
2019-07-29 19:21:27 +01:00
Jiyong Park
7f7766d5ee Revert "Revert "Split Java libraries per apex""
This reverts commit f0f7ca8335.

Bug: 138182343
Test: apex_test added
Change-Id: I5c8a0935ac0f456137c8656815e220b0e7848a5d
2019-07-26 14:19:38 +09:00
Treehugger Robot
38b9f76d63 Merge "Revert "Split Java libraries per apex"" 2019-07-25 11:29:28 +00:00
Jiyong Park
f0f7ca8335 Revert "Split Java libraries per apex"
This reverts commit aa53324ac8.

Reason for revert: b/138337109 (broke ndk build)

Change-Id: I9497cb4337add3f8c491a684bcaadea3bdbfaa85
2019-07-25 04:38:02 +00:00
Treehugger Robot
8f7a3fc633 Merge "Split Java libraries per apex" 2019-07-24 23:15:22 +00:00
Roland Levillain
dfe75b389c Fix some typos in Soong.
Test: m
Change-Id: I5b332ce12d70f13eca93b23060620c0ea4f46db7
2019-07-23 17:29:57 +01:00
Jiyong Park
aa53324ac8 Split Java libraries per apex
Just like native libs, a java library that is included in an APEX is
mutated for the APEX. This allows us to infer the context (e.g.
sdk_version, etc.) for building a java library in an APEX.

Bug: 138182343
Test: apex_test added
Change-Id: I9292ea097b98e74a8a794f164bd2bed3921d6337
2019-07-23 20:32:14 +09:00
Treehugger Robot
c793ebf1ae Merge "Fix: symlink bin/arm directory is not handled correctly" 2019-07-23 00:53:25 +00:00
Jiyong Park
c80b5fa0c6 Fix: symlink bin/arm directory is not handled correctly
This change fixes a bug that a symlink in the bin/* directory of an APEX
is not added to the fs_config file.

Bug: 137918291
Test: choosecombo aosp_x86_arm
TARGET_FLATTEN_APEX=false m com.android.runtime.debug is successful

Change-Id: Ib10b635f08e03b18e8ad5407d8de6bac2c85326d
2019-07-20 15:18:21 +09:00
Roland Levillain
9b5fde9ca4 Handle test_per_src test variations as dependencies of APEX modules.
If a test module with a `test_per_src` property set to `true` is
included in an APEX module, add all the variants for mutator
`test_per_src` as dependencies of the APEX module (not just the
first one).

This is done by adding variation "" of mutator `test_per_src` when
adding a test dependency to an APEX module, which creates an indirect
dependency of the APEX module on all the `test_per_src` variants of
the test module. When generating outputs for the APEX bundle, fetch
and include the set of test outputs from the "" variant.

Test: m (`apex/apex_test.go` amended)
Bug: 129534335
Change-Id: I1c99855971a8a9b2fc5b964a420e882b6791d4e6
2019-07-19 14:15:06 +01:00
Jaewoong Jung
6f67daa93c Merge "Add overrides property to prebuilt_apex" 2019-07-18 17:35:07 +00:00
Treehugger Robot
a0eb5a899f Merge "fix: APEX prebuilts are disabled in platform build" 2019-07-17 04:00:48 +00:00
Jaewoong Jung
22f7d18a5d Add overrides property to prebuilt_apex
Bug: 137218697
Test: apex_test.go
Change-Id: I55a42e1e4af60d6d7185515a380c786312b8b29b
2019-07-16 18:45:26 -07:00
Jiyong Park
ca8992ea0b fix: APEX prebuilts are disabled in platform build
This change fixes a bug that APEX prebuilts are auto-disabled in
platform builds (i.e. non-unbundled builds).

Bug: 137282010
Test: m com.android.conscrypt
check that the apex is from prebuilt directory

Merged-In: I935ef3896e80864bdcc1ca5f6fc12b63c9588c0d
(cherry picked from commit 895e224d8f)

Change-Id: I935ef3896e80864bdcc1ca5f6fc12b63c9588c0d
2019-07-17 08:34:03 +09:00
Dimitry Ivanov
2ca7a8835e Merge "Make relative path for native_bridge binaries configurable" 2019-07-16 09:17:35 +00:00
dimitry
8d6dde8831 Make relative path for native_bridge binaries configurable
This change introduces NativeBridgeRelativePath and
NativeBridgeSecondaryRelativePath product variables to
make relative path to native_bridge binaries configurable.

It also removes moves information about native bridge
host architecture to Target and sets it during decodeTargetProductVariables

Test: make PRODUCT-cf_x86_phone-userdebug dist
Change-Id: Ie736e81eae507e1775566ce9f29135011b12af27
2019-07-15 20:04:07 +02:00
Jiyong Park
e3ef3c8f0c Fix the unbundled mainline module build
This change fixes two problems:

1) the prebuilt apexes are force disabled for the unbundled builds
because we need to build the modules from the source then

2) the dependencies from an sdk_library module to
*.stubs.{public|system|tests} are not added for the unbundled build
because the stubs modules are disabled.

Bug: 137282010
Test: unbundled mainline builds are successful
Test: build com.android.media and inspect the jar file to see if
hiddenapi flags are there
$ cd out/dist/mainline_modules_arm
$ unzip com.android.media.apex apex_payload.img
$ mkdir -p mnt
$ sudo mount -o ro,loop apex_payload.img mnt
$ dexdump2 mnt/javalib/updatable-media.jar | grep hiddenapi
shows results

Change-Id: I2c00af07aac4a15770d3acab011a36e2e4803bfc
2019-07-15 17:20:05 +09:00
Jiyong Park
50b81e532b Don't use APEX prebuilts when asan is on
Some prebuilt APEXes are enabled with scudo, which causes crash on
devices with asan.

Bug: 137216042
Test: build walleye_hwasan and check if apexes are not from prebuilts
Merged-In: Ic436ad06e724af952d99fb8e66358a595450eb84
(cherry picked from commit 3b98a509f1)
Change-Id: Ic436ad06e724af952d99fb8e66358a595450eb84
2019-07-15 17:17:31 +09:00
Jiyong Park
2cb5288341 Don't use prebuilt_apex when TARGET_FLATTEN_APEX is set to true
When the device does not support non-flattened APEX (i.e.
TARGET_FLATTEN_APEX is set to true), then ignore the prebuilt_apex
modules even when `prefer: true`.

Bug: 136251130
Bug: 136662772
Test: build marlin, and check if /system/apex has flattened APEXes
Merged-In: I9f3dfefc3bd357d6750fbb1e418937d095720b04
(cherry picked from commit 0a573d798f)
Change-Id: I9f3dfefc3bd357d6750fbb1e418937d095720b04
2019-07-11 18:40:48 +09:00
Treehugger Robot
f378a85523 Merge "Use ctx.Target().NativeBridge to detect if the arch is translated or not" 2019-07-11 00:49:42 +00:00
Jaewoong Jung
3af8661af7 Merge "Improve android_app_import.dpi_variants handling." 2019-07-10 16:39:53 +00:00
Jiyong Park
acbf6c76c6 Use ctx.Target().NativeBridge to detect if the arch is translated or not
Bug: 137015854
Test: m
Test: build cf_x86_phone and ensure there is no dangling symlink
/system/lib/arm/libm.so

Change-Id: I0f5efdb9e1f5e4e213ca4ebaa28ace0a130b36a6
2019-07-10 18:07:38 +09:00
Jaewoong Jung
3e18b19442 Improve android_app_import.dpi_variants handling.
Instead of circumventing the limitation of Prebuilt implementation by
picking a source path itself, it now uses the same mechanism as
archMutator and replaces the source path in advance so that Prebuilt
always sees the corrent source path.

Because this requires the Apk field to be a string pointer, the single
source prebuilt implementation is being updated to be reflection-based.

Test: Soong unit tests, m soong_docs, TreeHugger
Change-Id: I2304f15e32d632f74f95f0d9e9bf1f75ff3e2225
2019-07-09 15:00:15 -07:00
Jooyung Han
5c998b9ff8 Add "provide_cpp_shared_libs/uses" props to "apex"
For APEXes to share C++ native libraries, we need a new kind of depedency
between APEXes: "providing" APEXes and "using" APEXes. To reflect this
dependency two new properties are added.

provide_cpp_shared_libs: bool
  this indicates that the current APEX module provides the native C++ shared
  libs to other APEXes.

uses: []string
  this indicates that the current APEX module uses the native C++ shared
  libraries from APEXes listed.

With these two, "using" APEXes can omit shared libraries in its APEX
bundle and use them from the "providing" APEXes.

Note that without corresponding changes in ld.config.txt, this won't
work.(The linker namespaces should be configured so that user APEX can
access provided libs.)

Bug: 136975105
Test: m nothing (this will trigger soong's test)
Change-Id: Iec6f9f67bcbde01145acc383f862ba21c8197536
2019-07-09 21:30:45 +09:00
Jaewoong Jung
b1907ee587 Merge "Dist NOTICE outputs for app targets." 2019-07-08 23:28:13 +00:00
Jaewoong Jung
9877279855 Dist NOTICE outputs for app targets.
Bug: 136501164
Test: m NetworkStack, TreeHugger
Change-Id: I2279eeb0e50b1b5685e23130a8da6ab090f37f56
2019-07-08 09:26:02 -07:00
Roland Levillain
630846d244 Add support for tests in APEX test modules.
Allow `tests` property in `apex_test` Soong modules.

Test: m (`apex/apex_test.go` amended)
Bug: 129534335
Change-Id: Ieeff7cf0980a7c394409632b6448102f59bceb3d
2019-07-05 19:01:18 +01:00
Jaewoong Jung
c1001ec0c5 Create test build dir only once for apex_test.
Test: apex_test.go
Change-Id: Ib96ea4ec5d5ff0d8e8cf4a9eb479099cf2b1977c
2019-06-25 11:20:53 -07:00
Jaewoong Jung
50c744e916 Merge changes from topic "apex_notice"
* changes:
  Embed NOTICE output as an APEX asset.
  Optionally embed NOTICE files in apks.
2019-06-25 16:41:16 +00:00
Jaewoong Jung
14f5ff62c9 Embed NOTICE output as an APEX asset.
Instead of outputting an aggregated NOTICE file as an intermediate build
resource to allow Make to include it in the final system-wide NOTICE,
process and embed it as an asset in the final APEX. This allows us to
update the NOTICE contents automatically when an APEX is updated.

Fixes: 135218846
Test: Built mainline modules, apex_test.go
Change-Id: Ic851b330fe93be1f602907d44ecc7886c3b0171b
2019-06-24 20:10:34 -07:00
Jaewoong Jung
5b425e2e20 Optionally embed NOTICE files in apks.
If embed_notices or ALWAYS_EMBED_NOTICES is set, collect NOTICE files
from all dependencies of the android_app, merge them with the app's own
one (if exists), transform it to HTML, gzip it, and put it as an asset
in the final APK output.

Bug: 135460391
Test: app_test.go
Change-Id: I52d92e2fd19b3f5f396100424665c5cc344190d8
2019-06-24 19:10:22 -07:00
Colin Cross
643614de24 Make apexMutator parallel
apexMutator only modifies the currently visited module, it can
visit modules in parallel.

Test: builds
Change-Id: I7d0ad142f5161742bd25dc57bac64c0f4a733ecf
2019-06-20 10:45:39 -07:00
Treehugger Robot
42d33779cd Merge changes If25be604,I0a310229,I44155630
* changes:
  Add another jar used by kotlinc
  Actually depend on the headers from renderscript
  Fix a few missing dependencies in APEX building
2019-06-13 17:40:01 +00:00
Dan Willemsen
dd651faac3 Fix a few missing dependencies in APEX building
I found these while trying to build an aosp_arm system image with RBE,
which only makes the sources that you depend on available to every rule.

The hardcoded prebuilts/sdk path is a bit unfortunate, but that's
currently hardcoded as a default in the script as well.

Bug: 130111713
Test: treehugger
Test: build a system image with RBE
Change-Id: I4415563017e053749788b0a537a48d61a2161935
2019-06-13 05:21:09 +00:00