Commit graph

99 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Jiyong Park
ac2bacd418 Install external deps of an APEX
By default, if a lib is included in an APEX, all its direct and indirect
dependencies are also included in the same APEX. However, when one of
the dependencies have stable API (i.e. has stubs: {...}) then the lib
having stable API and its dependencies are not included in the APEX.

However, the problem here is that the lib having stable API might not be
installed on the system, thus causing error at runtime. This can happen
if there is no other module in the platform that depends on the lib.

This change fixes the problem by adding such libraries as external
dependencies so that they are also installed on the device along with
the APEXes using them.

Bug: 124831003
Test: m installclean; m com.android.resolv
libbinder_ndk, libvndksupport are found under system/lib

Change-Id: I457e03ff3fce37e0890c64d911e6e0ea6d0c6dd6
2019-02-20 22:02:22 +09:00
Jiyong Park
0ca3ce867c build apexkeys.txt
apexkeys.txt is a text file having APEX-to-keys mappings. The file is
included in the target-files package where it is used when re-sign the
APEXes with release keys.

Each line of the file consists of 5 fields:
1) name: file name of the APEX
2) public_key: the public key for the apex_payload.img of the APEX
3) private_key: the private key used to sign the apex_payload.img
4) container_certificate: the certificate used to sign the APEX zip
container
5) container_private_key: the private key used to sign the APEX zip
container

Bug: 124406181
Test: m out/soong/apexkeys.txt and inspect the content
Test: TARGET_BUILD_APPS=com.android.tzdata m dist and make sure
out/dist/apexkeys.txt exists
Change-Id: I1daa13ec50956323b97e15e8df7f1fbe5ea21d63
2019-02-19 14:13:36 +09:00
Jiyong Park
809bb724f5 Add ":name" support for manifest and androidManifest properties in apex
The manifest and androidManifest properties in the apex module type now
supports ":name" syntax.

Bug: 123857186
Test: m (apex_test amended)
Change-Id: Ic4e5a73cf73260d156ec61d07932ad07b2561413
2019-02-14 15:28:58 +09:00
Jiyong Park
f97782b18c Remove prefer_sanitize.* properties
The properties are no longer required as an APEX module is mutated with
required sanitizers which are gathered by scanning the sanitizers that
are enabled for its direct dependencies.

Bug: 124128094
Test: m on marlin
The extractor libs are found under /system/apex/com.android.media

Merged-In: I55961d400dcbac067a5c0dcecb90e399d4991a70
Change-Id: I55961d400dcbac067a5c0dcecb90e399d4991a70
(cherry picked from commit abda0eb76b)
2019-02-14 12:30:49 +09:00
Alex Light
f1801bc0a5 Ensure that make doesn't flatten zipapex files.
Zip apex files are not really installed so should not ever be
flattened. Unfortunately we didn't send this information to make which
would still unzip everything.

Test: ALLOW_MISSING_DEPENDENCIES=true
      ./art/tools/build_linux_bionic_tests.sh com.android.runtime.host
Bug: 124333446

Change-Id: I3eda579f8c40f768f1ef2be867967f436396cd4c
2019-02-13 19:14:15 +00:00
Jiyong Park
b2742fdec9 APEX certificates can be overriden by PRODUCT_CERTIFICATE_OVERRIDES
Test: m (apex_test amended)
Change-Id: I9b66a250c9ca20ad754e12455de2b444cf19b1fa
2019-02-13 19:22:43 +09:00
Jiyong Park
40e26a2a99 Allow each APEX to provide its own AndroidManifest
AndroidManifest.xml file can be specified via the 'androidManifest'
property in the apex module type. It can be used to have a custom
AndroidManifest.xml that have additional tags (such as <uses-sdk> or
<uses-feature>) for precise targeting.

The property is optional; if unspecified, then one is auto-generated as
before.

Bug: 123857186
Test: m apex_test_build_features
Change-Id: Id7ee0471661887cfa11124cbaa3beea8cffcdda4
2019-02-13 16:24:59 +09:00
Alex Light
2a2561f8ac Always build zipapex's unflattened.
Zipapex's cannot be flattened so do not prevent them from being built
even if TARGET_FLATTEN_APEX is set.

Test: lunch aosp_arm-eng;
      ALLOW_MISSING_DEPENDENCIES=true \
      ./art/tools/build_linux_bionic.sh com.android.runtime.host

Bug: 124333446
Change-Id: I4bef65cce100136a8f7852692e841b62ed9e399f
2019-02-12 17:04:47 -08:00
Jiyong Park
235e67c281 Add prefer_sanitize.* properties to apex
It is used to configure an apex to prefere specific sanitizer variants
if available. For example, if a lib is with sanitize: {cfi: true} then
an APEX with prefer_sanitize: {cfi: true} will use the sanitized variant
of the lib.

Bug: 124128094
Test: m on marlin
extractor libraries are found under /system/apex/com.android.media

Change-Id: I858778eef78c5791cdeb497c7c11688cb128b5fe
2019-02-09 12:07:08 +09:00
Alex Light
0851b88eaf Add support for test_apex
Some test and other miscallaneous use-cases need apexs that are
installable but will not affect the installation of other artifacts
onto the device. For this purpose we added a test_apex type. These
test_apex targets create apex files and have all the normal attributes
but are not considered the source of any of their contents for the
device by the rest of the build-system.

Test: build and boot
Test: ALLOW_MISSING_DEPENDENCIES=true \
      DIST_DIR=$ANDROID_BUILD_TOP/out/dist \
      ./art/tools/dist_linux_bionic.sh -j72 showcommands com.android.runtime.host
Bug: 123591866
Bug: 123892969

Change-Id: I7f50be0ac0425cd87868145e18bcee6962d472ef
2019-02-07 16:52:20 -08:00
Jiyong Park
30ca9379e6 add apex_defaults
apex_defaults is the default module for apex.

Bug: 124026431
Test: m (apex_test updated)
Change-Id: I09f63046e909e8eeb52ecec6bb07eb51e5490561
2019-02-08 02:55:28 +09:00
Alex Light
f98087ffce Don't remove non-installable apex deps from the system install
We were marking any libraries included in any apex (including
non-installable apex's like com.android.runtime.host) as
uninstallable. This could cause phones to become unbootable if these
apex's are modified.

Bug: 123892969
Test: m droid && boot device.
Change-Id: Ief9004bbe7b106ee8f52715ce5bd7bb5accec290
2019-02-07 17:05:45 +00:00
Jiyong Park
41229f584a Fix: TARGET_FLATTEN_APEX=true does not install any files to /system/apex
94427265d1 broke the flattened APEX
by not updating moduleNames

Test: TARGET_FLATTEN_APEX=true m
Files are under /system/apex

Change-Id: I14b1a6f8b2244d35e1accdf9888cfef65f4b0a03
2019-02-07 16:48:04 +09:00
Jiyong Park
04480cf35b sh_binary can be included in APEX
Bug: 123891899
Test: m (apex_test amended)

Change-Id: Idebe577b20019fe9cd0fb6617f3b8c52a5b87714
2019-02-06 23:09:30 +09:00
Jiyong Park
94427265d1 Don't emit make rules for APEX files for non-installable APEX
When an APEX is non-installable, the make rules for the APEX files in
the APEX are not emitted as they will never get installed.

androidMkForType() is refactored so that make rules for the APEX files
are created in a separate function androidMkForFiles().

Test: m checkbuild tests
Bug: 123290268
Change-Id: Ibe8817d1e9c6312fb5c6f986dced8aa3e823664a
2019-02-06 22:40:29 +09:00
Jiyong Park
23c52b0eb8 :module syntax is supported for APEX even when TARGET_FLATTEN_APEX
Build rules for both flattened and non-flattend APEXes are created
regardless of TARGET_FLATTEN_APEX. The selection is made in AndroidMk.
This allows other module to reference an APEX via :module syntax
irrespective of TARGET_FLATTEN_APEX.

Bug: 123780484
Test: TARGET_FLATTEN_APEX=true m out/soong/.intermediates/art/build/apex/art-check-debug-apex-gen/gen/art-check-debug-apex-gen.dummy
with aosp/891696 applied
Change-Id: Ia49415ec3d18cfc5081461be76900c73ea803dca
2019-02-06 09:24:39 +09:00
Jiyong Park
b7c24df220 APEX respects relative_install_path
relative_install_path for cc_library is respected by APEX.

relative_install_path for cc_binary is not yet respected because doing
it will break the path to the dynamic linker in the runtime APEX.
That change should be done along with changes in init, bionic, etc.

Bug: 123721777
Test: m (apex_test.go amended)
Change-Id: I855f8eda0d4255d563861ac96d0d3e2c669e9a2a
2019-02-05 21:00:41 +09:00
Alex Light
fc0bd7c15b Give a knob to have apex ignore system-lib special cases
apex will normally place libc and some other system libraries into a
separate directory. This is to ensure that early startup works
correctly. Some apex targets want to have these libraries at the
normal places however.

Test: ./art/tools/build_linux_bionic.sh com.android.runtime.host
Bug: 123591866
Bug: 120266448
Change-Id: Ib5a67a43fe3eea6188b4df9215e743f1634045f3
2019-01-31 10:53:02 -08:00