Commit graph

98 commits

Author SHA1 Message Date
Yo Chiang
3ca4980d36 Auto-generate dexpreopt boot image module
Add prebuilt modules that installs bootjar dexpreopt files generated by
soong, for example `dexpreopt_bootjar.boot_arm64` installs .art / .oat /
.vdex, etc for the framework boot image ("boot") for primary arch
("arm64").

Bug: 159196136
Test: TH built artifacts noop
Test: Check device boot images are installed
Test: ./prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-aosp_arm64.ninja -t browse
Test: Check that generated dependency graph is sane
Test: Check that bootjar dexpreopt bits are listed in `m dump-files`
Change-Id: Ia30b37be9be972c5e28b5840923801ea7237a237
2020-07-14 15:49:08 +08:00
David Srbecky
6dd11eccc5 Install boot.art image for host as well (used by ART tests).
This will allow us to remove the core.art image compiled in make.

Test: m test-art-host-gtest
Bug: 147817558
Bug: 147819342
Change-Id: Ie17e5818ddeb200843b13d36ade6d1a5428a9a48
2020-02-27 21:04:49 +00:00
Calin Juravle
abdea2183d Add art dexpreopt to boot.zip archive
Test: m out/target/product/generic_arm64/boot.zip
Bug: 144491400
Change-Id: Id5f14efbbdf539f9f61599f2fbbc1a302334bb9a
2019-12-04 16:50:17 -08:00
Calin Juravle
cdff6b1451 Rename PRODUCT_USES_ART to PRODUCT_USES_DEFAULT_ART_CONFIG
It better describes what is meant to represent.

Test: m build
Change-Id: I942721cee2c7eaef625bf8c64aae32c1725705eb
2019-05-01 15:35:03 -07:00
Calin Juravle
6bfdcda0e6 Add the entire boot image to boot.zip
Add all the boot image files necessary of offline inspection and
compilation in a single zip file (boot.zip).

This replaces the previous boot_profiles_jars.zip which contained only the
jar files.

Bug: 130376456
Test: m dist

Change-Id: I25b0c03ee9e7a2c2ff25db406656ce79baff5a46
Merged-In: Ib71c4fcc0d451570d0bb0584745487c54f884fd9
(cherry picked from commit 3dfae3f149)
2019-04-18 17:48:39 -07:00
Cyan Hsieh
4d5f5ff943 Revert "Add the entire boot image to boot.zip"
This reverts commit c0ed5e7c56.

Reason for revert: this patch cause build breakage on aosp-master-throttled (aosp_qemu_trusty-userdebug)

Bug: 130376456
Change-Id: Iab03d21219674691bd8bf6b2e5004508ebb862b9
2019-04-16 09:10:11 +00:00
Calin Juravle
c0ed5e7c56 Add the entire boot image to boot.zip
Add all the boot image files necessary of offline inspection and
compilation in a single zip file (boot.zip).

This replaces the previous boot_profiles_jars.zip which contained only the
jar files.

Bug: 130376456
Test: m dist
Change-Id: I7e711369e7d56630c168c01df60a8c2672d60927
2019-04-16 01:07:52 +00:00
Nicolas Geoffray
7e8ca9a174 Move the profile rule out of dex_preopt_libart.mk.
We only need to define it once. dex_preopt_libart.mk can be read
multiple times if there are many boot image.

Test: m && no warning
Bug:119800099
Change-Id: If5b8fbb0c3310eb42f676d7b5267dcee679f7e19
2019-04-05 18:44:15 +01:00
Nicolas Geoffray
269bc741a5 Support for install multiple boot images.
Bug: 119800099
Test: m && /system/framework/arm/apex*.art files exist
Change-Id: I78023f1086446c2c44ff6b282993537b053c0588
2019-02-22 15:33:23 +00:00
Colin Cross
d8badf5b8b Fix boot_profile_jars.zip
Some of the inputs to boot_profile_jars.zip have moved outside
of $(PRODUCT_OUT), update the -C argument to soong_zip to point
to the right directory.

Also make the rule to build the zip always present, and only gate
the dist command behind PRODUCT_DIST_BOOT_AND_SYSTEM_JARS.

Test: m out/target/product/blueline/boot_profile_jars.zip
Change-Id: Iaa72be955edda445f3eab041a63f79c9055d6b33
2019-02-20 20:44:58 +00:00
Nicolas Geoffray
02c6848b1a Remove obsolete rule.
We don't strip boot classpath anymore.

Test: m
Change-Id: I516bbac92d896c9e00a634a33f2856bd18fc75d5
2019-02-20 10:15:24 +00:00
Colin Cross
485c9cd400 Move hiddenapi singleton rules to Soong
Hiddenapi rules are now in build/soong/java/hiddenapi_singleton.go.
This effectively requires any module in PRODUCT_BOOT_JARS to be
defined in Soong.

Bug: 123645297
Test: m checkbuild
Change-Id: If72bd1c20b2014d0a3d400624d37fdb0a3052245
2019-02-05 21:38:55 -08:00
Treehugger Robot
61ae763ec4 Merge "Remove dependencies on hiddenapi files with UNSAFE_DISABLE_HIDDENAPI_FLAGS=true" 2019-01-31 19:25:59 +00:00
Calin Juravle
9e1fb1b3bd Use DEXPREOPT_BOOTCLASSPATH_DEX_FILES to build boot_profile_jars.zip
The core libraries are no longer put in /system/framework. Replace the
system path with the dexpreopt input path.

Test: launch taimen_nopreload-userdebug; m
Bug: 123313750
Change-Id: I6232c36d39fb818a302cb4b6cb61e91b44b28da1
2019-01-29 16:43:21 -08:00
Adrian Roos
21028b7ad6 Remove dependencies on hiddenapi files with UNSAFE_DISABLE_HIDDENAPI_FLAGS=true
Fixes: 122957987
Test: UNSAFE_DISABLE_HIDDENAPI_FLAGS=true make droid
Change-Id: Iafef8cc69971fd10718882326fbba99a6223d0f8
2019-01-25 17:35:25 +01:00
Calin Juravle
ba3e26d5da Merge "Replace PRODUCT_BOOT_JARS with DEXPREOPT_BOOT_JARS_MODULES for nopreloads" 2019-01-24 07:56:37 +00:00
Calin Juravle
b741d1cfa9 Replace PRODUCT_BOOT_JARS with DEXPREOPT_BOOT_JARS_MODULES for nopreloads
boot_profile_jars.zip is used to process the boot image profile (by
filtering out data that does not belong to the boot classpath).
We only need the jars that are actually preloaded, and not the ones which
are updatable.

Test: launch taimen_nopreload-userdebug; m
Bug: 123313750
Change-Id: I630f78dda3d9b38aac04b0f364b25fbcda4e26a3
2019-01-23 18:06:50 -08:00
Nicolas Geoffray
e5b368bfe6 Use the jars, not the classes.dex for passing to hiddenapi.
The instructions to look up for classes.dex don't work when looking
at different jar versions (aligned, unaligned, etc).

Test: m
Change-Id: I5f178ca0d00497edbab892722a5ee84f0c47d0a0
2019-01-22 14:28:12 +00:00
David Brazdil
96e973b304 hiddenapi: Process core.platform.api.stubs
Pass @CorePlatformApi stubs to the `hiddenapi` singleton rule which
generate a CSV of all public or domain API flags.

Bug: 119068555
Test: m appcompat
Test: dexlayout <core-oj jar> | grep CORE-PLATFORM-API
Change-Id: I597ee330835e564d61cfac44497e762b552b901c
2019-01-19 15:57:35 +00:00
David Brazdil
fc274bab4d Replace hiddenapi-{public,private}-list.txt with a CSV file
`hiddenapi` is being refactored to work with a single CSV file as
opposued to a multitude of text files (one per flag). This patch
changes the singleton rule for listing public/private APIs from
stubs to expect a CSV as an output.

Bug: 119068555
Test: compiles, hiddenapi-flags.csv unchanged
Change-Id: If56c7ab8a4c3bbd33e447ef0dfd33f2c303a937c
2019-01-19 15:57:35 +00:00
David Brazdil
38f19aac1f Move HIDDENAPI_FLAGS dependencies to frameworks/base
Recent move of hiddenapi rules to soong sets the dependencies of
the hiddenapi_flags.csv rule in dex_preopt.mk but doesn't check
for existence of "frameworks/base" as the hiddenapi-generate-csv
rule in frameworks/base. Solve this by removing the dependency
injection and using the SOONG_HIDDENAPI_FLAGS variable directly
in frameworks/base.

This is necessary because go/art-build creates a fake
hiddenapi_flags.csv and if there is a dependency injection rule,
a phony target is created and all dependencies of flags.csv need
to be satisfied.

Test: master-art compiles
Change-Id: I13ef5e7ec167f9372a5629fe1894c7acd4091d29
2019-01-18 15:11:01 +00:00
Colin Cross
49adea3bd8 Move hiddenapi to Soong
Perform hiddenapi CSV generation and dex encoding for Soong modules
in Soong.  This fixes an issue where dexpreopting was happening on
a different jar than was being installed.

Bug: 122856783
Test: m checkbuild
Change-Id: I24a235c63ff62fed7e1af9f2fd17e55b0c1598a5
2019-01-17 10:23:10 -08:00
Vladimir Marko
3266d6ef22 Preopt: Pass -Xbootclasspath: arg to dex2oat.
Test: Pixel 2 XL boots.
Bug: 119868597
Change-Id: I951c0953ad336b6a3af441da396fe7705258623c
2018-12-21 15:52:24 +00:00
Colin Cross
6db5b0ea9a Move dexpreopting to Soong
Move the dexpreopting logic into Soong.  Make modules will be
dexpreopted by executing the Soong logic in the standalone
dexpreopt_gen binary, which will generate scripts that will
perform dexpreopting for each module.  Export global configuration
as JSON to $OUT/dexpreopt.config, which will be used by
dexpreopt_gen and Soong, and per-module JSON configuration that
will be used by dexpreopt_gen.

This relands I59b20c931ee3e5a8d35eb30da4148691c5095502,
I39d580999947ee54cfefe875b57a028be5333bd7,
Ie7daa94e107d53eff075ca58dbe721bd9d7fc8c2 and
Ica006a007d112c232311435aaac0c0e476232b67, with a minor
update to match the changes made to dexpreopt_gen arguments
and a fix to correctly keep dexpreopt disabled on mac builds.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Change-Id: I25163e91886cea6941afa25cdb529ed053278dcb
2018-12-17 13:46:17 -08:00
Colin Cross
b8901d7fb8 Revert "Move dexpreopting to Soong"
This reverts commit e736c58043.

Test: none
Bug: 119412419
2018-12-14 11:49:55 -08:00
Colin Cross
e736c58043 Move dexpreopting to Soong
Move the dexpreopting logic into Soong.  Make modules will be
dexpreopted by executing the Soong logic in the standalone
dexpreopt_gen binary, which will generate scripts that will
perform dexpreopting for each module.  Export global configuration
as JSON to $OUT/dexpreopt.config, which will be used by
dexpreopt_gen and Soong, and per-module JSON configuration that
will be used by dexpreopt_gen.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Change-Id: I59b20c931ee3e5a8d35eb30da4148691c5095502
2018-12-12 17:21:22 -08:00
Colin Cross
fc782ad949 Reduce the propagation of LOCAL_DEX_PREOPT := nostripping
nostripping causes confusing double negatives, allow nostripping
in LOCAL_DEX_PREOPT and DEFAULT_DEX_PREOPT, but convert to
LOCAL_STRIP_DEX outside of dex_preopt_odex_install.mk.

Test: m checkbuild
Change-Id: I996e9258ce20c394900d9fe937d638bc2ab8589d
2018-10-23 22:33:07 -07:00
Colin Cross
1a81e372b5 Fix boot_profile_jars.zip
soong_zip was previously ignoring trailing command line arguments,
but now they are an error.  boot_profile_jars.zip had all its
files as trailing arguments instead of as -f flags, previously
resulting in an empty zip, but now causing an error.  Fix the
arguments to use -f before each file.

Test: m PRODUCT_DIST_BOOT_AND_SYSTEM_JARS=true out/target/product/sailfish/boot_profile_jars.zip
Change-Id: I8ac4aa4fbca812b8aa2ff9526e1ed7c769dd8420
2018-10-01 17:45:59 +00:00
David Brazdil
e3fb5f6d09 Add hidden API public/private list to KATI_RESTAT
Change hidden API public/private list generation build rule so that it
checks if outputs have changed and only commit them when changes have
been made. .KATI_RESTAT instructs ninja to restat the outputs and remove
reverse dependencies when rebuilding dependencies is not needed.

Bug: 113278235
Test: m appcompat
Change-Id: Iad23e302b6c30f9a021200acd4bb20e6062de5a2
2018-09-06 18:00:57 +01:00
Anton Hansson
648b0a875e Install /system/product_services apps odex in system-other.
This will cause odex/vdex files for apps installed under
/system/product_services/{priv-,}app to be installed in system-other
instead of next to the APKs themselves.

This change is analogous to I63406f91acc3de4b4f142767e28d45308706c7da,
which was for /system/product apps.

Test: diff installed-files{,-system-other}.txt on pixel with a PS app
Bug: 80741439
Change-Id: I79fac41cb665a649028f1f0e30350d42e8b80598
2018-08-24 14:59:32 +01:00
Ralph Nathan
b8fb0de02f Allow products to define their own hidden api stubs
This enables other verticals/products to expand the list of APIs that
apps can call on those devices.

Bug: 112190341
Test: local test with app
Merged-In: I4dc983273a1beb83d0b81ab026945880a10bbd8c
Change-Id: I4dc983273a1beb83d0b81ab026945880a10bbd8c
(cherry picked from commit f9bf755d0a)
2018-08-15 17:51:55 +01:00
David Brazdil
d3c9855a2c Merge "hiddenapi: Split stubs into public/system/test classpaths"
am: 09480aa0cf

Change-Id: I09723c7b797e3359c8e0c6c2cd7d7dc19c0323bb
2018-08-06 15:26:57 -07:00
David Brazdil
7adbde4cd6 hiddenapi: Split stubs into public/system/test classpaths
The hiddenapi tool needs to build a class hierarchy from API stubs.
These are inconsistent between public, system and test API stubs.
This patch splits stubs into the three corresponding categories
and groups the JARs being passed to hiddenapi.

Test: m appcompat
Bug: 76424618
Change-Id: I3f707070d44f04578bc6148a45f2283bcf060703
2018-08-03 17:02:37 +01:00
David Brazdil
263338b0e3 Merge "Remove android.test.{mock,runner}.stubs from private-list.txt"
am: cfe591c565

Change-Id: I202d1b478c8e5e3022fc3bd64ef272bd1032e217
2018-08-01 08:34:56 -07:00
David Brazdil
bb5bf2e2a3 Remove android.test.{mock,runner}.stubs from private-list.txt
Generation of the full list of non-SDK APIs resolves public API
stubs against the boot class path. Remove stubs which do not
correspond to libraries on the boot class path.

This removes "Unresolved" warnings while building the API lists.

Bug: 112002105
Bug: 79409988
Test: m out/target/common/obj/PACKAGING/hiddenapi-private-list.txt
Change-Id: I1a73ed9ee50affed5284692e829a433ec1484f01
2018-07-31 10:55:31 +01:00
David Brazdil
467a10c261 Add singleton rule for hiddenapi list generation
The lists of public/private APIs used for non-SDK API restriction
enforcement used to be generated by Doclava. In Q we're switching
to resolving android.jar (and other SDK stub JARs) against the boot
class path directly to avoid lowering Doclava's high-level view of
the framework and issues related to it.

This patch adds a new build rule which invokes `hiddenapi` on all
boot class path dex files simultaneously. The tool generates two
text files - one with public and one with private APIs.

Bug: 79409988
Test: m out/target/common/obj/PACKAGING/hiddenapi-private-list.txt
Change-Id: I826d8ac513a41a1d6d5e29a8300073158cff5acf
Merged-In: I826d8ac513a41a1d6d5e29a8300073158cff5acf
(cherry picked from commit a39db48511)
2018-07-13 00:52:05 +00:00
David Brazdil
ab501e0d8b Add singleton rule for hiddenapi list generation
The lists of public/private APIs used for non-SDK API restriction
enforcement used to be generated by Doclava. In Q we're switching
to resolving android.jar (and other SDK stub JARs) against the boot
class path directly to avoid lowering Doclava's high-level view of
the framework and issues related to it.

This patch adds a new build rule which invokes `hiddenapi` on all
boot class path dex files simultaneously. The tool generates two
text files - one with public and one with private APIs.

Bug: 79409988
Test: m out/target/common/obj/PACKAGING/hiddenapi-private-list.txt
Merged-In: I826d8ac513a41a1d6d5e29a8300073158cff5acf
Change-Id: I826d8ac513a41a1d6d5e29a8300073158cff5acf
(cherry picked from commit a39db48511)
2018-07-12 08:58:14 +00:00
Dario Freni
37333682da Merge "Install /system/product apps odex in system-other."
am: 12e0e51116

Change-Id: I557c83122eb3d0bc894e479d645d353630075bb8
2018-07-05 05:30:18 -07:00
Dario Freni
aa45068cc7 Install /system/product apps odex in system-other.
This will cause odex/vdex files for apps installed under
/system/product/{priv-,}app to be installed in system-other image, under
/system/product/{priv-,}app as well.

Test: m on marlin-userdebug target, analyzed
installed-files{,-system-other}.txt
Bug: 110072687

Change-Id: I63406f91acc3de4b4f142767e28d45308706c7da
2018-07-04 16:28:18 +01:00
Calin Juravle
8955a99f06 Create dist for boot and system jars
We need the jars on boot and system server classpath in order to
symbolize profile information. Having the jars packed in a dist zip will
help a lot with the tools.

Test: m
Bug: 73313191
Change-Id: I5b64268d240055282099e9b86a5e6869e6405968
2018-05-11 16:38:03 -07:00
Mathieu Chartier
1f1335ceeb Revert "Revert "For user and userdebug generate error if DEXPREOPT is not enabled""
Fixed the failing targets.

Bug: 74209329
Test: make

This reverts commit 0ecba4b139.

Change-Id: I4f346b8107ffaf6afbd551d91574ed040372635e
2018-03-09 18:03:49 -08:00
Mathieu Chartier
0ecba4b139 Revert "For user and userdebug generate error if DEXPREOPT is not enabled"
This reverts commit f26b8e4249.

Reason for revert: Too many broken targets
Bug: 74209329

Change-Id: I8f1390eacf685e1b7144b712fe5afb8da384ceb0
2018-03-08 18:25:28 +00:00
Mathieu Chartier
2594230d83 For user and userdebug generate error if DEXPREOPT is not enabled
This prevents cases where system_server is running in interpreter
only mode.

Removed unused flag in product.mk

(cherry-picked from commit 27f4287406)

Bug: 74209329
Test: WITH_DEXPREOPT=false make
Merged-In: I4ab3afed95a5baf77d0cd089dafaa18bcc1913e5
Change-Id: I4ab3afed95a5baf77d0cd089dafaa18bcc1913e5
2018-03-07 22:21:43 +00:00
Mathieu Chartier
f26b8e4249 For user and userdebug generate error if DEXPREOPT is not enabled
This prevents cases where system_server is running in interpreter
only mode.

Removed unused flag in product.mk

Bug: 74209329
Test: WITH_DEXPREOPT=false make
Change-Id: I4ab3afed95a5baf77d0cd089dafaa18bcc1913e5
2018-03-07 10:51:52 -08:00
Nicolas Geoffray
ed6ee7b64d Don't strip for eng builds.
bug: 72150787
Test: m
Change-Id: Ifdd403dfecb440e32c4d0c00a7543820b2098359
2018-01-22 15:07:37 +00:00
Mathieu Chartier
f834eccd52 Allow system server jars for WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY
Renamed WITH_DEXPREOPT_BOOT_IMG_ONLY to
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY and changed the
behavior accordingly.

Preopt system server jars since selinux prevents system server from
loading anything from /data. If we don't do this they will need to
be extracted which is not favorable for RAM usage or performance.

Test: make and flash and look at system server maps
Bug: 65122284
Bug: 62356545

(cherry picked from commit 418258cee9)

Merged-In: I2e70c80a86327b455450b95144f21020e7bf0c6f
Change-Id: I316e79c7c6d45e2ccbfff4065137cc3ef9d2738e
2017-10-12 20:40:41 +00:00
Colin Cross
ea1629e788 Refactor removing classes.dex for dexpreopt
Combining $(call dexpreopt-remove-classes.dex) into a
$(call copy-one-file) rule is hacky and error prone.  Make a helper
dexpreopt-copy-jar function that takes LOCAL_DEX_PREOPT and copies
the jar, removing the dex files if necessary.

Test: only description message changes to out/build-${TARGET_PRODUCT}.ninja
Change-Id: Id2fa2d18571ca01bc81302c912b8de25f3dde7a1
2017-10-06 14:26:25 -07:00
Andreas Gampe
4ed21d10e8 Build: Change SANITIZE_LITE install settings
Under SANITIZE_LITE, the default app_process is not instrumented.
Embedding sanitized libraries into APKs will lead to crashing apps.
So move second-stage APKs to /data/asan.

The tradeoff is that for now we won't run these sanitized binaries.
Adding support for that is future work.

Also do not do a rebuild of the boot image. This would invalidate
the first-stage results. Note that this is technically dangerous,
as stack overflow guard sizes will not be adapted for ASAN runs.
However, this is a general incompatibility.

Also do not rebuild system_other. Apps are not rebuilt, so it will
create an empty image.

(cherry picked from commit 481660ef34)

Bug: 36458146
Test: m && m SANITIZE_TARGET=address SANITIZE_LITE=true
Merged-In: I3898bc53cad264529f126e6bf0af9c6ca1736877
Change-Id: I3898bc53cad264529f126e6bf0af9c6ca1736877
2017-08-31 08:56:18 -07:00
Nicolas Geoffray
4a0ad4ac61 Add a new PRODUCT variable for forcing 'speed' preopt.
bug: 35872915
Test: build
Change-Id: Idfea3c379a2b1dab30ee94a58ffe86d508f8522f
2017-06-15 09:52:45 +01:00
Nicolas Geoffray
cdd4343bb2 Don't preopt system server apps in system_other.
bug:36532541
bug:33799337

Test: m -j32 && find out/target -name \*.odex

(cherry picked from commit a2c6c0b11e)

Change-Id: Ic4396bb6c543af1c05f56030495caafb245ea304
2017-04-28 12:34:53 +01:00