Commit graph

1531 commits

Author SHA1 Message Date
Paul Duffin
00b2bfdea5 Move hidden API index file rule to platform_bootclasspath
This change moves the monolithic hidden API index file creation rule
from the hiddenAPIIndexSingleton into the platform_bootclasspath. It
also moves the corresponding test from java/hiddenapi_singleton_test.go
to java/platform_bootclasspath_test.go.

Bug: 179354495
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: Ia295d0f7ae9b51ea816f16921aa42339ed91704e
2021-04-14 18:54:29 +01:00
Jiyong Park
f398995a64 Merge "SdkSpec is fully using ApiLevel" 2021-04-14 13:27:05 +00:00
Paul Duffin
8f146b99e6 prebuilt_apex created ApexInfo must not include prebuilt_ prefix
As part of the work to modularize the hiddenAPI processing the
generation of the monolithic hidden API index file needs to be moved
to the platform_bootclasspath module type. Doing that broke the
TestBootDexJarsFromSourcesAndPrebuilts tests which checks the inputs to
the rule that creates that file. Fixing that required added a
platform_bootclasspath module to the test fixture for those tests which
highlighted an issue with the prebuilt_apex module.

Previously, when the prebuilt_apex created apex variants it would use
its own name as the apex variant name, even when that name included the
prebuilt_ prefix. That broke the platform_bootclasspath logic as it was
looking for apex variants for "myapex" but the only ones available were
"prebuilt_myapex".

This change ensures that it always uses the unprefixed name and fixes
the TestNoUpdatableJarsInBootImage to match. This also adds some
improved error reporting in platform_bootclasspath which helped debug
this problem.

Bug: 177892522
Test: m nothing
Change-Id: I3e88b5cec767f77dcc0e94b3ae38b499d07eadf0
2021-04-13 19:15:27 +01:00
Paul Duffin
60264a0b99 Improve realism of boot jar tests
Boot jars, updatable boot jars and art apex jars are part of two
separate but related configuration objects, the main Config struct
(actually the nested productVariables struct) and the dexpreopt
specific GlobalConfig. The fields in both are initialized from the same
data in the make config files but handled separately.

Previously each test that used one of the configuration objects would
generally just initialize the one it used. That would make the test
sensitive to the specific configuration object that was used. A
refactoring that change the code from using one configuration object to
the other would cause the test to fail.

Also, some tests would inadvertently create invalid configurations by
setting ArtApexJars without also setting BootJars. While the ability to
create invalid configurations is useful (and there are some tests that
exist to verify the behavior in that case) most tests should not be
using them.

This change simplifies the configuration of the tests and improves
their realism by:
1. Providing a new FixtureConfigureBootJars method that takes a set of
   boot jars and sets ArtApexJars, and BootJars in the
   dexpreopt.GlobalConfig and BootJars in the product variables too.
2. Providing a new FixtureConfigureUpdatableBootJars method that takes
   a set of boot jars and sets UpdatableBootJars in both the
   dexpreopt.GlobalConfig and productVariables.
3. Migrating existing tests to use these new methods.

Some tests still use the dexpreopt.FixtureSet...Jars() methods directly,
generally to create invalid configurations.

Bug: 177892522
Test: m nothing
Change-Id: I4d8f0b9762cfcc7ae6383bef08563d7c3fa13955
2021-04-13 14:48:34 +01:00
Liz Kammer
bda284bb19 Merge "Support paths for init_rc from Soong." 2021-04-12 19:05:27 +00:00
Jiyong Park
a417f881bd Merge "Shared lib dependencies from rlib are included in APEX" 2021-04-08 23:31:28 +00:00
Paul Duffin
49ab1d38de Merge "Allow platform_bootclasspath to specify contributing fragments" 2021-04-08 20:34:19 +00:00
Paul Duffin
d32118c5c4 Merge "Add dependencies from platform_bootclasspath to contents" 2021-04-08 20:34:03 +00:00
Paul Duffin
62d8c3b110 Allow platform_bootclasspath to specify contributing fragments
Adds the fragments property to the platform_bootclasspath to allow the
fragments that contribute to it to be specified.

Bug: 177892522
Test: m nothing
Change-Id: I14f83d9336f6984442c7315cc86dfdd0a0fd2d20
2021-04-08 18:53:04 +01:00
Paul Duffin
b432df9cda Add dependencies from platform_bootclasspath to contents
Adds a FinalDeps mutator to add dependencies from the
platform_bootclasspath to the configured boot jars which can be from
either the platform or any apex. It adds dependencies for every
configured boot jar, whether in ArtApexJars, BootJars or
UpdatableBootJars.

At the moment the dependencies are only used for testing purposes
but following changes will make more use of them.

Bug: 177892522
Test: m nothing
Change-Id: I981305bf45bc20539a3d36987252f490e2b885cc
2021-04-08 18:53:04 +01:00
Jiyong Park
94e22fd35e Shared lib dependencies from rlib are included in APEX
This change fixes a bug that shared lib dependencies of an rlib is not
installed to the APEX even when the rlib is part of the APEX.

Bug: N/A
Test: m
Change-Id: I88fe461584499839d8018d6b4292374592e7562b
2021-04-08 18:20:39 +09:00
Jiyong Park
9231537fe2 SdkSpec is fully using ApiLevel
Previously, SdkSpec was constructed only from the user string. It didn't
make use of the Config struct where information about the latest stable
SDK version, etc. is recorded. As a result, the build system couldn't
check if the sdk version "current" is referring to the in-development
(i.e.  not-yet-frozen) SDK version or the latest stable version.
"current" was always assumed to be in-development (IsPreview() returns
true) even when Platform_sdk_final == true.

As the first step for fixing that, this change requires
android.EarlyModuleContext to be passed when constructing SdkSpec from
the user string.

In the following changes, "current" will be mapped to either
FutureApiLevel (10000) or one of the FinalApiLevels() depending on
whether the platform SDK was finalized or not.

Bug: 175678607
Test: m
Change-Id: Ifea12ebf147ecccf12e7266dd382819806571543
2021-04-08 11:27:24 +09:00
Liz Kammer
0c4f71cd96 Support paths for init_rc from Soong.
The property init_rc accepts paths and references to other modules;
however, none of that is passed onto make, resulting in errors if a
non-local path is used.

Test: m
Bug: 184567830
Change-Id: Idbbf9de66c5182784d055e1cd64bcef34a7dbd79
2021-04-07 16:26:55 -04:00
Paul Duffin
f58fd9aec1 Add deapexer support for apex_set
Bug: 181267622
Test: m droid
Change-Id: I630f9f2c33d037bf4a7011d2131a7d28f213ae8b
2021-04-07 20:39:13 +01:00
Paul Duffin
2470467d42 Separate apex extraction from the ApexSet
This follows the same pattern as is used by the prebuilt_apex in order
to make files encapsulated with a prebuilt .apex file available for use
by the rest of the build. It separates the extraction of the
appropriate apex from the zip supplied to apex_set into a separate
module type whose output is used by the apex_set and will (in a follow
up change) be used by the deapexer module too.

Bug: 181267622
Test: m droid
Change-Id: Icd13ce1f21845494e875d3e092abd4a9d2efca57
2021-04-07 20:36:28 +01:00
Paul Duffin
dfd3326b65 Move deapexer related functionality to prebuiltCommon
Refactoring in preparation for adding deapexer support to apex_set.

Bug: 181267622
Test: m droid
Change-Id: I8e7661ff4cfbe68f62e14d3bdf20d9356934e351
2021-04-07 20:35:35 +01:00
Paul Duffin
11216db1d3 Separate apex selection from apex.Prebuilt
This dedups the apex selection (which was previously being done by both
the apex.Prebuilt module type and the Deapexer module type) by
separating it out into its own module.

The apex.Prebuilt module retrieves the selected apex from its
selected_apex property which is simply initialized with
":<selector-module-name>".

The Deapexer module retrieves the selected apex it should use from its
src property which is initialized in the same way. That makes it easy
for the Deapexer module to be reused by the apex_set in a similar way.

Bug: 181267622
Test: m droid
Change-Id: I90cfb55698d35a97dcf28b95afcb1f58584bc90c
2021-04-07 10:11:10 +01:00
Paul Duffin
56dc66e2ea Stop deapexer module type from being treated as a prebuilt
Previously, the private deapexer module type was treated as a prebuilt
as that was the quickest way to implement it. However, there is no
reason why it should be as there is no corresponding source module type
which it might replace.

This change removes the prebuilt support to simplify the module type in
preparation for future work. As part of that it extracts the logic for
retrieving a single path from a PrebuiltSrcsSupplier to ensure
consistent behavior.

Bug: 181267622
Test: m droid
Change-Id: I1b2bb49601c13a3fff99a0026c235eaa70d2e612
2021-04-07 10:09:58 +01:00
Paul Duffin
c0609c603c Make prebuilt_apex report an error if no apex file is found
Previously, if an appropriate src property was not specified it would
return "" which resolves to the top level directory. This change causes
it to report an error.

Bug: 181267622
Test: m droid
Change-Id: Ia5be324a0eff18e43b352d71c6768c8767986053
2021-04-07 10:07:37 +01:00
Paul Duffin
de21202bd2 Merge changes I45274836,I47268b81
* changes:
  Add PrebuiltNameFromSource
  Add IsModulePreferred
2021-04-07 09:04:18 +00:00
Ryan Prichard
3f3bb83f81 Merge "Remove libgcc toolchain libs for Android" 2021-04-06 21:43:33 +00:00
Paul Duffin
864116ce3f Add PrebuiltNameFromSource
Bug: 177892522
Test: m nothing
Change-Id: I45274836d59adbd6b2a2a848705b189398f1e766
2021-04-06 21:20:58 +01:00
Martin Stjernholm
ec00900f83 Allow dependencies from platform variants to APEX modules (reland).
When `test_for` dependencies are added from libraries to APEX modules,
they can be created from the platform variants of the libraries, since
those are used for building tests. Hence we need an alias from the
platform variant of the APEX module to have a target for those
dependencies.

This is only necessary for libraries that are split by the APEX
mutator, i.e. is a member of some APEX. Normally that's not the case
for test libraries, but there may be exceptions (read
com.android.art.testing).

This relands https://r.android.com/1654679 after decoupling it from the
topic that caused b/184239856.

Test: m nothing
Bug: 183882457
Change-Id: If643c75ce9bc25fa01ad9d1e3ba8e1d060d03bb2
2021-04-06 14:24:26 +01:00
Jiyong Park
f58c46e36f Don't use incorrect version names like VER or BOARD even in tests
All version names will go through ApiLevelFromUser which triggers an
error when the name is not a valid one.

Bug: 175678607
Test: m
Change-Id: Id33bf64085603914d45ad7942cb8908a4734493f
2021-04-05 09:32:06 +09:00
Ryan Prichard
c2018e2ed4 Remove libgcc toolchain libs for Android
Remove Android-targeting gcc toolchain libraries -- libgcc,
libgcc_stripped, libatomic, and libgcov. Also remove libunwind_llvm,
which is replaced with a libunwind toolchain prebuilt.

The __atomic_* library functions are now part of the compiler-rt
builtins library:

https://android-review.googlesource.com/c/toolchain/llvm_android/+/1625025

Bug: http://b/153025717
Test: treehugger
Change-Id: I971d0a4a49f1aaeb3546e80b6d94208277a171ac
2021-04-02 21:07:35 -07:00
Jiyong Park
f1691d2a2c Move java.sdkSpec to the android package
... in preparation for making the handling of sdk versions consistent
across java and cc modules.

Bug: 175678607
Test: m
Change-Id: I598f0454bce9b7320621022115412fbe97403945
2021-04-03 08:25:12 +09:00
Jaewoong Jung
d0afefa4b1 Merge "Revert "Revert "Add min_sdk_version to java_import.""" 2021-04-02 15:49:58 +00:00
Jaewoong Jung
56e12dbbaf Revert "Revert "Add min_sdk_version to java_import.""
This reverts commit 5ab6508008.

Reason for revert: Resubmitting Ie255f74d40432f4bdd0092d618705a7d17235e58 after fixing the broken targets.

Bug: 183695497
Test: https://android-build.googleplex.com/builds/forrest/run/L58600000849810513
Change-Id: I5f072f396002ca3a45bd530ad9be987efa732833
2021-04-02 04:55:27 +00:00
Jaewoong Jung
37a5d5ebd8 Merge "Revert "Add min_sdk_version to java_import."" 2021-04-02 00:34:06 +00:00
Jaewoong Jung
5ab6508008 Revert "Add min_sdk_version to java_import."
This reverts commit 6d15d63556.

Reason for revert: Broke git_sc-mainline-prod on test_suites_x86_64

Fixes: 184305592
Change-Id: I4b2e2675e0dd9e2e84966f545a52f45d5b731bab
2021-04-02 00:17:59 +00:00
Jaewoong Jung
51a0d85ebc Merge "Add min_sdk_version to java_import." 2021-04-01 19:45:53 +00:00
Nikita Ioffe
6f77314381 Merge "Revert "Allow dependencies from platform variants to APEX modules."" 2021-04-01 14:22:53 +00:00
Nikita Ioffe
d64139f8e5 Revert "Allow dependencies from platform variants to APEX modules."
Revert submission 1658000

Reason for revert: Breaks full-eng build: b/184239856
Reverted Changes:
I4f8ead785:Avoid internal APEX stubs for libsigchain and clea...
I68affdf69:Allow dependencies from platform variants to APEX ...
I54b33784e:Rename libdexfile_external_static to libdexfile_st...
Id68ae9438:libdexfile_external is being replaced by libdexfil...
I12ac84eb4:libdexfile_external is replaced by libdexfile.
If05dbffc8:Rename libdexfile_external_static to libdexfile_st...
Ia011fa3a8:Merge libdexfile_external into libdexfile.

Change-Id: If494dc5385042a4620a76a9eadc1613ae0eb1655
2021-04-01 10:58:24 +00:00
Paul Duffin
284165afb5 Remove apexFixtureFactory
Bug: 182885307
Test: m nothing
Change-Id: I88c58bf6b4adda4017e54548748897c51c3f3aa1
2021-04-01 10:31:07 +01:00
Martin Stjernholm
f8c9713fb8 Merge "Allow dependencies from platform variants to APEX modules." 2021-04-01 06:53:13 +00:00
Treehugger Robot
25c47a43a5 Merge ""current" is implicitly added to stubs.versions" 2021-04-01 04:53:55 +00:00
Jiyong Park
d4a3a137ed "current" is implicitly added to stubs.versions
So far, when a library `libfoo` has `stubs.versions: ["10", "11"]`, then
`shared_libs: ["libfoo"]` is linked to the version 11 of the stub.

This requires the author of `libfoo` to manually update the property
whenever a new version is introduced. Otherwise, clients are not able
to use the newly added APIs because the latest stub is for an old
version.

This change eliminates the need for manual updating. "current" version
is always implicitly added to `stubs.versions`. It is added even when
nothing is set on the property, if `stubs.symbol_file` is set. i.e.

```
cc_library {
    name: "libfoo",
    stubs: {
        symbol_file: "libfoo.map.txt",
	// no versions: [...] needed
    },
}

cc_library {
    name: "a_client",
    shared_libs: ["libfoo"],
    apex_available: ["myapex"],
    min_sdk_version: "29",
}

apex {
    name: "myapex",
    native_shared_libraries: ["a_client"],
    min_sdk_version: "29",
}
```

`a_client` links to the "current" stub of `libfoo` that has all symbols
shown in the map file.

Note that, above doesn't mean that the client has unlimited access to
APIs that are introduced even after the min_sdk_version of the client
(29 in this example). The use of such APIs still has to be guarded with
`__builtin_available` check.

Bug: N/A
Test: m
Change-Id: I70bb1600c18e74d36c6b24c3569d2149f02aaf96
2021-04-01 09:58:53 +09:00
Jaewoong Jung
6d15d63556 Add min_sdk_version to java_import.
Fixes: 183695497
Test: apex_test.go
Change-Id: Ie255f74d40432f4bdd0092d618705a7d17235e58
2021-03-31 16:50:42 -07:00
Paul Duffin
5560712323 Convert testDexpreoptWithApexes to use test fixtures
Bug: 181070625
Test: m nothing
Change-Id: Id40064c539c1d4eeb39396f0881a97529f3a3452
2021-03-31 16:16:20 +01:00
Paul Duffin
45338f05e3 Convert TestApexPermittedPackagesRules to use test fixtures
Adds PrepareForTestWithNeverallowRules to make it easy to test
neverallow rules. Avoid exporting any unnecessary neverallow related
methods from the android package.

Bug: 181070625
Test: m nothing
Change-Id: Idfc6955cb23f1a4d1790be7879388154b03f3980
2021-03-31 16:16:18 +01:00
Paul Duffin
afdd4061ee Rename OptionalPath.RelativeToPath -> RelativeToTop
Bug: 183650682
Test: m nothing
Change-Id: I95239c2273e715e8c4c15a4a02967e01f6913234
2021-03-30 20:06:22 +01:00
Paul Duffin
a71a67a4f5 Remove extraneous calls to TestingBuildParams.RelativeToTop()
Deprecated the method to try and prevent any other uses being added.

Bug: 183650682
Test: m nothing
Change-Id: Ia6f43851e5a00c9d96af780e3bd21e03175e1a2f
2021-03-30 20:03:22 +01:00
Paul Duffin
e8366da1f6 Automatically call TestingBuildParams.RelativeToTop()
Fixes the few tests that break due to this and which cannot easily be
separated into their own changes.

Bug: 183650682
Test: m nothing
Change-Id: Ia2f31213a1f114a78e66a81d89279ecde9f4c465
2021-03-30 19:35:35 +01:00
Paul Duffin
58367574a5 Merge "Add the transitive dependencies of boot_image to apex" 2021-03-30 16:42:07 +00:00
Paul Duffin
da0470d8c7 Merge "Stop JavaSdkLibrary_... tests requiring absolute path" 2021-03-30 16:35:23 +00:00
Paul Duffin
a33da07343 Merge "Remove buildDir from apex package" 2021-03-30 16:30:10 +00:00
Paul Duffin
8d3c44a986 Merge "Add contents property to boot_image (and prebuilt_boot_image)" 2021-03-30 16:26:20 +00:00
Martin Stjernholm
4d058c8809 Allow dependencies from platform variants to APEX modules.
When `test_for` dependencies are added from libraries to APEX modules,
they can be created from the platform variants of the libraries, since
those are used for building tests. Hence we need an alias from the
platform variant of the APEX module to have a target for those
dependencies.

This is only necessary for libraries that are split by the APEX
mutator, i.e. is a member of some APEX. Normally that's not the case
for test libraries, but there may be exceptions (read
com.android.art.testing).

Test: m nothing
Bug: 183882457
Change-Id: I68affdf69d7ec05c0ee8730e8ec04d7cb9e0e44a
2021-03-30 12:43:45 +01:00
Martin Stjernholm
38e9f0b82f Merge changes Iaa6411b5,I2118b8a2,Ibbdd3cbd,I2d1bbda2
* changes:
  Make test_for arch variant.
  Don't use APEX stubs between internal libs in the same APEX when building test_for modules.
  Add FilterListPred.
  Don't panic on "go test" invocations from the command line.
2021-03-30 09:26:36 +00:00
Paul Duffin
cf8d7db02b Stop JavaSdkLibrary_... tests requiring absolute path
Bug: 183650682
Test: m nothing
Change-Id: Ia6e5034bbf3920a9e1f8fc319dc722658f6cb1ce
2021-03-29 17:29:30 +01:00
Paul Duffin
37ba344e40 Remove buildDir from apex package
Bug: 182885307
Test: m nothing
Change-Id: I71cbfd79e2fb4b1cbd2914ffab76570548d57c61
2021-03-29 17:29:30 +01:00
Paul Duffin
4d101b60f0 Add the transitive dependencies of boot_image to apex
This avoids having to specify boot libraries in both the boot_image
and separately as java_libs on the apex. Simply add them to the
boot_image (happens automatically ATM when using image_name: "art")
and add the boot_image to the apex.

Bug: 177892522
Test: m nothing
Change-Id: I7e0c41665604b73780cdf0dc555067497b1e6ef0
2021-03-29 17:15:29 +01:00
Paul Duffin
82886d6cbf Add contents property to boot_image (and prebuilt_boot_image)
Allows boot_image modules to be created for any module that contributes
to the boot class path, e.g. core-i18n from the com.android.i18n.

A boot_image module with a contents property cannot specify an
image_name, and vice versa. Only those boot_image modules with an
image_name create .art, .oat and .vdex files, either in their
associated APEX or as part of the framework "boot" image.

Bug: 177892522
Test: m nothing
Change-Id: Idfc2bcf00dd6d3ed36ac4df46fcf18e8aa7e2c92
2021-03-29 17:15:27 +01:00
Paul Duffin
c7ef9892dd Add dependencies for art boot_image
Adds dependencies for the art boot image. The art boot image only
includes modules from the com.android.art APEX and so this change adds
some verification to make sure that the APEX component of the
configuration is compatible with the boot_image's apex_availabilty
settings and then just adds dependencies on the modules. It relies on
the normal APEX processing to cause the com.android.art variant of the
boot_image to depend on the equivalent variant of its contents.

This purposely does not check that the configuration specifies an APEX
of com.android.art and instead relies on the apex_available property
being set.

Bug: 177892522
Test: m nothing
Change-Id: I75a8238546b01e1f166a1d1444215f4afb441780
2021-03-29 17:13:29 +01:00
Paul Duffin
4b64ba05b6 Add bootclasspath_fragment as an alias for boot_image
This is part of the work to rename boot_image to bootclasspath_fragment
which is being done for two reasons:
1. To avoid clashing with the bootimg module type.
2. To better reflect what this represents.

While a bootclasspath_fragment can create what ART calls a boot image
(which is different to what the bootimg module type represents) it does
not have to do so.

Bug: 177892522
Test: m nothing
Change-Id: Ib45604be7adc790ded9e27a2ac812dd7522ca8db
2021-03-29 11:05:55 +01:00
Paul Duffin
9ea71c0f4f Make apex/boot_image_test.go more realistic
Previously it was unrealistic because the "boot" image cannot be added
to an apex (because it references modules from multiple different
apexes). Only the "art" image can be added to an apex. So, this change
switches to use the "art" image which requires the apex name is changed
to "com.android.art".

This change also adds an equivalent test for prebuilt_boot_image as
well as a check of the module dependencies for the mybootimage module.

Bug: 177892522
Test: m nothing
Change-Id: I20089b02c80bedc072dbb950dce09bc4e8397f3a
2021-03-29 11:05:55 +01:00
Paul Duffin
52bfaa43f9 Prune test preparers in apex/boot_image_test.go
Cut down the preparers to only those needed by these tests.

Bug: 177892522
Test: m nothing
Change-Id: I811977b0331dd38c25623aa96e09e85ba5cf7c57
2021-03-28 23:02:18 +01:00
Paul Duffin
396229f7cf Prevent apex from using preferred prebuilt_boot_image
Bug: 177892522
Test: m nothing
Change-Id: I8530ffa4c5123f6055a6ca25421c17bb6fc037f0
2021-03-28 23:02:18 +01:00
Martin Stjernholm
4e6c269de5 Don't use APEX stubs between internal libs in the same APEX when
building test_for modules.

This extends the current approach where test modules always depend on
the platform variants of the APEX libs, and only skips the stubs on
them. It still has the limitation that the internal libs must have the
exact same apex_available lists.

Also some improvement of the test accuracy in TestTestFor.

Test: m libartagent-target
  with http://r.android.com/q/topic:libdexfile-noext applied
Bug: 183217299
Change-Id: I2118b8a22c887077867a3ddbbe73437b4a29a6ad
2021-03-28 22:06:34 +01:00
Paul Duffin
db462dd987 Disallow non-existent paths in sdk package
Test behavior was changed a while ago so that tests by default ignore
non-existent source paths (unless they explicitly check for/rely on
them). Prior to that CheckSnapshot() could detect when files were
missing from the snapshot but it no longer can.

This change disallows non-existent source files in all the sdk tests
which means that they are disallowed when processing the snapshots as
they use the same preparers as were used to process the sources.

This caused a test failure which has been temporarily ignored and has
a TODO and bug associated with it.

Bug: 183184375
Test: m nothing
Change-Id: I969d8515d20ef5ae515f2b5f93d8ed4e4f8ede75
2021-03-25 12:53:22 +00:00
Paul Duffin
76e5c8a37f Convert test that disallows non existent paths to use fixtures
This change needed to add some additional files to the registered
files for PrepareForTestWithJavaDefaultModules because otherwise they
would fail when "TestAllowNonExistentPaths = false". Those files were
being added by the TestJavaLintRequiresCustomLintFileToExist (albeit in
some cases in different locations to that required by the default
modules but as the files are needed by the modules defined in
PrepareForTestWithJavaDefaultModules they should be defined in it.

A couple of other places also provided some files so moving them into
PrepareForTestWithJavaDefaultModules caused some conflicts which needed
to be resolved.

Bug: 183184375
Test: m nothing
Change-Id: I76ce9f1673c1c1c4000635b76b8377d582224bf1
2021-03-24 22:08:05 +00:00
Paul Duffin
b506c9dc11 Cleanup usages of Dex2oatDepTag
Creates a new deptag type for it so that it can implement the marker
interfaces that will exclude it from being added to the APEX and from
visibility enforcement. The latter is probably not an issue ATM because
the dependencies are added after visibility checks are enforced but
this code is undergoing lots of refactoring so that may change.

Bug: 177892522
Test: m nothing
Change-Id: Ibd167d557adec761a2e3eed78f4d334c40a04fb9
2021-03-24 14:34:40 +00:00
Paul Duffin
70d3bee3e0 Remove emptyFixtureFactory from apex and java
Bug: 183235980
Test: m nothing
Change-Id: I350b45e2f57430fb158f4141a566e75de17208cd
2021-03-22 18:31:53 +00:00
Paul Duffin
6bef6fee3c Merge "Ensure that DepIsInSameApex is not called for ExcludeFromApexContentsTag" 2021-03-22 18:30:10 +00:00
satayev
2b077baa5e Merge changes from topic "move_allowed_deps_txt"
* changes:
  Treat allowed_deps.txt source file as optional.
  Move allowed_deps.txt to packages/modules/common.
2021-03-22 10:48:45 +00:00
Paul Duffin
4c3e8e2d67 Ensure that DepIsInSameApex is not called for ExcludeFromApexContentsTag
The ExcludeFromApexContentsTag marker interface was added to avoid
every implementation of DepIsInSameApex() from having to deal with the
special tags, like PrebuiltDepTag. Unfortunately, when adding that
not all calls to DepIsInSameApex() were protected which meant that the
BootImageModule, which panics if it doesn't recognize a tag, was
causing failures. This change documents the need and improves the
consistency.

A follow up change will add a test for this.

Bug: 182992071
Test: m nothing
Change-Id: If0bf9a7447ebf7a0bb0c88e91951a7220d4af45c
2021-03-22 08:43:55 +00:00
Paul Duffin
40b6257dc1 Cleanup the now unused testCustomizer
Bug: 181070625
Test: m nothing
Change-Id: I825e0da53b7fd82f4ef33d7183351c1f2ed8ee23
2021-03-20 11:42:48 +00:00
Paul Duffin
0a49fdca0b Convert test specific customizers to FixturePreparers
Bug: 181070625
Test: m nothing
Change-Id: I1c4b7303a1153b040b7266e95b06d172554dc52a
2021-03-20 11:39:23 +00:00
Paul Duffin
810f33d9ee Convert shared customizer functions to return FixturePreparers
Bug: 181070625
Test: m nothing
Change-Id: I8d09f91a3db23eb36cd73a13e418df98949ec72d
2021-03-20 11:33:03 +00:00
Paul Duffin
2be9dcd3aa Allow test handlers to be either FixturePreparer or testCustomizer
This allows the testCustomizers to be switched to FixturePreparers
incrementally rather than in one go.

Bug: 181070625
Test: m nothing
Change-Id: Idd9d2e28abf9b17fc46b5566ab8d3affa330287e
2021-03-20 10:25:45 +00:00
Paul Duffin
34d433ad7e Convert apex/boot_image_test.go to use test fixtures
Bug: 181070625
Test: m nothing
Change-Id: I940353e32233317d9e932b2d61908125e4c33766
2021-03-20 10:25:45 +00:00
Paul Duffin
e05480ac47 Switch testApex and related methods to use test fixtures
Bug: 181070625
Test: m nothing
Change-Id: Icdd9c3d807d5497ef85946a877c6cd4b4af045bc
2021-03-20 10:25:45 +00:00
Justin Yun
b1d5479783 Merge "Define __ANDROID_VENDOR__ and __ANDROID_PRODUCT__" 2021-03-18 23:33:43 +00:00
Paul Duffin
b72dd403de Merge "Prevent ApexInfoMutator from creating unnecessary variants" 2021-03-18 15:13:39 +00:00
Artur Satayev
b77b0c5e05 Treat allowed_deps.txt source file as optional.
Not all branches have packages/common/module, which breaks the build
for them.

Bug: 179234385
Test: removed allowed_deps.txt && m apex-allowed-deps-check
Change-Id: I38f47c7200e1afbd899e29843d0214bef826fcf9
2021-03-18 11:15:33 +00:00
Paul Duffin
573989d821 Prevent ApexInfoMutator from creating unnecessary variants
Adds the AlwaysRequireApexVariantTag interface to enable
ApexInfoMutator to differentiate between a tag that is excluded from
apex contents but still requires an apex variant and a tag that is
excluded from apex contents and does not require an apex variant.

That is needed to support the sdkMemberVersionedDepTag which excludes
the target from being added to the APEX but requires an APEX variant.
A more detailed explanation is in the comments.

The AlwaysRequireApexVariant() method follows the pattern used in
ReplaceSourceWithPrebuilt of having a method that returns a bool to
trigger the behavior and not say ExcludeFromApexContentsTag that simply
relies on the tag implementing an interface to trigger. That is because
the former is more flexible and allows a tag type to parameterize the
behavior if necessary.

The tags that this will exclude from creating an apex variant are:
* PrebuiltDepTag - by the time the apex variant has been created any
  preferred prebuilts will have replaced the sources so there is no
  need to create an APEX variant if the only dependency path from the
  APEX to the prebuilt is via this tag.
* hiddenApiAnnotationsDependencyTag - the target of which is a purely
  build time artifect and MUST NEVER end up in the APEX.

It will also stop calling DepIsInSameApex for any dependency created
by the sdkMemberVersionedDepTag. Which will fix the issue reported in
the bug.

Bug: 182992071
Test: m nothing
Change-Id: I9569e488d6446ca45d3ea8f32a9b74524eb865df
2021-03-18 09:05:28 +00:00
Paul Duffin
1b29e003f3 Add prebuilt_platform_compat_config
It just provides the metadata needed by the global singleton as the
rest is in the apex.

Bug: 182402754
Test: m nothing
Change-Id: I511df7a3a06dab13ddb9ad63392ae5310dfee9c4
2021-03-17 18:16:31 +00:00
Paul Duffin
0b8177873a Correct typo in the name of compatConfigTag
It was called compatConfigsTag which is inconsistent.

Bug: 182402754
Test: m nothing
Change-Id: I4636d72cee53b361f3b0ab17789e61a439c34edf
2021-03-17 18:16:31 +00:00
Paul Duffin
8c535dad36 Allow apex dependencies to be restricted to source modules only
An upcoming change to create a prebuilt_platform_compat_config module
will break if the apex tries to use it instead of a
platform_compat_config because the former does not provide all the
information that the apex needs. This change will allow the
compatConfigsTag to be configured to prevent the prebuilt from being
used even when it is preferred.

Bug: 182402754
Test: m nothing
Change-Id: Ib9dc06c038f7cf3fc229f3c4d2b025335a4715b4
2021-03-17 18:16:31 +00:00
Artur Satayev
fdb61edf43 Move allowed_deps.txt to packages/modules/common.
Bug: 179234385
Test: run update-apex-allowed-deps.sh locally
Change-Id: I8e8864468b87342c688d001bc5f6e6f8416863ed
Merged-In: I8e8864468b87342c688d001bc5f6e6f8416863ed
2021-03-17 13:44:16 +00:00
Paul Duffin
4defbf4d39 Switch platform_compat_config to use common arch
Bug: 182816033
Test: m nothing
Change-Id: If8886edd9278d67fe2b6288a6bd8b152f2314401
2021-03-15 23:19:39 +00:00
Paul Duffin
1bc21dc7e6 Disallow platform_compat_config modules in apex prebuilts property
Bug: 182816033
Test: m nothing
Change-Id: I50dcc358e8ae143e21b1fbf1a12835bf1342606f
2021-03-15 23:19:39 +00:00
Paul Duffin
3abc174cfd Add new compat_configs property to the apex
Bug: 182816033
Test: m nothing
Change-Id: I485d7b178c0ed17e336a6ac2a13e8313426f374b
2021-03-15 23:19:36 +00:00
Paul Duffin
a369c7b50d Convert TestCompatConfig test to use test fixtures
As this test is the only test in the apex package to use the
platform_compat_config module type it does not make sense to include
that in all the tests so instead this converts the test to use fixtures
so it can easily customize it with the additional module type.

Bug: 181070625
Test: m nothing
Change-Id: I56fda772ee336db6cfb677143aa28b1a18911bff
2021-03-15 19:56:38 +00:00
satayev
2338d6f6e4 Merge "Don't track modules that are only available to APEXes." 2021-03-15 12:47:00 +00:00
Paul Duffin
ef0449b0f3 Merge "Convert ...InstallHwasan.. tests to use fixtures" 2021-03-15 11:09:22 +00:00
Nicolas Geoffray
fb856f6add Merge "Treat core_platform as stable unless module uses legacy" 2021-03-15 08:42:43 +00:00
Justin Yun
13decfb0bb Define __ANDROID_VENDOR__ and __ANDROID_PRODUCT__
__ANDROID_VNDK__ is defined for the modules that are able to use the
VNDK libraries. As both product and vendor variants define
__ANDROID_VNDK__, we don't know if a module is built for vendor or
product on build time.

__ANDROID_VENDOR__ and __ANDROID_PRODUCT__ macros can be used to
specify the image-variant-dependent codes.

Bug: 180646847
Test: m nothing
Change-Id: Id6c3e1e3d47deaf3684c0c02964718658cf2fec5
2021-03-15 17:28:59 +09:00
Paul Duffin
a02cae345b Convert ...InstallHwasan.. tests to use fixtures
These tests rely on changing the definition of the "libc" module which
is a default module provided by the cc.GatherRequiredDepsForTest()
function. That function is called from within testApexContext() and so
added by default.

Previously, the tests relied on a number of factors to work:
1. All the default cc modules were added to the bp contents that were
   passed to testApexContext().
2. testApexContext() passed the augmented bp contents to
   TestArchConfig().
3. TestArchConfig() only stored the supplied bp contents in the root
   Android.bp file if it did not exist.

So, in order to override the default modules it simply made sure to add
its own Android.bp file into the file system first.

Unfortunately, that does not work with the test fixtures as the default
modules are defined in their own specific paths to avoid conflicting
with each other. To achieve the same effect as previously, i.e. no
default modules, this test uses an emptyFixtureFactory and only adds
preparers for cc and apex build components and ignores the default
module definitions altogether.

Bug: 181070625
Test: m nothing
Change-Id: Ic6b961dd2bd78c32cb326b2c7905426ee971c2d8
2021-03-12 18:26:41 +00:00
Lev Proleev
f6b5f8217c Merge "Add libruy_static to allowed_deps" 2021-03-12 14:00:45 +00:00
Artur Satayev
533b98cde3 Don't track modules that are only available to APEXes.
Modules that are not available for platform are developed with
updatability in mind, and do not require manual approvals.

Bug: 181223240
Test: checkbuild
Change-Id: I10b91053b3ef5a9ff5400d9d7a68fae3144a671c
2021-03-11 18:13:18 +00:00
Paul Duffin
37aad60507 Add apexFixtureFactory to apex package
Unlike the similar changes in other packages this change separates the
addition of the fixture factory and the conversion of the test...
methods to use them as there are a few tests that need converting to
use test fixtures first.

Bug: 181070625
Test: m nothing
Change-Id: Ic76523ba89fc1967631aeb682935935b5af116df
2021-03-11 17:25:29 +00:00
Treehugger Robot
215725913c Merge "update apex/allowed_deps.txt" 2021-03-11 01:35:46 +00:00
Paul Duffin
9c2e6d50b4 Merge "Avoid calling DepIsInSameApex when excluded from apex contents" 2021-03-10 23:30:48 +00:00
Paul Duffin
3d3f7a0c3f Merge "Extract apex registration code into function for reuse" 2021-03-10 17:31:13 +00:00
Paul Duffin
e9612824ea Avoid calling DepIsInSameApex when excluded from apex contents
While debugging an issue with some work I was doing on boot image
modules I noticed that markPlatformAvailability() is calling
DepIsInSameApex() even when the dependency tag indicates that it is
excluded from the apex contents.

Test: m droid
Change-Id: Iac49049546a886f7a3a0d9640ffd31ce24c61364
2021-03-10 16:44:57 +00:00
Paul Duffin
043f5e7881 Treat core_platform as stable unless module uses legacy
The sdk_version: "core_platform" refers to the stable core platform
unless the module is in the exception list. This change makes sure that
CheckStableSdkVersion() reflects that behavior.

Bug: 180399951
Test: m nothing
Change-Id: Ia0b1e13322352b87f5a3c6621e37f23ba637ffb6
2021-03-10 13:04:03 +00:00
Paul Duffin
667893c657 Extract apex registration code into function for reuse
Test: m nothing
Change-Id: Id2c918891ecd9e874004f6828f71374bf0cdb9e4
2021-03-09 23:03:40 +00:00
Jooyung Han
77e7d7769e Merge "Run "prebuilt_postdeps" mutator again" 2021-03-09 16:21:33 +00:00
Treehugger Robot
c285125110 Merge "Introduce derive_classpath service." 2021-03-09 10:23:49 +00:00