fa89944c79
This change fixes a bug that apex_available is not enforced for static dependencies. For example, a module with 'apex_available: ["//apex_available:platform"]' was able to be statically linked to any APEX. This was happening because the check was done on the modules that are actually installed to an APEX. Static dependencies of the modules were not counted as they are not installed to the APEX as files. Fixing this bug by doing the check by traversing the tree in the method checkApexAvailability. This change includes a few number of related changes: 1) DepIsInSameApex implementation for cc.Module was changed as well. Previuosly, it returned false only when the dependency is actually a stub variant of a lib. Now, it returns false when the dependency has one or more stub variants. To understand why, we need to recall that when there is a dependency to a lib having stubs, we actually create two dependencies: to the non-stub variant and to the stub variant during the DepsMutator phase. And later in the build action generation phase, we choose one of them depending on the context. Also recall that an APEX variant is created only when DepIsInSameApex returns true. Given these, with the previous implementatin of DepIsInSameApex, we did create apex variants of the non-stub variant of the dependency, while not creating the apex variant for the stub variant. This is not right; we needlessly created the apex variant. The extra apex variant has caused no harm so far, but since the apex_available check became more correct, it actually breaks the build. To fix the issue, we stop creating the APEX variant both for non-stub and stub variants. 2) platform variant is created regardless of the apex_available value. This is required for the case when a library X that provides stub is in an APEX A and is configured to be available only for A. In that case, libs in other APEX can't use the stub library since the stub library is mutated only for apex A. By creating the platform variant for the stub library, it can be used from outside as the default dependency variation is set to the platform variant when creating the APEX variations. 3) The ApexAvailableWhitelist is added with the dependencies that were revealed with this change. Bug: 147671264 Test: m Change-Id: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e |
||
---|---|---|
.. | ||
config | ||
libbuildversion | ||
androidmk.go | ||
binary.go | ||
builder.go | ||
cc.go | ||
cc_test.go | ||
ccdeps.go | ||
cflag_artifacts.go | ||
check.go | ||
cmakelists.go | ||
compdb.go | ||
compiler.go | ||
compiler_test.go | ||
coverage.go | ||
fuzz.go | ||
gen.go | ||
gen_stub_libs.py | ||
gen_test.go | ||
genrule.go | ||
genrule_test.go | ||
installer.go | ||
kernel_headers.go | ||
library.go | ||
library_sdk_member.go | ||
library_test.go | ||
linkable.go | ||
linker.go | ||
llndk_library.go | ||
lto.go | ||
makevars.go | ||
ndk_headers.go | ||
ndk_library.go | ||
ndk_prebuilt.go | ||
ndk_sysroot.go | ||
object.go | ||
object_test.go | ||
pgo.go | ||
prebuilt.go | ||
prebuilt_test.go | ||
proto.go | ||
proto_test.go | ||
pylintrc | ||
rs.go | ||
sabi.go | ||
sanitize.go | ||
stl.go | ||
strip.go | ||
sysprop.go | ||
test.go | ||
test_data_test.go | ||
test_gen_stub_libs.py | ||
testing.go | ||
tidy.go | ||
toolchain_library.go | ||
util.go | ||
vendor_public_library.go | ||
vndk.go | ||
vndk_prebuilt.go | ||
xom.go |