Previously, it ignored any module that was not a platform apex variant
however that required every module that was referenced from the boot
jars to have a platform variant which is not the case when building
from prebuilts.
This change switches it to explicitly check that the variant is for
either the appropriate apex or the platform depending on what is
configured in the BootJars or UpdatableBootJars.
It partially duplicates some logic from the getBootImageJar() function.
It intentionally does not refactor the getBootImageJar() to allow for
reuse because coupling the hiddenapi and dexpreopt logic would make
refactoring either of them more difficult. Any duplicated code will be
deduped once they have both been refactored.
Bug: 178361284
Test: m droid
Change-Id: I4b4e0dc8ee40c1ba1713d7ef72df13d175e84af6
Previously, the apex module had to hard code behavior specific to the
art apex module in order to include the art boot image. This change
adds support to the apex module to allow the boot images to be
specified per apex.
In combination with a change to add the "art-boot-image" to the ART
apex this allows the custom code for handling the art boot image in
apex to be removed.
That custom apex code also included the logic to ensure that the
GlobalSoongConfig was initialized for use by the dex_bootjars
singleton. That logic has been moved from the APEX to the boot_image
module. That ensures that it will be run if and only if a boot_image
module is present in the checked out repos. So, limited manifest
checkouts which do not contain the art or frameworks/base repos (which
is where the boot_image modules are defined) will not attempt to run
this logic, which would fail because dex2oat would not be present.
Bug: 177892522
Test: m droid
Change-Id: I02d25fbef6e864e31eb5e0f4eb50358c79486db0
are present.
1) The boot jar to APEX mapping is maintained by the base names for
both of them. When building with prebuilt modules and APEXes, that
means we need to take care to compare them without regard to any
"prebuilt_" prefixes.
2) VisitAllModules can visit disabled modules and both source and
prebuilt modules, so they need some conditions to skip modules that
aren't applicable for boot jars.
Test: `m droid`
Test: `m droid SOONG_CONFIG_art_module_source_build=false`
with fresh ART Module prebuilts in place
Bug: 171061220
Change-Id: Iced269d29127bc8b8f9b3171adb60a97d115628b
Adds a boot_image module type. Follow on changes will add instances of
boot_image to represent the ART and framework boot images in the art
and frameworks/base repositories respectively.
For the moment they retrieve their associated boot image configuration
from the map returned by genBootImageConfigs() and leave the actual
work of creating the ninja rules to create the boot images to the
dex_bootjars singleton.
Bug: 177892522
Test: m droid
Change-Id: Ib69701de0d24d996bb8e8be7a20b941be907390e
The main difference between a singleton and a singleton module that
affects this change is that the latter requires a module to be defined
in order for the singleton to be instantiated. This change defines the
module in both the tests and the standard build.
Bug: 177892522
Test: m droid
Change-Id: Id6669835cf3a2ab7359fa53047eb9042992a9362
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: Ibc45581eef2b205c750a30709780cf659ba7cfa1
Dexpreopt and boot jars package check all require access to dex
implementation jars created for java_library and java_sdk_library. They
were available when building from source but not when building from
prebuilts, even though they are embedded within the .apex files that
are referenced from prebuilt_apex.
This changes adds support to prebuilt_apex to export the dex
implementation jars and updates java_import to use those exported dex
implementation jars.
In a source build dexpreopt/boot jars package check access the apex (or
platform) specific variant of a java_library, e.g. core-oj, from which
it retrieves the dex implementation jar path.
After this change in a prebuilt build dexpreopt/boot jars package check
behave in the same way except in this case they retrieve the dex
implementation jar path from the apex (or platform) specific variant of
the java_import, e.g. core-oj.
The work to export files from a `.apex` file for use by other modules
is performed by a new `deapexer` module type. It is not used directly
in an `Android.bp` file but instead is created implicitly by
`prebuilt_apex`,
In order to do that this contains the following changes:
* Adds a new `dexapexer` module type to handle the exporting of files
from the `.apex` file.
* Adds an exported_java_libs property to prebuilt_apex to specify the
set of libraries whose dex implementation jars need exporting.
* Creates apex specific variants of the libraries listed in the
exported_java_libs property.
* Adds the set of exported files to the ApexInfo to make them available
to the apex specific variants.
* Prevents the prebuilt_apex variants from being merged together as
they will not be compatible.
* Modifies java_import to use the exported file for variants of a
prebuilt_apex.
* Adds a ninja rule to unpack (using deapexer) the contents of the
prebuilt_apex's apex file, verify that the required files are present
and make them available as outputs for other rules to use.
* Some minor refactorings to support these changes.
* Adds tests to cover prebuilt only, prebuilt with source preferred,
and prebuilt preferred with source.
Test: m nothing
Bug: 171061220
Change-Id: Ic9bed81fb65b92f0d59f64c0bce168a9ed44cfac
Previously, only the <jar> part of the boot image configuration pair of
<apex>:<jar> was used to select the module that provides the boot image
dex. The name was sufficient to select the module but not the module
variant and it relied on the platform variant not being installed to
select a unique variant. Unfortunately, when modules are provided as
prebuilts they are not installed and so they get ignored.
This change removes the install check and instead checks the <apex> as
well to select a unique variant.
It also moves the DexJarBuildPath() and ApexModule checks to after
checking the name and treats them as errors. It is safe to do so
because every module that has the same name has to have the same module
type and in order for the module to be valid in the boot image
configuration it must pass those two checks. Treating these as errors
rather than silently ignoring them makes it easier to diagnose problems
with the configuration and/or the boot image modules.
Test: m droid
Bug: 171061220
Change-Id: Ie51f097e081907ea5b75d75840736b10d8d883e8
This change does not break modules like "core-oj" that are in multiple
apexes, i.e. com.android.art, com.android.art.debug and
com.android.art.testing because they all shared the same variant. So,
the getBootImageJar() is only called once for that variant.
Test: m droid
Bug: 171061220
Change-Id: Ibf26da147af2b49ab9e4588030e8cd4002d04a7a
Adds some additional information into the paths that are created when
modules are missing in Soong but SOONG_ALLOW_MISSING_DEPENDENCIES=true.
Test: try and build platform against art prebuilts
Bug: 171061220
Change-Id: Ifbcc0af5bdbd15409758a3b6f216cf9b3b5dba31
Enable the RuleBuilder and RuleBuilderCommand methods to access
the BuilderContext by passing it to NewRuleBuilder instead of
RuleBuilder.Build.
Test: genrule_test.go
Test: rule_builder_test.go
Test: m checkbuild
Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
The android.WriteFile rule takes careful escaping to produce the
right contents. Wrap it in an android.WriteFileRule that handles
the escaping.
Test: compare all android.WriteFile outputs
Change-Id: If71a5843af47a37ca61714e1a1ebb32d08536c31
A global variant was used to store the global mapping between
modules and APEXes. Replace it with storing pointers to APEX
contents inside each module so that they can query the contents
of any APEXes they belong to.
Bug: 146393795
Test: all Soong tests
Test: single line change to build.ninja host install dependency ordering
Test: no Android-${TARGET_PRODUCT}.mk, make_vars-${TARGET_PRODUCT}.mk or late-${TARGET_PRODUCT}.mk
Change-Id: Id2d7b73ea27f8c3b41d30820bdd86b65c539bfa4
APEX variants that share the same SDK version and updatability
almost always use identical command line arguments to build but
with different intermediates directories. This causes unnecessary
build time and disk space for duplicated work.
Deduplicate APEX variants that would build identically. Create
aliases from the per-APEX variations to the new shared variations
so that the APEX modules can continue to depend on them via the
APEX name as the variation.
This has one significant change in behavior. Before this change,
if an APEX had two libraries in its direct dependencies and one
of those libraries depended on the other, and the second library
had stubs, then the first library would depend on the implementation
of the second library and not the stubs. After this change, if
the first library is also present in a second APEX but the second
library is not, then the common variant shared between the two
APEXes would use the stubs, not the implementation.
In a correctly configured set of build rules this change will
be irrelevant, because if the compilation worked for the second
APEX using stubs then it will work for the common variant using
stubs. However, if an incorrect change to the build rules is
made this could lead to confusing errors, as a previously-working
common variant could suddenly stop building when a module is added
to a new APEX without its dependencies that require implementation
APIs to compile.
This change reduces the number of modules in an AOSP arm64-userdebug
build by 3% (52242 to 50586), reduces the number of variants of the
libcutils module from 74 to 53, and reduces the number of variants
of the massive libart[d] modules from 44 to 32.
This relands I0529837476a253c32b3dfb98dcccf107427c742c with a fix
to always mark permissions XML files of java_sdk_library modules as
unique per apex since they contain the APEX filename, and a fix
to UpdateUniqueApexVariationsForDeps to check ApexInfo.InApexes
instead of DepIsInSameApex to check if two modules are in the same
apex to account for a module that depends on another in a way that
doesn't normally include the dependency in the APEX (e.g. a libs
property), but the dependency is directly included in the APEX.
Bug: 164216768
Test: go test ./build/soong/apex/...
Change-Id: I2ae170601f764e5b88d0be2e0e6adc84e3a4d9cc
In preparation for reusing the same variation for multiple apexes,
rename ApexName to ApexVariationName.
Bug: 164216768
Test: all soong tests
Change-Id: I88f2c5b192ffa27acd38e01952d0cefd413222a0
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.
Adds a bpfix rule so that we can eventually remove the
product_variables.pdk definition, which is now always a no-op.
Test: treehugger
Change-Id: I830b54d419b59f6db1d4617b45e61a78234f57a7
Merged-In: I830b54d419b59f6db1d4617b45e61a78234f57a7
With the addition of apexes and /system_ext some of the bootclasspath
and system server jars have moved from /system to the new locations.
This has been implemented by using lists of colon-separated strings
called "apex-jar pairs" (although "apex" was misleading as it could
refer to "platform" or "system_ext", not necessarily a real apex).
Using the colon-separated string representation is inconvenient, as it
requires splitting and reassembling the list components many times,
which harms performance and makes error handling difficult. Therefore
this patch refactors the colon-separated lists into a struct that
hides the implementation details.
Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Id248ce639a267076294f4d4d73971da2f2f77208
Host boot image is not needed in boot.zip, which is used for the ART
APK scanner and runs on target. This commit also changes the paths in
the boot.zip by removing OS subdirectory.
Test: lunch aosp_cf_x86_phone-userdebug && m
Test: m out/soong/vsoc_x86/dex_bootjars/boot.zip \
&& zipinfo -1 out/soong/vsoc_x86/dex_bootjars/boot.zip
system/framework/x86/boot-framework.art
system/framework/x86/boot-framework.oat
system/framework/x86/boot-ext.art
system/framework/x86/boot-ext.oat
system/framework/x86/boot-core-icu4j.art
system/framework/x86/boot-core-icu4j.oat
system/framework/x86/boot-telephony-common.art
system/framework/x86/boot-telephony-common.oat
system/framework/x86/boot-voip-common.art
system/framework/x86/boot-voip-common.oat
system/framework/x86/boot-ims-common.art
system/framework/x86/boot-ims-common.oat
system/framework/x86/boot-framework-atb-backward-compatibility.art
system/framework/x86/boot-framework-atb-backward-compatibility.oat
system/framework/x86/boot-framework.vdex
system/framework/x86/boot-ext.vdex
system/framework/x86/boot-core-icu4j.vdex
system/framework/x86/boot-telephony-common.vdex
system/framework/x86/boot-voip-common.vdex
system/framework/x86/boot-ims-common.vdex
system/framework/x86/boot-framework-atb-backward-compatibility.vdex
Change-Id: Idf0541908059c454348181d90b0b3e5d6d350057
Test: art/test/testrunner/run_build_test_target.py art-linux-bionic-x64
with TARGET_BUILD_UNBUNDLED enabled in the build scripts
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
with TARGET_BUILD_UNBUNDLED enabled in chroot on device
Bug: 157549171
Change-Id: I124c341d1801c4afa22f836dd567019de3e9498e
This reverts commit b0dc851ff4.
Reason for revert: relanding original change. Build failures were
caused by a race with another CL: https://r.android.com/1320920
Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Ic9016582dae7773b4d4f84a63425f1ef7a5d061f
This is a prerequisite change before adding DexJarInstallPath.
Test: lunch aosp_cf_phone-userdebug && m
Change-Id: I033e08b8bb06c0a844a6bbbfcdc48ce33e9c95cf
Switching an updatable boot jar from java_library to java_sdk_library
changed the contents of the updatable-bcp-packages.txt due to the code
requiring the module to be *Library. This change updates that to allow
it to be any module that implements the
PermittedPackagesForUpdatableBootJars interface which is *Library and
anything that embeds that like *SdkLibrary.
Bug: 155164730
Test: m droid and check the contents of system/etc/updatable-bcp-packages.txt
Change-Id: I464af74628da311734f102f77ec8158daec5b32d
The first component is the apex name, or a special name "platform"
if the boot jar is a platform jar rather than a part of some apex.
This is a prerequisite change for moving core-icu4j to a separate
com.android.i18n apex.
Old one-column format is still supported, but all unqualified
components of PRODUCT_BOOT_JARS get "platform:" prepended to them
after reading the product makefiles.
Test: aosp_walleye-userdebug boots
Bug: 138994281
Change-Id: Ic229159fdcdaf6182210a53b63850a389dd786fc
For a given variant of a module that implements ApexModule interface,
the "updatable" property tests if this variant comes from an updatable
apex. For platform variants it is always false.
Test: lunch aosp_walleye-userdebug && m nothing
Bug: 138994281
Change-Id: I2d4c54fb397e29dc9b3203be7fb17be4536529f7
This is to guard against the potential situation when someone adds
updatable modules to the list of boot jars by mistake.
Test: aosp_walleye-userdebug builds.
Test: Manually break the checks and observe the errors:
- move updatable module 'conscrypt' from
PRODUCT_UPDATABLE_BOOT_JARS to ART_APEX_JARS:
internal error: module 'conscrypt' from updatable apex 'com.android.conscrypt' is not allowed in the ART boot image
- add updatable module 'conscrypt' to ART_APEX_JARS
(but do not remove it from PRODUCT_UPDATABLE_BOOT_JARS):
error: A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but conscrypt is.
- move updatable module 'framework-tethering' from
PRODUCT_UPDATABLE_BOOT_JARS to PRODUCT_BOOT_JARS:
internal error: module 'framework-tethering' from updatable apex 'com.android.tethering' is not allowed in the framework boot image
- add non-updatable (in AOSP) module 'android.net.ipsec.ike'
to PRODUCT_BOOT_JARS:
internal error: failed to find a dex jar path for module 'com.android.ipsec.ike', note that some jars may be filtered out by module constraints
Bug: 147579140
Change-Id: I25ca2f52530fcfa1f9823b2cfa3485db9c0d0db1
Make `permitted_packages` mandatory for updatable boot class
path jars. Collect the permitted_packages from those jars to
a file installed as /system/etc/updatable_bcp_packages.txt .
Test: aosp_taimen-userdebug boots.
Test: adb shell cat /system/etc/updatable-bcp-packages
Test: Manual, remove permitted_packages from framework-tethering,
build fails.
Bug: 151314205
Change-Id: I21def97ace9081e707910d449943c683189f16cf
ART tests require that "out/host/linux-x86" is included.
This requires making the dexLocations per-variant specific.
Test: m test-art-host-gtest
Bug: 147817558
Bug: 147819342
Change-Id: I7839ee15cb6dfc62508bdd3fa0f306336af17055
Implement support of dumping host boot.art.
That was not possible before because imageLocation is different on host.
This CL makes imageLocation per-variant so can access for the host variant.
Test: m dump-oat-boot
Change-Id: Id82161e4901a6b77f220238aec460b8609fd765f
Revert submission 1254009-vdex-symlinks
Reason for revert: This causing some devices to fail to boot. See b/151836042 for details.
Reverted Changes:
Iced89071b:Expect vdex files in a target-independent director...
Ifbceb8457:Share vdex files in the ART apex between architect...
Change-Id: I5bd88f8e61d442eed921d840c90777a2750ddb16
Test: aosp_walleye-userdebug boots.
Test: Check symlinks to *.vdex files in the ART apex:
$ adb shell 'find /apex/com.android.art -name '*.vdex' | xargs ls -l'
lrw-r--r-- 1 system system 23 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-apache-xml.vdex -> ../boot-apache-xml.vdex
lrw-r--r-- 1 system system 25 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-bouncycastle.vdex -> ../boot-bouncycastle.vdex
lrw-r--r-- 1 system system 23 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-core-icu4j.vdex -> ../boot-core-icu4j.vdex
lrw-r--r-- 1 system system 24 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-core-libart.vdex -> ../boot-core-libart.vdex
lrw-r--r-- 1 system system 19 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-okhttp.vdex -> ../boot-okhttp.vdex
lrw-r--r-- 1 system system 12 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot.vdex -> ../boot.vdex
lrw-r--r-- 1 system system 23 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-apache-xml.vdex -> ../boot-apache-xml.vdex
lrw-r--r-- 1 system system 25 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-bouncycastle.vdex -> ../boot-bouncycastle.vdex
lrw-r--r-- 1 system system 23 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-core-icu4j.vdex -> ../boot-core-icu4j.vdex
lrw-r--r-- 1 system system 24 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-core-libart.vdex -> ../boot-core-libart.vdex
lrw-r--r-- 1 system system 19 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-okhttp.vdex -> ../boot-okhttp.vdex
lrw-r--r-- 1 system system 12 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot.vdex -> ../boot.vdex
-rw-r--r-- 1 system system 1229 1970-01-01 01:00 /apex/com.android.art/javalib/boot-apache-xml.vdex
-rw-r--r-- 1 system system 2043 1970-01-01 01:00 /apex/com.android.art/javalib/boot-bouncycastle.vdex
-rw-r--r-- 1 system system 2883 1970-01-01 01:00 /apex/com.android.art/javalib/boot-core-icu4j.vdex
-rw-r--r-- 1 system system 865 1970-01-01 01:00 /apex/com.android.art/javalib/boot-core-libart.vdex
-rw-r--r-- 1 system system 395 1970-01-01 01:00 /apex/com.android.art/javalib/boot-okhttp.vdex
-rw-r--r-- 1 system system 7125 1970-01-01 01:00 /apex/com.android.art/javalib/boot.vdex
Bug: 150934453
Change-Id: Ifbceb845749f4c218693f4118e8b35b59ff26de1
Follow-up to CL/1235086 which renamed the rules.
Preserve the name for target since ART tests depends on it.
Test: m dump-oat-boot-x86
Change-Id: I67c7ea9e99fea24f089d38856811bfa320258b54
This will allow us to remove the core.art image compiled in make.
Test: lunch aosp_x86_64 && m test-art-host-gtest
Bug: 147817558
Bug: 147819342
Change-Id: I864f72198d875dc1421c9c029a683bafbe7b71ac
We plan to add boot image variants for host tests.
Distinguishing the variants by arch does not work,
since both host and device can have the same arch.
Change-Id: Iea73c77367affb074f97a0fc318389417ce537da
Also disable dexpreopting for host. These are necessary to avoid adding
dependencies on dex2oat in various non-platform builds where they will
break.
Since we cannot assume at least one module enables dexpreopting now,
the two dexpreopt singletons are silently disabled if there has been no
call to dexpreopt.GetGlobalSoongConfig.
Bug: 145934348
Bug: 148312086
Bug: 148319588
Bug: 148690468
Test: m
Test: env OUT_DIR=out-tools prebuilts/build-tools/build-prebuilts.sh
on the aosp-build-tools branch
Test: build/soong/soong_ui.bash --make-mode static_sdk_tools dist DIST_DIR=out-dist BUILD_HOST_static=1
on internal (cf b/148312086#comment8)
Test: build/soong/soong_ui.bash --make-mode dist DIST_DIR=out-apps TARGET_BUILD_APPS=Launcher3 TARGET_BUILD_VARIANT=userdebug
on internal without art/ and external/vixl/ (cf b/148319588)
Change-Id: I240dade7204b87fc2d12181534ab23439eca8b46
dexpreopt package.
Preparation for a future CL that will need to get the make-written
GlobalConfig from within dexpreopt.
Also rename the Load*Config functions to Parse*Config, since they don't
actually load the config files anymore.
This relands https://r.android.com/1211982.
Bug: 145934348
Test: m
Change-Id: Icb9332a93811d77d2d8b06e983b92501b180a358
caching of it.
Introduce a Once cache for GlobalSoongConfig to allow it to get binary
tool paths from ordinary module dependencies (coming in a future CL)
that are then reused in singletons.
This relands https://r.android.com/1205729.
Bug: 145934348
Test: m
Change-Id: I039d6e204bee5ddc16d8e2d85057fbec20e326fe
The primary image name should be "boot.art" in case of
"boot-framework.art", and "apex.art" in case of "apex-framework.art".
Although "boot.art" and "apex.art" are identical binaries, dex2oat
has hard-coded logic based on the image name.
This has been broken since boot image extension has been enabled for
JIT-zygote config in CL I5493e575ebf90bad1d5ad2850004d54590bbc079.
Test: compare boot-framework.art and apex-framework.art,
they were identical before this CL, and differ after this CL.
Test: JIT-zygote config boots, steps 1-2:
1. Temporarily enable Jit zygote in the product device config (in
this case device/google/muskie/aosp_walleye.mk):
+# System server should not contain compiled code.
+PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := verify
+
+# Use the apex image for preopting.
+DEXPREOPT_USE_APEX_IMAGE := true
+
+# Have the runtime pick up the apex image.
+PRODUCT_PROPERTY_OVERRIDES += \
+ dalvik.vm.boot-image=/apex/com.android.art/javalib/apex.art:/system/framework/apex-framework.art
2. Build and flash:
$ lunch aosp_walleye-userdebug && m \
&& adb reboot bootloader && fastboot flashall -w
Change-Id: I98de271852ecc33feb9fd4c9b0addf0feba01856
Revert submission 1211982-dex2oat-soong-dep
Reason for revert: Build failures. See b/148312086.
Reverted Changes:
Ibc427a9a8: Make dex2oat(d) visible for use as implicit dexpre...
I71df11c1e: Move the Once cache for dexpreopt.GlobalConfig int...
I38317f2d5: Get the dex2oat host tool path from module depende...
I440a09dba: Separate dexpreopt.GlobalSoongConfig to allow inde...
Bug: 148312086
Bug: 145934348
Exempt-From-Owner-Approval: Plain revert
Change-Id: Ice3990225635a737e49e9aed7373f06516fccea3
Revert submission 1211982-dex2oat-soong-dep
Reason for revert: Build failures. See b/148312086.
Reverted Changes:
Ibc427a9a8: Make dex2oat(d) visible for use as implicit dexpre...
I71df11c1e: Move the Once cache for dexpreopt.GlobalConfig int...
I38317f2d5: Get the dex2oat host tool path from module depende...
I440a09dba: Separate dexpreopt.GlobalSoongConfig to allow inde...
Bug: 148312086
Bug: 145934348
Exempt-From-Owner-Approval: Plain revert
Change-Id: I6b656afb5feaad70d958b9d38b6c6eab7b03fba1
package.
Preparation for a future CL that will need to get the make-written
GlobalConfig from within dexpreopt.
Also rename the Load*Config functions to Parse*Config, since they don't
actually load the config files anymore.
Bug: 145934348
Test: m
Change-Id: I71df11c1e042ca8135d273a7263e9539ea3cd68f
it.
Introduce a Once cache for GlobalSoongConfig to allow it to get binary
tool paths from ordinary module dependencies (coming in a future CL)
that are then reused in singletons.
Bug: 145934348
Test: m
Change-Id: I440a09dba7d337965a196527566b0966a18e3653
The dexpreopt global config is now split into the part that is generated
from make (in build/make/core/dex_preopt_config.mk) and the part that is
generated from Soong. Since the goal is to generate the dex2oat path from
Soong dependencies, the old GlobalConfig.Tools struct is simply repurposed
for the Soong generated config, although the intention is to allow more
settings to migrate from make to Soong, and hence from GlobalConfig to
GlobalSoongConfig.
Since the new dexpreopt_soong.config is written from a Soong-created ninja
rule, it doesn't need to be rewritten to out/soong/<device>/ like the old
make-created config file.
Test: m
Test: env USE_DEX2OAT_DEBUG=false m
(check that out/soong/dexpreopt_soong.config points to dex2oat instead of dex2oatd)
Bug: 145934348
Change-Id: Ifd45c4a08e2ec55b86f4a93f0d85bd39cf2cf189
Earlier CL Ida40dfae8c83bf7c2e737d5c7ea418e1197ad826 introduced
Soong-generated Make variable 'DEXPREOPT_IMAGE_LOCATIONS'. That CL was
erroneous in that it did not take JIT-zygote config into account and
generated identical location for "boot" and "apex" boot images.
This caused build breakages, because in case of JIT-zygote config the
two variables 'DexPreoptImages' and 'DexPreoptImageLocations' in the
module's dexpreopt.config were out of sync: 'DexPreoptImages' was
for the "apex" image, and 'DexPreoptImageLocations' was for the "boot"
image.
CL I9a91fc48e54d7d43abec2cb2b5a11e3581db380b introduced a workaround
for this problem: incorrect 'DexPreoptImageLocations' from the module
dexpreopt.config was ignored, and instead boot image location was
manually reconstructed from 'DexPreoptImages'. This workaround would
not work when we start using boot image extension and location will
become more complex.
This CL fixes the way 'DexPreoptImageLocations' is generated by
spliting the 'DEXPREOPT_IMAGE_LOCATIONS' variable in two variables
depending on the boot image flavour "boot" of "apex". This is
aligned with the way other similar variables are generated.
Test: aosp_walleye-userdebug boots.
Test: walleye_jitzygote-userdebug builds
(on git_rvc-release branch with this CL cherry-picked).
Change-Id: I93415227564522bce4250d281d561e708a022101
Previous CL Ia9b34aa92ebb1b4de96ea0f8f290d798be19b2cf introduced
asymmetry in handling "boot" and "apex" boot images: in JIT-zygote
experiment, though the "apex" boot image was installed, the "boot"
boot image was still used for generating dexpreopt configs.
It is unclear why this asymmetry was needed at that point; it seems
incorrect to use different boot images for dexpreopting and for
installing on device. After recent changes the asymmetry started
breaking walleye_jitzygote-userdebug on git_rvc-release, because APK
dexpreopt commands refer to inexistent boot image files.
Test: lunch aosp_walleye-userdebug && m
Test: cherry-pick CL in internal, walleye_jitzygote-userdebug boots
Change-Id: Id877c10269cf79caf6ae74b1dc169a31e6a2211b
This reverts commit 4d2eeed0da.
Reason for revert: breaks avd/avd_boot_health_check test
on cf_x86_phone-userdebug_coverage on branch rvc-release
(the device fails to boot).
Test: m
Test: aosp_walleye-userdebug boots
Bug: 145749668
Exempt-From-Owner-Approval: revert
Change-Id: Ie1d93a200222e26461c1bcd384fdb69b7351e259
This was broken after CL:
Ida40dfae8c83bf7c2e737d5c7ea418e1197ad826
..which split boot image into primary and extension.
The argument to oatdump was not updated properly.
The old form before the split was:
--image=out/soong/generic_x86/dex_bootjars/system/framework/boot.art
The new form after the split is:
--image=out/soong/generic_x86/dex_artjars/apex/com.android.art/javalib/boot.art:out/soong/generic_x86/dex_bootjars/system/framework/boot-framework.art
Test: lunch aosp_x86-userdebug && m dump-oat
Test: Manually inspect build command to make sure correct image
location is used:
$ fgrep -e 'oatdump' $ANDROID_BUILD_TOP/out/soong/build.ninja | egrep -e '--image[^ ]*' -o
--image=out/soong/generic_x86/dex_artjars/apex/com.android.art/javalib/boot.art:out/soong/generic_x86/dex_bootjars/system/framework/boot-framework.art
Change-Id: I54a5146c404aefb6eaeadbe3e9363db935ecad86
This patch splits the system boot image in two parts:
- The ART boot image. This is the primary boot image that is
included in the ART apex and contains dexpreopted Core Libraries.
- The framweork boot image extension. It depends on the ART boot
image and contains framework libraries.
The third "apex" boot image (used in the JIT-zygote experiment)
remains unchanged; it is a monolithic primary boot image that
contains both libcore and framework libraries.
Dexpreopting of APKs now uses the framework boot image extension
(which in turn pulls in the ART boot image as a dependency).
Test: m
Test: phone boots:
lunch aosp_walleye-userdebug && m \
&& adb reboot bootloader && fastboot flashall -w
Bug: b/119800099
Exempt-From-Owner-Approval: rebased after getting approval.
Change-Id: Ida40dfae8c83bf7c2e737d5c7ea418e1197ad826
This reverts commit bf0e47648a.
Reason for revert: coverage build with EMMA_INSTRUMENT_FRAMEWORK=true
is fixed by inspecting the environment variable and not generating
boot image in case it is set.
Dexpreopt artifacts for the libcore part of the boot class path are
now packaged in the ART apex. The system image still contains
dexpreopt artifacts for the full set of boot class path libraries
(both libcore and framework); the libcore part will be removed and
boot image extension will be used in a follow-up CL.
Since this is specific to the ART apex and makes no sense for other
apexes, the implementation adds a boolean flag "is ART apex" rather
than a new apex module property.
Build rules for the new set of dexpreopt artifacts are created using
a new variant of the global boot image config. Previously we had two
variants: "default" (for the system image) and "apex" (for the
JIT-zygote experiment). This patch adds a third "art" variant.
Test: m
Test: m art/build/apex/runtests.sh
Bug: 144091989
Change-Id: I113c0d39222d6d697cb62cd09d5010607872fc2b
This reverts commit 24babe3a66.
Build failures are fixed after reworking the patch:
- 'missing dependencies' on aosp-master-art branch is fixed by
disabling profile generation in case default profile is not
found (it is part of framework absent in aosp-master-art)
- invalid dex2oat invocation should no longer happen after
disabling dexpreopt on targets that do not use default ART config
(fixed in CL If2d4fe2cdcb6a81c7c6d730d18c2b681a74fb0b7)
Dexpreopt artifacts for the libcore part of the boot class path are
now packaged in the ART apex. The system image still contains
dexpreopt artifacts for the full set of boot class path libraries
(both libcore and framework); the libcore part will be removed and
boot image extension will be used in a follow-up CL.
Since this is specific to the ART apex and makes no sense for other
apexes, the implementation adds a boolean flag "is ART apex" rather
than a new apex module property.
Build rules for the new set of dexpreopt artifacts are created using
a new variant of the global boot image config. Previously we had two
variants: "default" (for the system image) and "apex" (for the
JIT-zygote experiment). This patch adds a third "art" variant.
Bug: 143594594
Bug: 143593500
Test: m
Test: m com.android.art deapexer \
&& find $ANDROID_BUILD_TOP -type f -name 'com.android.art.*.apex \
| xargs deapexer | grep boot \
Expect to find javalib/$ARCH/boot*.{art,oat,vdex} files.
Test: m art/build/apex/runtests.sh
Change-Id: Ib37acaec8401bd23c8d547dadf773565406ef448
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: If2d4fe2cdcb6a81c7c6d730d18c2b681a74fb0b7
62c7829595c0df53e96addcd347c11ac01012eee introduced the new stem
property to java modules, but it wasn't propagated to Make. Fixing the
problem.
This change also fixes a problem that (module name) == (file name) is
assumed in dexpreopt_config.go, which no longer is the case. A mutator
runs to build a map from module name to its stem. The map is then used
when filling up the file paths in the bootImageConfig struct.
Bug: 139391334
Bug: 143494499
Test: m
Test: BootImageProfileTest
Change-Id: Idbc894f877692401471130de6cbfe5e0dd129da9
This reverts commit d5df949385.
Bug: 143594594
Bug: 143593500
Reason for revert: Some builds are failing.
Change-Id: I69986b472bce39266095e526fcd7ef5f48ece85e
Exempt-From-Owner-Approval: Going back to green.
This patch adds dexpreopt files for the libore part of the
bootclasspath to the ART apex.
Since this is specific to the ART apex and makes not sense for other
apexes, the patch does not add a new module property, but only a
boolean flag denoting that this is an ART apex.
Dexpreopt artifacts packaged into the ART apex differ from those that
are packaged in the system image: it inludes only the libcore part of
bootclasspath jars, but not the framework part. When the boot image
extension is implementd, dexpreopt artifacts for the libcore jars will
be removed from the system image (but for now they are both in the
apex and in the system image).
Build rules for the new set of dexpreopt artifacts are created using
a new variant of the global boot image config. Previously we had two
variants: "default" (for the system image) and "apex" (for the
JIT-zygote experiment). This patch adds the third "libcore" variant.
Test: m
Test: m com.android.art deapexer \
&& find $ANDROID_BUILD_TOP -type f -name 'com.android.art.*.apex \
| xargs deapexer | grep boot \
Expect to find dexpreopt/$ARCH/boot-art*.{art,oat,vdex} files.
Test: m art/build/apex/runtests.sh
Change-Id: I353ef90304bc5e18c3055ea379b3b223e5c38948
Reduce boot image space taken from 28803072B -> 9572352B (-20MB).
No reason to have this be configurable yet.
Test: ls -l $OUT/system/framework/*/apex*.art | awk '{s += $5} END {print s}'
Bug: 77863440
Change-Id: I280b740dfbd001109ce1e288e395595f21567aa6
Replace the common pattern of:
cmd.Tool(ctx.Config().HostToolPath(ctx, "tool"))
with:
cmd.BuiltTool("tool")
And similarly for PrebuiltBuildTool.
Test: m checkbuild
Change-Id: I7d63188505362c7df6a3b3e7330b4a2cca5a2409
Instead of just depending on the main .art file (boot.art, etc), also
expose the dependencies to the .oat/.vdex files (boot.oat/boot.vdex),
and all of the module files that get implicitly loading (boot-ext.*,
boot-framework.*, etc)
This is necessary for RBE, where the rule only gets the files that it
depends upon.
Test: treehugger
Test: build a system image with RBE
Change-Id: I0c7051f18582f1891d3398b46763b1521e4326c8
Writing $OUT/dexpreopt.config during build setup and then using
it during the build causes bad incremental builds if a cleanspec
removes $OUT/dexpreopt.config. Create a rule in Soong to write
out a copy so that it is a normal build artifact.
Bug: 132379813
Test: m checkbuild
Change-Id: I7755a7f8c1d6561fc83022a7f4cf7e4a64e989c9
aosp_cf_x86_phone uses SecondArchIsTranslated, which was leaving
a dangling rule from the oatdump rules to
out/soong/vsoc_x86/dex_bootjars/system/framework/arm/boot.art.
Consolidate the code to select targets for dexpreopting and use it
in more places to prevent references to boot images that were not
generated.
Test: m checkbuild
Change-Id: Ia4945a99ff5e575e759299106559c85f38489acc
This allows us to build guest libraries for the native bridge for
arm/arm64 architectures.
Bug: http://b/77159578
Test: make
Change-Id: I35520ca456105ddadd456c78a4eb1e6de39147c5
Create a zip file containing the zipped boot image files.
Test: m out/soong/sailfish/dex_bootjars/boot.zip
Change-Id: I1b08c9aca962a5999585cbe9e665693ef4558524
Add a module type for importing a prebuilt jar that contains
classes.dex files.
Test: m with a prebuilt jar that contains classes.dex files in
PRODUCT_BOOT_JARS
Test: java_test.go, dexpreopt_test.go, dexpreopt_bootjars_test.go
Bug: 124804356
Bug: 125517186
Change-Id: I496848f9dca11f758d49b1cb68168cec7f8e1718
Follow the change to blueprint to make *Escape take and return a string
and add *EscapeList that take and return slices of strings. Fix up
a few places that were unnecessarily converting a string to a slice
and back to a string.
Test: m nothing
Change-Id: I3fa87de175522205f36544ef76aa2f04aef1b936
The boot image oatdump rules depend on the details of dexpreopting
the boot image. Instead of exporting all of the necessary values
to make, move the rules into Soong instead. Also removes the
ART_DUMP_OAT_PATH variable, and moves the output to
out/soong/boot.*.oatdump.txt.
Test: m dump-oat-boot
Change-Id: I055b1c39918ba3425c8393b3e1b5359df055472a
Otherwise we get:
internal error: panic in GenerateBuildActions for singleton dex_bootjars
interface conversion: interface is nil, not android.WritablePath
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I9d8484994d1b5120f0187861a8acaf20e94827f6