Commit graph

32 commits

Author SHA1 Message Date
Paul Duffin
c059c8c9a0 Add java.RegisterRequiredBuildComponentsForTest function
Insulate tests that exercise code in the java package from having to
register the build components provided by the java package by providing
a single function that registers them all. This follows the pattern
currently used in the cc and rust packages.

This change is in preparation for switching the dex_bootjars singleton
from a singleton, which does not require a module definition in order
to be instantiated, to a singleton module which does. That will require
adding a module definition into java.GatherRequiredDepsForTest() and
this change ensures that the required components will have been
registered in every test.

Bug: 177892522
Test: m nothing
Change-Id: I6475db8240894947dd07c89a940a3e4f201aa598
2021-01-21 11:47:32 +00:00
Colin Cross
ae8600b507 Pass Config to NewTestContext instead of ctx.Register
Prepare for using Config when adding singletons by passing
Config to NewTestContext and NewContext instead of to ctx.Register.
This will enable a followup change to store SingletonMakeVarsProviders
registered on the Context in the Config, which is necessary to run
multiple tests in parallel without data races.

Test: all soong tests
Change-Id: Id229629a4e42ff4487d317241673837726c075fc
2020-11-12 10:07:49 -08:00
Paul Duffin
e10dfa4e3d Cleanup usages of CreateConfiguredJarList
After previous refactorings the CreateConfiguredJarList function is now
only used in tests and are supplied with a PathContext that will cause
ReportPathErrorf() to panic. So, this change removes the ctx parameter,
calls panic directly on any error and renames the method to make it
clear that it is for testing only.

Bug: 171479578
Test: m nothing
Change-Id: Icfb4bdfe720afa855b64ecf0e74a0b030882d029
2020-10-27 10:36:29 +00:00
Martin Stjernholm
ea581fc95d Move the intermediate directory for ART boot images.
Free up the directory $(PRODUCT_OUT)/apex/com.android.art for the
release ART APEX. Without this we'll get conflicting install paths in
make.

Test: build/soong/soong_ui.bash --make-mode \
    TARGET_PRODUCT=sdk_x86_64 TARGET_BUILD_VARIANT=userdebug nothing
  with http://r.android.com/q/topic:release-apex-rename+author:mast
  present to rename the ART release APEX to com.android.art.
Test: Build & boot on CF
Test: apct/device_boot_test and asit/perf/boottime_test on
  blueline_jitzygote-userdebug
Test: avd/avd_boot_health_check on cf_x86_phone-userdebug_coverage_art
Bug: 169639321
Change-Id: I0b263d5922d438834e5c804e55f69a2a1421ab73
Merged-In: I0b263d5922d438834e5c804e55f69a2a1421ab73
2020-10-19 20:42:46 +01:00
Colin Cross
405af07859 Revert "Make lots of tests run in parallel"
This reverts commit 323dc60712.

Reason for revert: Possible cause of test instability
Bug: 170513220
Test: soong tests

Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-09 18:34:24 -07:00
Colin Cross
323dc60712 Make lots of tests run in parallel
Putting t.Parallel() in each test makes them run in parallel.
Additional t.Parallel() could be added to each subtest, although
that requires making a local copy of the loop variable for
table driven tests.

Test: m checkbuild
Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2020-10-06 15:12:22 -07:00
Ulya Trafimovich
249386ad69 Add structured representation for colon-separated jar lists.
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
2020-08-05 09:59:30 +01:00
Ulya Trafimovich
9ab4933a1c Remove host boot image from boot.zip.
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
2020-06-10 15:54:23 +01:00
Ulya Trafimovich
5006d8d4f7 Fix TestDexpreoptBootZip on non-Linux hosts.
The test was written with the assumption that the build OS is
Linux, which is not always the case (the test was broken on Darwin).

Test: m nothing (on Linux host)
Bug: 157192627
Change-Id: I6ae3deed7a3342f4526528f29ce0a299d24b464b
2020-05-21 09:39:24 +00:00
Ulya Trafimovich
86d9e3a7b7 Add a test for boot.zip (zip archive with boot image files).
Test: m nothing
Bug: 152593075
Change-Id: Ibd07bdbd7d66312d32c9f461a082ffbba7112030
2020-05-19 11:19:20 +01:00
Ulya Trafimovich
50c4a4b19f Use two-column format for PRODUCT_BOOT_JARS components.
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
2020-04-30 14:42:32 +01:00
Ulya Trafimovich
b28cc3758c Forbid generating boot image files for jars in updatable modules.
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
2020-04-07 17:09:59 +01:00
David Srbecky
7f8dac1254 Generate the ART boot image for host as well (used by ART tests).
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
2020-03-10 13:35:27 +00:00
Martin Stjernholm
40f9f3c061 Reland: Move the Once cache for dexpreopt.GlobalConfig into the
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
2020-02-13 17:46:48 +00:00
Hans Boehm
453bf09853 Revert "Move the Once cache for dexpreopt.GlobalConfig into the ..."
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
2020-01-27 13:44:03 +00:00
Martin Stjernholm
dae8a80426 Move the Once cache for dexpreopt.GlobalConfig into the 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.

Bug: 145934348
Test: m
Change-Id: I71df11c1e042ca8135d273a7263e9539ea3cd68f
2020-01-24 22:18:42 +00:00
Ulyana Trafimovich
5a4ccd1816 Revert^2 "Use boot image extension for framework libraries."
This reverts commit 3fae7662ee
Reason: re-applying the change after resolving the problem with
coverage builds (in a related CL).

Use boot image extension for framework libraries.
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 framwework 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).

Bug: 146462581
Bug: 119800099

Test: aosp_walleye-userdebug boots.

Change-Id: I06c5ac5fca011fa639ed208735462ab32451df3a
2020-01-08 15:56:52 +00:00
Colin Cross
98be1bb00f Move filesystem into Config
The filesystem object was available through ModuleContext.Fs(), but
gives too much access to the filesystem without enforicing correct
dependencies.  In order to support sandboxing the soong_build
process move the filesystem into the Config.  The next change will
make it private.

Bug: 146437378
Test: all Soong tests
Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
2019-12-18 08:19:10 -08:00
Ulyana Trafimovich
3fae7662ee Revert "Use boot image extension for framework libraries."
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
2019-12-11 18:29:19 +00:00
Ulya Trafimovich
4d2eeed0da Use boot image extension for framework libraries.
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
2019-12-03 13:59:25 +00:00
Colin Cross
4b49b768a2 Make TestContext.RegisterModuleType take an android.ModuleFactory
Avoid having to pass ModuleFactoryAdaptor to every call to
RegisterModuleType in a test by wrapping RegisterModuleType.

Test: all soong tests
Change-Id: If8847d16487de0479cc3020b728256922b3cadba
2019-11-25 10:59:44 -08:00
Ulyana Trafimovich
de534414b3 Revert^4 "Package dexpreopt artifacts for libcore jars in the ART apex."
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
2019-11-08 12:48:53 +00:00
Ulyana Trafimovich
bf0e47648a Revert^3 "Package dexpreopt artifacts for libcore jars in the ART apex."
Reason for revert: breaks the coverage build.
Exempt-From-Owner-Approval: revert

Change-Id: I4c3db7b085b101738813a7f3da6f0078bbaa587b
2019-11-07 16:23:47 +00:00
Ulyana Trafimovich
66b3e99649 Revert^2 "Package dexpreopt artifacts for libcore jars in the ART apex."
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
2019-11-07 10:34:45 +00:00
Martin Stjernholm
cc4b0ad706 Update dexpreopt for the ART APEX name change.
Test: Build & boot
Bug: 135753770
Exempt-From-Owner-Approval: Approved internally
Change-Id: I3aac9112b022cce3ef8cfdf4bdbbed8bb0c8f4c7
Merged-In: I3aac9112b022cce3ef8cfdf4bdbbed8bb0c8f4c7
2019-08-30 17:47:30 +01:00
Jaewoong Jung
f9a0443a9c Java test code clean-up
Remove unused parameters and make testJava return the config.

Test: Ran all java tests.
Change-Id: Iaa123f3fd93188e2f55452b887e1d340429cc710
2019-07-17 11:15:09 -07:00
Mathieu Chartier
6adeee1131 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 d3f688b521.

Change-Id: Ia8898d11d67e5f0c4d8886f13d29f5dbd5f8609b
2019-06-26 14:54:47 -07:00
Mathieu Chartier
d3f688b521 Revert "Remove option to create boot image based on preloaded classes"
This reverts commit 4a0473175e.

Reason for revert: NDK build broken

Change-Id: Id98bf9d5f82ed72d8c489264cf9d754e8ea1d27e
2019-06-26 16:44:38 +00:00
Mathieu Chartier
4a0473175e Remove option to create boot image based on preloaded classes
From now on, the only supported approach is to use a boot image profile.

Test: make

Change-Id: Ibd8fbd1dd81db0a7b3f3b3e626a70dcc26510224
2019-06-25 15:38:25 -07:00
Colin Cross
1d2cf0494a Add depfile support to RuleBuilder
Allow rules built with RuleBuilder to use depfiles.  Ninja only
supports a single depfile with single output.  If there are
multiple outputs in a rule, move all but the first to implicit
outputs.  If multiple depfiles are specified, use new support
in dep_fixer to combine additional depfiles into the first depfile.

Test: rule_builder_test.go
Change-Id: I7dd4ba7fdf9feaf89b3dd2b7abb0e79006e06018
2019-03-29 16:35:06 -07:00
Colin Cross
42be761ebd Add dex_import module type
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
2019-03-20 19:29:59 +00:00
Colin Cross
762286723a Add dexpreopt_bootjars_test.go
Add a test that exercises the dexpreopt_bootjars.go singleton.

Test: dexpreopt_bootjars_test.go
Change-Id: I01d4f6e22f6ff7b809af043391d7b6209dcb8675
2019-03-05 03:17:51 +00:00