Commit graph

232 commits

Author SHA1 Message Date
Jooyung Han
344d5439c1 Add "apex_vndk" module type
"apex_vndk" is a variant of "apex" module.

apex_vndk {
  name: "com.android.vndk",
  ..
}

This rule is used to produce a VNDK APEX per vndk version.
It supports automatic inclusion of vndk libs.

If "vndk_version" property is set, the prebuilt vndk libs of
the version will be included in the apex bundle.

apex_vndk {
  name: "com.android.vndk.v29"
  vndk_version: "29",
  ...
}

Otherwise, platform's vndk version is used.

This will replace /system/{lib}/vndk-{ver} and vndk-sp-{ver}.

Bug: 134357236
Bug: 139772411
Test: m com.android.vndk
Change-Id: Ib5c86e625839389670d13c683a7427198ef6852f
2019-09-10 11:22:59 +09:00
Treehugger Robot
5afe2d6869 Merge "Support including apk inside an apex" 2019-09-05 23:43:33 +00:00
Nikita Ioffe
1acf6f9f6e Use PathForModuleOutput instead of PathForPhony
Later breaks some build flavours ¯\_(ツ)_/¯

Bug: 140467657
Test: soong_ui.bash --make-mode vts dist DIST_DIR=/tmp/dist-dir/ TARGET_PRODUCT=aosp_arm64 WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true BUILD_GOOGLE_VTS=true TARGET_BUILD_VARIANT=eng NATIVE_COVERAGE=true COVERAGE_PATHS="test/vts/hals/light" ENABLE_TREBLE=true
Change-Id: I0cb5754cb93551f2ed66d804f36019b037ccd871
2019-09-04 10:57:13 +00:00
Sundong Ahn
e1f05aaf44 Support including apk inside an apex
New property "apps" is added to APEX soong module. This property
configure a list of APKs to package inside APEX payload. For each
android_app module package it's APK into /app/$(android_app module Name)
directory.

Bug: 139906763
Test: m -j
Change-Id: Ic6655f211951af08097c76e157a07ebc52425718
2019-09-04 12:10:00 +09:00
Nikita Ioffe
5d5ae761c5 apex.go: Add support for diffing content of APEX with whitelist file
So far a very basic version.

In case there is a diff, soong will emit an error message with a command
to resolve the diff. Example:

New unexpected files were added to com.android.apex.cts.shim.v3. To fix the build run following command:
system/apex/tools/update_whitelist.sh system/apex/shim/build/default_shim_whitelist.txt out/soong/.intermediates/system/apex/shim/build/com.android.apex.cts.shim.v3/android_common_com.android.apex.cts.shim.v3/com.android.apex.cts.shim.v3-content.txt

Test: m checkbuild
Bug: 139125405
Change-Id: I57e694f394c56105dc7363a684983605c7bf5e7d
2019-09-02 17:55:21 +01:00
Roland Levillain
af93360ef9 Merge changes from topic "check-flattened-art-apex"
* changes:
  Add an output file type for flattened APEXes.
  Allow modules to be enabled/disabled depending on whether APEXes are flattened.
2019-08-29 15:17:29 +00:00
Jaewoong Jung
7ca5576905 Merge changes Ife12ba69,Ibf910262
* changes:
  Implement android_test_import
  AndroidMkEntries minor refactoring.
2019-08-29 00:55:14 +00:00
Jooyung Han
a9caf47ea2 Merge "soong: Add tests for depending on disabled module" 2019-08-28 23:58:33 +00:00
Jaewoong Jung
e0dc8dfd22 AndroidMkEntries minor refactoring.
This includes a few changes that make AndroidMkEntries more resemble
AndroidMkData, especially in terms of how extra entries are added.
Most importantly it can now have multiple custom functions.

Test: Soong tests
Change-Id: Ibf9102624d16d0c1c9894a2794fc7c797bb34c9a
2019-08-28 13:07:03 -07:00
Treehugger Robot
21738f6032 Merge "Remove hashtree from builtin APEXes" 2019-08-28 14:18:21 +00:00
Jooyung Han
e65ed7cd67 Remove hashtree from builtin APEXes
Builtin APEXes (/system, ...) don't need hashtree.
So if we remove hashtree from builtin APEXes we can save more space in
/system.

However, this change only affects to the apex bundles which are built
from source, not from prebuilts.
Removing hashtree from prebuilts will be handled in a follow CL.

Bug: 139957269
Test: m
Test: see if /system/apex/*.apex have hashtree
Change-Id: Id755382b2153bf6bbaf2c480f3bbb91b6f62a564
2019-08-28 17:27:27 +09:00
Roland Levillain
935639d70f Add an output file type for flattened APEXes.
Allow modules to depend on the flattened flavor of an APEX package
using `module.{flattened}` (returning the output install path of the
flattened APEX).

Also add this flattened output install path as an implicit output
dependency of a flattened APEX phony module.

Test: m checkbuild
Bug: 139277987
Change-Id: I8c55d5ff2922a36fcc8ec0819fbe3e93a772ef8a
Merged-In: I8c55d5ff2922a36fcc8ec0819fbe3e93a772ef8a
2019-08-27 14:26:18 +01:00
Sundong Ahn
2db7f46d0c Add no_apex check for static library
If no_apex module is static library, this module is not included to
filesInfo. So add a check tat the static library is no_apex among
indirect dependencies.

Bug: 139016109
Test: m -j
Change-Id: I46ddf099715aea0e088027a1141e282969cef0e1
2019-08-27 19:06:49 +09:00
Jooyung Han
d48f3c3885 soong: Add tests for depending on disabled module
This will check if direct deps of android.Module type is "Enabled()".
Previously, this is checked only if a module calls VisitDeps*()
functions in GenerateAndroidBuildActions().

Most modules call VisitDeps*() in GenerateAndroidBuildActions(),
but some modules don't. For example, "apex" module calls
WalkDepsBlueprint() or VisitDirectDepsBlueprint() since it
exceptionally depends on non-android.Module modules.

Therefore, when an apex module depends on disabled(enabled:false) module,
build fails with panic, which is fixed by this change.

Test: m # runs soong tests
Change-Id: I81c5c148bbd51a253d2904690eb76ae7b6df1a0f
2019-08-26 13:19:42 +00:00
Treehugger Robot
fb7e0b3aa2 Merge "Add no_apex property" 2019-08-23 04:00:38 +00:00
Jiyong Park
4f7dd9b4db Add no_apex property
This change adds 'no_apex' property which, when set to true, prevents
the module from being installed to any APEX. If the module is included
either directly or transitively in an APEX, but build fails.

Bug: 139016109
Test: m

Change-Id: If1478aa9660a3442f7dd1ffe45e4ca5611a6acbe
2019-08-22 20:37:07 +09:00
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
Colin Cross
59037628f4 Add GenerateAndroidBuildActions to DefaultsModuleBase
Add an empty GenerateAndroidBuildActiosn to DefaultsModuleBase
so that every defaults module doesn't need to provide one.  This
will also allow adding an implementation in the next patch.

Test: m checkbuild
Change-Id: I13554bdb3a287c2f18e1efab74d4f08a1ba8620c
2019-06-10 13:51:17 -07:00
Colin Cross
0ea8ba82fc Consolidate baseContext, BaseContext, and BaseModuleContext
blueprint.BaseModuleContext is the set of methods available to all
module-specific calls (GenerateBuildActions or mutators).  The
android package split the same functionality across baseContext (nee
androidBaseContext), BaseModuleContext, and BaseContext.
Consolidate all of them into android.BaseModuleContext.

Test: m checkbuild
Change-Id: I2d7f5c56fd4424032cb93edff6dc730ff33e4f1e
2019-06-06 20:01:31 -07:00
Treehugger Robot
b4c35f3378 Merge "Support tagged module references" 2019-06-05 17:17:32 +00:00
Colin Cross
41955e8895 Support tagged module references
There are cases where a module needs to refer to an intermediate
output of another module instead of its final output.  For example,
a module may want to use the .jar containing .class files from
another module whose final output is a .jar containing classes.dex
files.  Support a new ":module{.tag}" format in any property that
is annotated with `android:"path"`, which will query the target
module for its ".tag" output(s).

Test: path_properties_test.go, paths_test.go
Test: no unexpected changes in build.ninja
Change-Id: Icd3c9b0d83ff125771767c04046fcffb9fc3f65a
2019-06-04 10:22:51 -07:00
Yi Kong
e7fe9913d6 Clean up no_libgcc
no_libgcc is no longer needed anywhere. Move all occurances to no_libcrt
and remove no_libgcc.

Test: build
Change-Id: I6dd49db71d05d7685aa90cc837627f65e6742d6d
2019-06-03 15:52:40 -07:00
Peter Collingbourne
3478bb2a7f Teach soong not to duplicate the HWASAN runtime into each APEX.
When HWASAN is enabled, the runtime is conceptually part of Bionic (and
mutually depends on it), so it needs to be treated in the same way as the
Bionic libs.

Now there are only two copies of the runtime: the one in
/system/lib64/bootstrap (which won't be used by ordinary processes) and the
one in the runtime APEX.

This reduces the size of the HWASAN system image and fixes an issue where
multiple copies of the HWASAN runtime were being loaded into 64-bit binaries in
APEXes because the linker namespace for the binary is different from the one
for its dependent libraries outside of APEXes. HWASAN only supports loading
one copy of the runtime per process, so this was causing such binaries to
crash on startup.

Change-Id: I228896e193a035e6dfba9f6e28d0b2e12fc163ea
2019-05-17 10:00:39 -07:00
Yi Kong
acee27cd72 Strip libgcc to only keep fallback symbols
We use libgcc as fallback for symbols not present in libclang_rt
builtins, however we didn't know what exact symbols were being used,
some may not be intended to fallback.

Create libgcc_stripped, which only contains unwind symbols from libgcc.

Bug: 29275768
Test: bionic-unit-tests
Change-Id: I5b349fa6138e51663bf3b67109b880b4356da8e8
2019-04-30 10:07:00 -07:00
Treehugger Robot
1341942d86 Merge "Prebuilt APEXes are recoreded in apexkeys.txt" 2019-04-30 03:14:01 +00:00
Jiyong Park
4d27704da0 Prebuilt APEXes are recoreded in apexkeys.txt
apexkeys.txt now correctly lists prebuilt APEXes with keys specified as
PRESIGNED.

This change also fixes a bug that non-installable APEXes are listed in
the file.

Bug: 131130235
Test: m out/soong/apexkeys.txt and check that
com.android.apex.cts.shim.apex is listed there with PRESIGNED keys.

Merged-In: Ib6d391a82864714743a1cc59cd655bea917b5073
Change-Id: Ib6d391a82864714743a1cc59cd655bea917b5073
(cherry picked from commit a41f12a6fa)
2019-04-29 09:21:23 +09:00
Logan Chien
41eabe63e8 Support opt-in ABI checks
This commit allows a module to opt in for ABI checks even when it is
not an LLNDK/VNDK module.

Bug: 131421213
Test: Add `header_abi_checker { enabled: true, }` to some module
Change-Id: Ie09d262e651cbb44d7d0eba652f55dc1e1e52962
2019-04-27 01:55:50 +08:00
Jiyong Park
71b519d6ce Set default target SDK version for APEX
Target SDK version is used for targeting an APEX to a specific set of
platform builds. Usually, the targeting is unrestricted (in case the
APEX can run on all platforms), or based on platform SDK version (e.g.
28 for P). However, when the platform is under development and SDK is
not finalized, the targeting should be much more fine-grained; the
APEX should be targeted to a very specific build that supports the same
set of APIs that the APEX was built against.

To support that, target sdk version is automatically set by the build
system. When the platform is released or SDK is finalized, the target sdk
version set to the SDK version number. If not, it is set to
<version_code>.<fingerprint> (e.g., Q.123456).
Note that the target sdk version set by the build system is used only
when the target sdk version is not explicitly set in
AndroidManifest.xml.

Bug: 130541924
Test: UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true \
UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true \
TARGET_BUILD_APPS=com.android.tzdata m
build.ninja has --target_sdk_version Q.$$(cat out/soong/api_fingerprint.txt)

Test: aapt dump badging out/dist/com.android.tzdata.apex | grep \
targetSdkVersion shows:
targetSdkVersion:'Q.6ee443d9ad5f0cca7a43cfa97b7fc62a'

Change-Id: I086230d787f01075c28fc3f0163550300fa00212
2019-04-19 14:45:41 +09:00
dimitry
f807167023 Make apex_key HostAndDeviceDefault
Since apex_key is used in number of apex_test host_supported modules it
is no longer a device only module.

Test: add new device target and check that the build does not fail
Change-Id: I6402e3b622d22ee0ca0e6af71dfd71a690938e49
2019-04-12 09:26:00 +00:00
Dan Willemsen
412160e1c9 Stop using build/target -> build/make/target symlink
Instead, fully specify build/make/target/... everywhere

Test: treehugger
Change-Id: I07ba0e9b0604919a271afd5133070616e1f404fc
2019-04-09 21:36:26 -07:00
Nikita Ioffe
89ecd590ea Make prebuilt_apex be usable via :modulename syntax
Test: m
Bug: 127789981
Bug: 128677967
Change-Id: Ie1a1147c1d5570cd7eda48e274faabf95566d53f
2019-04-06 16:57:57 +01:00
Nikita Ioffe
7a41ebdf5f Add filename property to prebuilt_apex
* Makes it more inline with prebuilt_etc;
* For shim apexes, prebuilt_apex modules have pattern of
  com.android.apex.cts.shim.v1_prebuilt, but I would prefer
  pre-installed shim to be: /system/apex/com.android.apex.cts.shim.apex

Bug: 128677967
Bug: 127789981
Test: m
Change-Id: I34e3e078733420b5cf777fd6e3ce4d8c5796b19b
2019-04-06 11:39:22 +01:00
Nikita Ioffe
dd53e8be18 Add installable property for prebuilt_apex
In case of shim apexes, we prebuilt all of them, but only need to
install v1 to a system partition.

Bug: 128677967
Test: manually checked that non-installable prebuilts don't end in /system
Change-Id: I112432abfd8f03cc7d7379ea3cab3f5491ace49c
2019-04-05 22:07:10 +01:00
Colin Cross
cc0ce80ed5 Fix package path of android/soong/android pctx
android/soong/common was renamed to android/soong/android long
ago, but the pctx package path was still "android/soong/common".
This required all users of rules defined in android/soong/android
to import "android/soong/android" and then
pctx.Import("android/soong/common").

Test: m checkbuild
Change-Id: I20d096522760538f7cfc2bec3d4bfeba99b275d4
2019-04-04 03:59:34 +00:00
Jiyong Park
c320e8262a Key property is removed from prebuilt_apex
The property is not needed as key is embedded in the apex.

Bug: 128344735
Test: m
Change-Id: Iae671994fc271593dd9319f6262279736ea34ad1
2019-04-01 19:25:08 +09:00
Jiyong Park
42cca6c951 Always bundle the public key for APEX
The public key associated with an APEX is always included in the APEX.

Obviously, the public keys are no longer installed to
/system/etc/security/apex

Bug: 128344735
Test: m
Change-Id: I1e1aef1d32597a447b57d49ab80bbfb921fa8178
2019-04-01 19:24:31 +09:00
Jiyong Park
c95714ed0d Arch-specific source for prebuilt_apex
Arch-specific source can be specified for prebuilt_apex as follows.

arch: {
    arm64: {
        src: "myapex-arm64.apex",
    },
},

A note on the implementation. The Src property was not tagged as
`android:"arch_variant"` as usual. Instead, multiple Src properties are
explicitly declared like

struct Arch {
    struct Arm {
        struct Src *string
    }
    ...
}

Corresponding Src property is manually selected according to the
MultiTargets()[0].

This is because prebuilt_apex is mutated only for android_common, in
order to have the same arch variant with the apex module type.
Therefore, we can't rely on the arch_variant tag.

Bug: 127789981
Test: m (apex_test amended)

Change-Id: I77dbe626171d8975f549bdb4af3c487232cf05f7
2019-03-30 14:11:37 +09:00
Jaewoong Jung
939ebd5f33 Add prebuilt_apex.
Bug: 127789981
Test: apex_test.go + com.android.tzdata.apex
Change-Id: I09bb0a4b2acf310c55c789569da3c9d755638232
2019-03-28 15:56:22 -07:00
Jiyong Park
6788256d09 :module syntax support properties in apex_key
public_key and private_key properties support :module syntax so that the
key pairs can be dynamically created during the build, which is useful
for one-time keys.

Bug: 128960614
Test: m (apex_test amended)

Change-Id: I249b1d29f247784193b0d733a7b6a20274ece105
2019-03-22 11:41:09 +09:00
Jiyong Park
52818fcde8 Notice support for APEX
Notice file for an APEX is created by merging notice files for the
modules included in it (plus the notice file for the APEX itself if
specified).

Notice files having the same content are not duplicated; it is emitted
only once.

Bug: 128701495
Test: m (apex_test is amended)
Test: m and inspect $(PRODUCT_OUT)/obj/NOTICE.txt to check there are
license entries for /system/apex/*.apex files

Change-Id: I169d91038291a6c71615de97cf5b03174afab5d4
2019-03-21 08:05:50 +09:00
Colin Cross
8a49795df1 Replace ctx.ExpandSources with android.PathsForModuleSrc
Move the logic from ctx.ExpandSources into android.PathsForModuleSrc
and ctx.ExpandSource into android.PathForModuleSrc, and deprecate
them.  When combined with the pathDepsMutator this will let all
properties that take source paths also take filegroups or genrule
outputs, as long as they are tagged with `android:"path"`.

Test: All soong tests
Change-Id: I01625e76b5da19240e9649bf26a014eeeafcab8f
2019-03-20 19:36:13 +00:00
Jiyong Park
05e70ddc60 Fix the symbol file paths for files in APEXes
This change fixes the problem that symbol files for APEXes are installed to
incorrect path when TARGET_FLATTEN_APEX is set to true or the canonical
name of an APEX is different fro the module name of the APEX.

For the case when TARGET_FLATTEN_APEX is true, LOCAL_SOONG_SYMBOL_PATH
is set to point to the runtime path of a file (e.g. /apex/<name>/*).

For the case of the different canonical and module names, apex_name
property is added to explicitly specify the canonical name

Bug: 120846816
Test: m and inspect that symbol files exist under
$(PRODUCT_OUT)/symbols/apex/com.android.runtime/

Change-Id: Idfec88d6a30a18c225b0d87b868b9f1e0a617e38
2019-03-20 11:55:04 +09:00
Jiyong Park
bd13e44610 respect relative_install_path for binaries in APEXes
Bug: 123721777
Test: m (apex_test.go has the test)
Change-Id: I89bc83d4bc6fe8dc374cf36e06e795c75b290844
2019-03-18 14:49:21 +09:00
Jiyong Park
d1e293d11e product_specific support for apex_key
apex_key, when with product_specific: true, is installed to
/product/etc/security/apex.

Bug: 128519063
Test: m (apex_test.go amended)
Change-Id: I39e8ac1c486c734dfe0555cd1874468d75e71f34
2019-03-15 02:15:39 +09:00
Colin Cross
27b922f53e Annotate paths and deprecate ExtractSource(s)Deps
Add `android:"path"` to all properties that take paths to source
files, and remove the calls to ExtractSource(s)Deps, the
pathsDepsMutator will add the necessary SourceDepTag dependency.

Test: All soong tests
Change-Id: I488ba1a5d680aaa50b04fc38acf693e23c6d4d6d
2019-03-07 18:36:35 +00:00
Alex Light
778127a041 Add support for including py_binary and *_go_binary in apexs
These additional binary types are useful for some apexs. Add the
ability to include them. Due to the nature of the resulting artifacts
only py binaries with embedded launchers and host go binaries are
supported.

Test: m com.android.support.apexer
Bug: 119332365
Bug: 119332362
Change-Id: I27c253d3647cf7bbe15896610d7a74a5f93e8bec
2019-03-01 01:56:14 +00:00
Jaewoong Jung
acb6db331b Revert "Add override_module."
This reverts commit aa65e17016.

Reason for revert: Not compatible with PRODUCT_PACKAGES, and so has very limited use.

Change-Id: Ib141d3984a6f12bb50989e66037494c466b066f1
2019-02-28 16:22:30 +00:00
Jaewoong Jung
aa65e17016 Add override_module.
This new module type replaces the inherit-package function in make by
allowing developers to override the name, the certificate, and the
manifest package name of an android_app module.

Bug: 122957760
Fixes: 123640028
Test: app_test.go + BrowserGoogle
Change-Id: Iefe447e7078b25039233221361ef95c83a29973a
2019-02-27 14:35:39 -08:00
Alex Light
f4857cf3dd Include symlinks in flattened apexs
Flattened apexs were not including symlinks. This could cause expected
files not to be present.

Test: lunch aosp_marlin-userdebug
      m droid
      stat $OUT/system/apex/com.android.runtime.debug/bin/dalvikvm
Bug: 124924906

Change-Id: I04e696602b776b383bf7198eb19220353df74192
2019-02-25 10:14:55 -08:00
Alex Light
49ae3d9819 Don't use stubs for host apexs
Host apexs don't have a system-image associated with them so we need
to include all libraries, including those with stubs.

Test: ./art/test/testrunner/run_build_test_target.py -j50 art-linux-bionic-x64-zipapex
Bug: 125417922
Change-Id: Ie76e6a34e8be1057b29e2e005597c3e4b5fb1f9c
2019-02-21 14:02:46 -08:00
Treehugger Robot
1455d47788 Merge "Install external deps of an APEX" 2019-02-21 00:02:08 +00:00