A test cc module is installable even if it's not available for platform

This change fixes a bug that test modules (cc_test or its sub types) are
unconditionally considered as non-installable if they are configured to
not available for platform. The rationale behind the decision was that
an APEX variant of a module doesn't need to be installed to the device
because the variant will anyway be included in the APEX. However, it's
wrong for test modules. They are not included in the APEX, but should be
installed to /data/nativetest*.

One might think that we need to make the tests available for the
platform (i.e. apex_available: ["//apex_available:platform"]). This
however doesn't work if the libraries that the tests should link against
are configured to be not available for the platform, which currently is
the case for the ART tests.

Bug: 146995717
Test: m
Change-Id: I51843f5b4ea0a418c64c63784347231590cd3c35
This commit is contained in:
Jiyong Park 2020-01-07 16:59:44 +09:00
parent 8ea6bc4a05
commit fe9a43002e
1 changed files with 19 additions and 1 deletions

View File

@ -2460,7 +2460,25 @@ func (c *Module) AvailableFor(what string) bool {
}
func (c *Module) installable() bool {
return c.installer != nil && !c.Properties.PreventInstall && c.IsForPlatform() && c.outputFile.Valid()
ret := c.installer != nil && !c.Properties.PreventInstall && c.outputFile.Valid()
// The platform variant doesn't need further condition. Apex variants however might not
// be installable because it will likely to be included in the APEX and won't appear
// in the system partition.
if c.IsForPlatform() {
return ret
}
// Special case for modules that are configured to be installed to /data, which includes
// test modules. For these modules, both APEX and non-APEX variants are considered as
// installable. This is because even the APEX variants won't be included in the APEX, but
// will anyway be installed to /data/*.
// See b/146995717
if c.InstallInData() {
return ret
}
return false
}
func (c *Module) AndroidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer) {