Commit Graph

63 Commits

Author SHA1 Message Date
Paul Duffin d418e961c8 Make sure that BootJars is super set of ArtApexJars
When constructing the dexpreopt config it will strip out any entries in
ART_APEX_JARS which are not present in PRODUCT_BOOT_JARS and store the
remainder in ArtApexJars.

Bug: 185391652
Test: lunch sdk_phone_x86_vendor && m nothing
      lunch sdk_phone_x86 && m nothing
Change-Id: I403ef9768a8ac2d222bbd6cfd0a68a2019f67c16
2021-04-14 20:35:58 +01:00
Nicolas Geoffray 5bfe9267f8 Preopt apps with updatable boot classpath too.
Test: m
Test: egrep 'ethernet-service[^ ]*odex' out/soong/build.ninja \
    | grep updatable
  # is empty
  egrep 'oat-file=[^ ]*Gallery2[^ ]*odex' out/soong/build.ninja \
    | egrep -o 'Xbootclasspath:[^ ]*' \
    | sed 's/:/\n/g' \
    | grep updatable_bootjars
  # lists updatable boot jars
  egrep -o 'Xbootclasspath:[^ ]*' \
      -o `find out -name dexpreopt.sh | grep Dialer` \
    | sed 's/:/\n/g' \
    | grep updatable_bootjars
  # lists updatable boot jars
Bug: 178467404
Change-Id: Ia5d4e59bac3e32bc77f1a0ab9e1abb18768a7ee7
2021-03-29 14:03:12 +01:00
Ulyana Trafimovich 86755e4ac0 Merge "Add config that controls if updatable BCP is included in dexpreopt." 2021-03-25 10:13:45 +00:00
Ulya Trafimovich b9f4306adf Add config that controls if updatable BCP is included in dexpreopt.
For now the config is always set to false (updatable boot jars are
excluded), but this may change in the future.

Bug: 178467404
Test: lunch aosp_cf_x86_64_phone-userdebug && m
Change-Id: I1b45a89748e065a29130efbf8b54dddfae69e48b
2021-03-24 10:51:46 +00:00
Ulya Trafimovich 1a3b145803 Add PRODUCT_BROKEN_VERIFY_USES_LIBRARIES.
If set to true, it disables <uses-library> checks for a product. It is
possible to override with environment variable RELAX_USES_LIBRARY_CHECK
on the command-line.

Per product configuration is needed rather than per board configuration
(such as BUILD_BROKEN_* variables) because of the specifics of
<uses-library> checks: they depend on the product packages list, and
not on the board config.

One example of a product family that needs to disable the checks are
the SDK builds (e.g. sdk_gphone_x86_64), see b/183339664.

Bug: 183339664
Bug: 132357300
Test: treehugger
Change-Id: Ia58559e4e70163da94e9eb7b8a6133e0cbecd459
2021-03-23 12:36:24 +00:00
Ulya Trafimovich 5a09c2084d Add non-fatal mode for verify_uses_libraries check.
The new mode is enabled with environment variable
RELAX_USES_LIBRARY_CHECK. If the variable is set to true, then a
verify_uses_libraries check failure does not fail the build, instead it
sets a special compiler filter "extract" for dexpreopt, which means that
the DEX file will be extracted, but it won't be compiled to native code.
Class loader context will be set to empty in this case (not &, as it is
going to be deprecated soon).

If the variable RELAX_USES_LIBRARY_CHECK is unset or set to something
other than "true", then the old behaviour of the verify_uses_libraries
check is preserved.

The intended use case for this flag is to have a smoother migration path
for the Java modules that need to add <uses-library> information in
the build files. The flag allows to quickly silence build errors. This
flag should be used with caution and only as a temporary measure, as it
masks real errors and affects performance.

verify_uses_libraries check is reworked so that it writes the error
message to a status file (which is used instead of the former timestamp
file). Currently the stored error message is not used, but it may be
used later to produce a warning. Dexpreopt command checks if the status
file exists and is nonempty; if that is the case, then compiler filter
is set to "extract".

Bug: 132357300

Test: Manually add some mismatch between the libraries in the Android.bp
      and Android.mk files for dexpreopted apps, build with
      RELAX_USES_LIBRARY_CHECK=true and obsserve that the build doesn't
      fail and they are compiled with compiler-filter "extract".
      Unset RELAX_USES_LIBRARY_CHECK and observe that the build fails.

Change-Id: Ie1a6298c4dba2f368ca9ac8b9fee2de0a26e68e8
2021-02-22 14:49:47 +00:00
Nicolas Geoffray c6c4f08a8c Merge "Remove unused variables." 2021-01-20 18:13:20 +00:00
Nicolas Geoffray ed9395a929 Remove unused variables.
Test: m
Bug: 176171716
Change-Id: I203d08607688ae6f165f0d5c7eee5d13c61eeefa
2021-01-20 14:32:55 +00:00
Ulya Trafimovich 7f8b7a1123 Do not suppress compilation of boot images because of TARGET_BUILD_APPS.
Bug: 176171716
Test: build_mainline_modules.sh and ensure that the ART boot image is
    built: `find out -type f -name '*.art'` is nonempty for every arch.
Change-Id: I5163ebe1f8db3d4d921bab0f83cd388ba29419ec
2021-01-20 14:04:30 +00:00
Ulya Trafimovich e245e00d7b Initialize DEX_PREOPT_DEFAULT based on global dexpreopt settings.
Bug: 177214554
Test: lunch cf_x86_phone-userdebug && m
Test: Ensure that `find out -name dexpreopt.config` lists before and
    after the fix are identical (for target cf_x86_phone-userdebug).
Test: TARGET_PRODUCT=mainline_modules_x86_64 \
    TARGET_BUILD_VARIANT=userdebug \
    build/soong/soong_ui.bash --make-mode UipbUtil
Change-Id: I28b38c08ad570d53dc679f9b42975545d457416e
2021-01-11 17:02:16 +00:00
Anton Hansson 41f9cc2c6b Make TARGET_ARCH optional in BoardConfig
Not setting TARGET_ARCH is ok if TARGET_ARCH_SUITE is set instead. Skip
certain TARGET_ARCH-specific steps of the config:
- don't run the 'select' steps to figure out cpu flags
- don't generate dexopt config for TARGET_ARCH

Bug: 174315599
Test: lunch <product that sets TARGET_ARCH_SUITE but not TARGET_ARCH>
Change-Id: I74a9e71d0cc5c7f74d3b10b1c8bb89682c096d7c
2020-12-15 12:46:51 +00:00
Jeongik Cha f26015449f Unset ENABLE_PREOPT when DISABLE_PREOPT is set
Instead of TARGET_BUILD_APPS, introduce DISABLE_PREOPT,
which is true when TARGET_BUILD_UNBUNDLED_IMAGE or TARGET_BUILD_APPS is set.

Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage and then
      check if there is no preopt
Bug: 160390776

Change-Id: Id27030e602a29ebd438678270db13744dd145143
2020-08-04 10:39:57 +09:00
Jiyong Park cd0c931b89 Merge "Organize product vars for adding properties" 2020-06-15 10:00:22 +00:00
Jiyong Park eb49b34b1e Organize product vars for adding properties
Properties for <partition>/build.prop are now added via
PRODUCT_<PARTITION>_PROPERTIES.

PRODUCT_SYSTEM_PROPERTIES is added. PRODUCT_SYSTEM_DEFAULT_PROPERTIES
will be deprecated.

PRODUCT_VENDOR_PROPERTIES is added. PRODUCT_PROPERTY_OVERRIDES and
PRODUCT_DEFAULT_PROPERTY_OVERRIDES will be deprecated in favor of the new
variable.

For other partitions (odm, system_ext, product), there is no change.

Exempt-From-Owner-Approval: cherry-pick from internal master

Bug: 117892318
Test: m
Merged-In: I98f3b5d0da661b3ad75260a23754e655103b7a44
(cherry picked from commit ad810b6dae)
Change-Id: I98f3b5d0da661b3ad75260a23754e655103b7a44
2020-06-11 15:35:23 +09:00
Martin Stjernholm f712ba95dc Disable dexpreopting when TARGET_BUILD_APPS is used.
This moves the condition from Soong to make, so that
config.UnbundledBuild() in Soong no longer implies disabling
dexpreopting.

Test: TH, in particular builds green on ub-launcher3-master
Bug: 157549171
Change-Id: I7273be8591c9d627d89e033b641139dacc275806
2020-06-11 01:09:53 +01:00
Ulya Trafimovich 40e55c20eb Add product variable PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS.
If true, incorrect order of system server jars does not cause a build
error. The order is non-optimal if some jar X precedes its dependency Y.
In that case dexpreopt will be unable to resolve any rerefences from X
to Y.

Test: lunch cf_x86_phone-userdebug && m nothing
Test: lunch aosp_car_arm && m nothing

Bug: 140451054

Change-Id: I70efd365fa9fbd9e40792d646f8471d009164924
Merged-In: I70efd365fa9fbd9e40792d646f8471d009164924
(cherry picked from commit 17715b48f0)
2020-06-03 17:38:26 +01:00
Elliott Hughes f71c05a8e5 Remove unused mips workarounds.
This was never really finished, and hasn't been supported for years.

Test: treehugger
Change-Id: I7668088d1449f33025aaf36fae0817894c84a877
2020-03-06 16:46:59 -08:00
Nicolas Geoffray 02df14a67a Remove UseApexImage and GenerateApexImage.
These options are not used anymore.

Bug: 119800099
Exempt-From-Owner-Approval: Rebase after conflict
Test: m
Change-Id: I1057a6fc420b45e326ec7744b6df159f950ad853
2020-02-09 22:53:25 +00:00
Vladimir Marko 30bbf37de2 Support dexpreopt against the primary boot image.
Test: taimen-userdebug boots when built with
      DEXPREOPT_USE_ART_IMAGE=true
Bug: 119800099
Change-Id: I1c0860de87a0280d93a63b9135d071c595f1d925
2020-02-07 09:54:59 +00:00
Martin Stjernholm 1e5581749d Remove generation of the dexpreopt tool paths from make.
They are now created from Soong, and therefore put in a separate config file
out/soong/dexpreopt_soong.config.

Test: m
Bug: 145934348
Change-Id: I27e710f09c37e64e8975b8e763d13434e5de71b3
2020-01-07 13:00:38 +00:00
Martin Stjernholm 388a71f092 Remove DEX2OAT_DEPENDENCY which is the same as DEX2OAT.
Small cleanup to simplify the move of it into Soong.

Test: presubmits
Bug: 145934348
Change-Id: Ib4a0b69279f63d53405509b2d1529d9e60d46858
2020-01-07 00:00:29 +00:00
Roshan Pius 626f6371dc base_system.mk: Align formatting for updatable boot jar variable
Migrate PRODUCT_UPDATABLE_BOOT_MODULES &
PRODUCT_UPDATABLE_BOOT_LOCATIONS to a new PRODUCT_UPDATABLE_BOOT_JARS.
This new variable uses the same format as
PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS, i.e <apex>:<jar> pair.

Test: Compiles & flashed device. Ensured that the bootclasspath & system_server class
paths remain the same.

Change-Id: I1cb26d5ec825cd1f5282a6e0255094ddf2fe046a
2019-11-28 12:59:08 +00:00
Roshan Pius d6e239fc35 base_system.mk: Support system_server jars from apexes
Allow system_server jars delivered via apex. Regular system_server
jars are located in /system/framework folder. But, jars delivered via
apex are mounted at /apex/<module_name>/javalib. Also, not all the
libraries in /apex/<module_name>/javalib will be a system_server jar,
so adding a mechanism to list out the jar file explicitly within the
apex module.

Bug: 144722612
Bug: 141785760
Test: Compiles (both with empty & non-empty PRODUCT_SYSTEM_SERVER_APEX_JARS
value set)

Change-Id: Ia181ab22fdf2da575bfd532c1cd90a2f54742528
2019-11-22 12:48:09 -08:00
Ulya Trafimovich 5877cec1fa Disable dexpreopt on targets that do not include default ART config.
Dexpreopt build commands should only be generated on targets that
include build/make/target/product/runtime_libart.mk, which sets the
necessary variables such as PRODUCT_SYSTEM_DEFAULT_PROPERTIES that
contain default values passed to dex2oat. This file also sets a
variable PRODUCT_USES_DEFAULT_ART_CONFIG that is used in
build/make/core/dex_preopt.mk to decide if boot images should be
installed.

On some targets build/make/target/product/runtime_libart.mk is not
included. Prior to this patch, on such targets invalid dexpreopt
commands were generated, but not used, so they did not cause any
visible build failures. The invalid commands can be grepped as:

  lunch qemu_trusty_arm64-userdebug && m nothing \
    && fgrep -e '-Xms ' $ANDROID_BUILD_TOP/out/soong/build.ninja

In this case '-Xms ' is an ill-formed option passed to dex2oat (the
option expects one argument, but none is passed).

This patch makes the DisablePreopt variable passed from make to
soong more strict: it not only requires WITH_DEXPREOPT, but also
PRODUCT_USES_DEFAULT_ART_CONFIG. This means that dexpreopt commands
will not be generated on targets that do not include
build/make/target/product/runtime_libart.mk.

Test: lunch aosp_walleye-userdebug && m \
    && find $ANDROID_BUILD_TOP/out -name 'boot.art'
    # expect to find files in /out/target/product/walleye/system/framework/$ARCH/

Test: lunch qemu_trusty_arm64-userdebug && m \
    && fgrep -e '-Xms ' $ANDROID_BUILD_TOP/out/soong/build.ninja
    # expect empty output

Change-Id: I3d765ed0dd8b38236b8bdd5c6202bb1d3f45f904
2019-11-01 18:20:35 +00:00
Nicolas Geoffray 8567331a4f Merge "Remove support for stripping dex." 2019-10-22 09:48:06 +00:00
Nicolas Geoffray 2ca0e49f61 Remove support for stripping dex.
Stripping is incompatible with ART module updatability.

Bug: 65154345
Bug: 138851227

Test: build and observe no change in output (stripping is not used by
default).

Change-Id: Ic2d9738ef393814c3af3cad116071f7b5938aa84
2019-10-21 09:36:45 +01:00
Anton Hansson 3c5a18fc16 Document SYSTEM_OTHER_ODEX_FILTER matching
...and add a CleanSpec for the moving preopt files.

Bug: 141707536
Test: N/A
Change-Id: I2f5bc4e2c8e6a9fa4c562d55623c13682d3f93ba
2019-10-07 14:29:58 +01:00
Martin Stjernholm b324175118 Update dexpreopt for the ART APEX name change.
Test: Build & boot
Bug: 135753770
Exempt-From-Owner-Approval: Approved internally
Change-Id: I130eaa6126d347bd1010c02b4f353b9e9b15ef84
Merged-In: I130eaa6126d347bd1010c02b4f353b9e9b15ef84
2019-08-30 17:47:30 +01:00
Justin Yun 6151e3f1ea Rename product_services to system_ext
Bug: 134359158
Test: build and check if system_ext.img is created
Change-Id: I67f2e95dd29eac6a28e07e24ea973d3a134c3bfc
2019-07-09 08:57:19 +00:00
Mathieu Chartier a5828f21f8 Revert "Revert "Remove option to create boot image based on preloaded classes""
Test: make
Test: build/soong/scripts/build-ndk-prebuilts.sh

This reverts commit 7139459ac7.

Change-Id: I7449e57cdcaccc60decca2df929b1b9e920f5904
2019-06-26 14:43:57 -07:00
Mathieu Chartier 7139459ac7 Revert "Remove option to create boot image based on preloaded classes"
This reverts commit 633009b659.

Reason for revert: NDK build broken

Change-Id: I3e470ccf42b6d50c534c53c2b14150506d6226e8
2019-06-26 16:45:01 +00:00
Mathieu Chartier 633009b659 Remove option to create boot image based on preloaded classes
Using the preloaded classes to generate the image is no longer
supported.

Test: make

Change-Id: I63fa47395e9f7ee2967522ae2c02676283fb2d31
2019-06-25 13:52:59 -07:00
Colin Cross 56199af6c2 Move verify_uses_libraries.sh out of dexpreopt
dexpreopt usually gets a dex jar instead of the final APK, which
means targetSdkVersion can't be parsed out of it.  Move the
shared library verification to a tool that operates on the final
AndroidManifest.xml instead.  verify_uses_libraries.sh is still
used to verify prebuilts where we don't have an AndroidManifest.xml
and must parse it out of the APK.

Test: m Gallery2
Bug: 132357300
Change-Id: I6ade74b6144c73aee094f5d5ff343067ca0a0e5a
2019-05-26 17:42:17 +00:00
Colin Cross 51ba1df2f0 Use a copy of dexpreopt.config
Move the dexpreopt.config passed to Soong to out/soong/dexpreopt.config
and let it write a new copy in a rule and pass the path back to make
as DEX_PREOPT_CONFIG_FOR_MAKE.

Bug: 132379813
Test: m checkbuild
Change-Id: Iac29beac3af8864d36d1563ce42bed11b685548d
2019-05-09 22:16:13 -07:00
Mathieu Chartier b9dc792b19 Add PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS
For enabling per product configuration of resolving startup
const strings.

Bug: 130217075
Bug: 131310042
Test: make

(cherry picked from commit b37c79c3a2)

Merged-In: I51cb8931b915a710ab584f954b7a99c7a651d914
Change-Id: I0ecc7823620bca9f252b3d91b82982db91dd248d
2019-04-30 17:00:19 -07:00
Nicolas Geoffray 0639b7de03 Pass DEXPREOPT_USE_APEX_IMAGE to soong.
Test: lunch walleye_jitzygote-userdebug m && all odex file use the apex image
Bug: 119800099
Change-Id: Ieb8f36b94264496a41998d4ceca30e1f41a98ebe
2019-04-04 18:51:32 +01:00
Anton Hansson 74dc00b88f Move WITH_DEXPREOPT default value
This allows setting the variable READONLY after reading the BoardConfig.

This is safe to do because this flag is only set in BoardConfig.mk
files. The same is not true for many of the other default preopt flags,
like DEX_PREOPT_DEFAULT or WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY
which are set in mixture of product / board config files.

Test: boot blueline
Change-Id: I961ba581f9790bcdc7cf6b36d8b53bcdb8861a92
2019-02-27 15:03:23 +00: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 36b5d1cd47 Update calls to dexpreopt_gen
dexpreopt_gen now requires a -out_dir argument, and does not need
DexPath, StripInputPath and StripOutputPath set.

Also use paths to Soong binaries for dex2oat, profman and aapt
so that they can be loaded as Path objects in Soong, and let
Soong handle the default for BootImageProfiles.

This reapplies I97b1865fd98d5108d9c63ff7a90a5591c7622526 with
fixes to disable preopt for Soong-only builds when the global
dexpreopt.config doesn't exist.

Test: m checkbuild
Change-Id: I5af9b749235823b7e1cfcfc55e121bfec413fb2f
2019-02-20 21:46:15 -08:00
Colin Cross 862ab81669 Revert "Update calls to dexpreopt_gen"
This reverts commit 1d8df4a97f.

Reason for revert: broke ndk build

Change-Id: I99ab62653fc15b985edd42301ec085ba68389f51
2019-02-21 05:03:11 +00:00
Colin Cross 1d8df4a97f Update calls to dexpreopt_gen
dexpreopt_gen now requires a -out_dir argument, and does not need
DexPath, StripInputPath and StripOutputPath set.

Also use paths to Soong binaries for dex2oat, profman and aapt
so that they can be loaded as Path objects in Soong, and let
Soong handle the default for BootImageProfiles.

Test: m checkbuild
Change-Id: I97b1865fd98d5108d9c63ff7a90a5591c7622526
2019-02-20 11:14:14 -08:00
Nicolas Geoffray f026d899f4 Set a dedicated variable for the runtime apex libs.
Bug: 124789867
Test: build with coverage, the boot classpath has jacoco.jar in /system/framework, not the apex
Change-Id: I2529f8fcb4ef30454a9e5fc95d58d31bef83ec6f
2019-02-20 10:05:17 +00:00
Colin Cross 47e384c3d6 Remove dexpreopting of boot jars from Make
Dexpreopting of boot jars is now implemented in
build/soong/java/dexpreopt_bootjars.go.

Test: m checkbuild
Change-Id: I036510e7674b876976ce191c5b18bf0b7a15c6ee
2019-02-15 13:00:14 -08:00
Nicolas Geoffray cd75414f1e Merge "Revert "Revert "Never strip and store dex files uncompressed when they are preopted on system.""" 2019-02-13 11:59:39 +00:00
Nicolas Geoffray 98f5e86660 Revert "Revert "Never strip and store dex files uncompressed when they are preopted on system.""
This reverts commit a81dad1bc4.

Test: build && atest android.text.cts.EmojiTest#testEmojiGlyphWebView on Cuttlefish
Change-Id: Ie3c43830fc9a994ed35883abb8ca71d97bd5c44d
2019-02-12 14:00:38 +00:00
Colin Cross 87378f1888 Move dexpreopt image selection out of dexpreopt_gen
Instead of passing both the module and global dexpreopt image
selection into dexpreopt_gen, determine the correct dexpreopt
image in Make.  This allows the Make dexpreopt rule to only
depend on the necessary boot images, preventing an order-only
dependency on the 32-bit boot image for a 64-bit only module.

Also stop using the boot image "location" as an input, only
track the real path, which will be converted to the "location"
that dex2oat expects when constructing the command line in
dexpreopt_gen.

Removes support for the unused LOCAL_DEX_PREOPT_IMAGE_LOCATION
variable.

Test: m checkbuild
Change-Id: I2e3e1d30fdfed92fb08e6cc1c9515edf8d99c7f0
2019-02-11 15:25:07 -08:00
Colin Cross 05ef66fc0b Merge "Revert "Never strip and store dex files uncompressed when they are preopted on system."" 2019-02-11 19:31:31 +00:00
Colin Cross a81dad1bc4 Revert "Never strip and store dex files uncompressed when they are preopted on system."
This reverts commit 9cdc3beb3d.

Reason for revert: b/123436620

Change-Id: I45fa9236e37c3b7e2d44ede62a2701db2bc8a20d
2019-02-11 19:30:39 +00:00
Nicolas Geoffray f07d63390c Merge "Never strip and store dex files uncompressed when they are preopted on system." 2019-02-11 10:31:12 +00:00
Nicolas Geoffray 9cdc3beb3d Never strip and store dex files uncompressed when they are preopted on system.
In order for the runtime module to always be able to compile apps,
make sure we keep a copy of the dex files optimally.

Gated by a product flag if a product doesn't include the module yet.

Test: build
Change-Id: Ia9bba7f6f12f3400078a43d39ba4134cf8818399
2019-02-08 22:45:48 +00:00