Commit graph

1418 commits

Author SHA1 Message Date
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
Jooyung Han
86feead0d5 Run "prebuilt_postdeps" mutator again
Because OverridablePropertiesDepsMutator is run after prebuilt_postdeps,
prebuilt's replacement doesn't affect to those deps added by overridable
properties.

By running prebuilt_postdeps again after
OverridablePropertiesDepsMutator, replacing source with prebuilts is
applied to those deps.

Bug: 152155285
Bug: 181953909
Bug: 181974714
Test: m nothing
Change-Id: I24acc02785c9580c2beca096042f1173eb28ba9a
2021-03-09 11:23:46 +09:00
Colin Cross
110bca5bd1 Merge "Remove extra return value from testApex" 2021-03-08 18:16:23 +00:00
Artur Satayev
74030452b6 Introduce derive_classpath service.
go/updatable-classpath

Bug: 180105615
Test: manual + boot test
Merged-In: If0a3cb00754834133abea12caff3fdc5b7cff696
Change-Id: If0a3cb00754834133abea12caff3fdc5b7cff696
2021-03-08 18:06:59 +00:00
Anton Hansson
921a89e376 Merge "Allow PermissionController to set min_sdk_version to 30." 2021-03-08 11:18:16 +00:00
Paul Duffin
6d119b804c Fix mutator ordering issue in apex tests
Previously, the override mutators were being run before the prebuilt
mutators that did not match the runtime behavior. This change fixes
that ordering.

In the process it broke TestApexWithAppImportsPrefer. That test tries
to verify that an apex that depends on an android_app will use an
android_app_import if that is preferred. Unfortunately, it only worked
because of the incorrect order of the mutators.

The test worked before this change because the prebuilt mutators were
being run after the overridableModuleDepsMutator. That meant that any
dependencies added by that mutator onto source modules could be
replaced by the PrebuiltPostDepsMutator with the preferred prebuilt
module.

Switching the order to match the runtime meant that the prebuilt
mutators were run before the overrides so never had a chance to replace
the dependencies added by the overrides.

Bug: 181953909
Bug: 181974714
Test: m nothing
Change-Id: Ic98fdc29a63155174a3227e7e918b26f0a8763bb
2021-03-05 18:38:58 +00:00
Hai Zhang
9bb022a4aa Allow PermissionController to set min_sdk_version to 30.
PermissionController is updatable since R, so its minimum SDK version
should be 30.

Bug: 174770904
Test: build
Merged-In: I5c98dc0053687bd4601ab06f6e092aeb851cdba7
Change-Id: I5c98dc0053687bd4601ab06f6e092aeb851cdba7
2021-03-05 17:46:25 +00:00
Jeongik Cha
480762d78b update apex/allowed_deps.txt
Bug: 150578172
Test: m
Change-Id: I0ea6b33c2d27081a5f0622edb0f5df4088a71455
Merged-In: I0ea6b33c2d27081a5f0622edb0f5df4088a71455
2021-03-05 21:47:22 +09:00
Treehugger Robot
4a349ab66b Merge "Friendly error message on apex_available and min_sdk_version checks" 2021-03-05 03:30:11 +00:00
Makoto Onuki
e9d0de4932 Merge "Remove myself from the OWNERS" 2021-03-04 17:04:53 +00:00
Lukács T. Berki
ddebd2c82a Merge "cd to / before running soong_build ." 2021-03-04 07:07:02 +00:00
Jiyong Park
767dbd9d3b Friendly error message on apex_available and min_sdk_version checks
1) suggest a fix at the end of the message
2) add new lines around the dependency path so that they are visually
separated from rest of the error message

Bug: N/A
Test: m with an intentional break
error: bionic/apex/Android.bp:32:1: module "com.android.runtime" variant "android_common_com.android.runtime_image": "libutils_headers" requires "libsystem_headers" that doesn't list the APEX under 'apex_available'.

Dependency path:
           via tag apex.dependencyTag: { name:executable payload:true}
    -> crash_dump{os:android,image:,arch:arm_armv8-a,sdk:,apex:apex10000}
           via tag cc.libraryDependencyTag: { Kind:staticLibraryDependency Order:normalLibraryDependency wholeStatic:false reexportFlags:false explicitlyVersioned:false dataLib:false ndk:false staticUnwinder:false makeSuffix: skipApexAllowedDependenciesCheck:false excludeInApex:false}
    -> libtombstoned_client_static{os:android,image:,arch:arm_armv8-a,sdk:,link:static,apex:apex10000}
           via tag cc.libraryDependencyTag: { Kind:staticLibraryDependency Order:normalLibraryDependency wholeStatic:true reexportFlags:true explicitlyVersioned:false dataLib:false ndk:false staticUnwinder:false makeSuffix: skipApexAllowedDependenciesCheck:false excludeInApex:false}
    -> libcutils{os:android,image:,arch:arm_armv8-a,sdk:,link:static,asan:,apex:apex10000}
           via tag cc.libraryDependencyTag: { Kind:headerLibraryDependency Order:normalLibraryDependency wholeStatic:false reexportFlags:false explicitlyVersioned:false dataLib:false ndk:false staticUnwinder:false makeSuffix: skipApexAllowedDependenciesCheck:false excludeInApex:false}
    -> libutils_headers{os:android,image:,arch:arm_armv8-a,sdk:,asan:,apex:apex10000}
           via tag cc.libraryDependencyTag: { Kind:headerLibraryDependency Order:normalLibraryDependency wholeStatic:false reexportFlags:true explicitlyVersioned:false dataLib:false ndk:false staticUnwinder:false makeSuffix: skipApexAllowedDependenciesCheck:false excludeInApex:false}
    -> libsystem_headers{os:android,image:,arch:arm_armv8-a,sdk:,asan:,apex:apex10000}

Consider adding "com.android.runtime" to 'apex_available' property of "libsystem_headers"

Change-Id: I09f92c3086ea433780133a33ba0ad73baee6dc41
2021-03-04 13:07:36 +09:00
Xin Li
cbcc5b7179 Merge "Merge RQ2A.210305.007" 2021-03-03 21:41:40 +00:00
Xin Li
2964583d62 Merge RQ2A.210305.007
Bug: 180401296
Merged-In: I422ccc35977e0be846bb7a3497a50c2fc2c42e92
Change-Id: I230429666794c8218e515099292600d77a4b9604
2021-03-03 09:12:01 -08:00