platform_build_soong/cc
Jiyong Park fa89944c79 apex_available tracks static dependencies
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
2020-02-06 09:16:19 +09:00
..
config Merge "Switch to r370808b." am: ab2053ffab am: ee7726901a am: 1d6ab48772 2020-02-03 18:37:23 +00:00
libbuildversion
androidmk.go Add ramdisk image. 2020-01-22 16:54:18 -08:00
binary.go Add ramdisk image. 2020-01-22 16:54:18 -08:00
builder.go Merge "build: soong: windres: use clang to preprocess" 2020-01-30 02:21:02 +00:00
cc.go apex_available tracks static dependencies 2020-02-06 09:16:19 +09:00
cc_test.go build: Link the unwinder dynamically into platform and vendor binaries. 2020-01-10 11:38:30 -08:00
ccdeps.go Fix writing module_bp_cc_deps.json 2020-01-31 18:12:41 +00:00
cflag_artifacts.go Split local and global cflags 2019-11-07 15:27:58 -08:00
check.go Forbid -Weverything 2019-11-12 15:55:03 -08:00
cmakelists.go Sandbox soong_build by changing to root directory 2020-01-11 01:11:46 +00:00
compdb.go Sandbox soong_build by changing to root directory 2020-01-11 01:11:46 +00:00
compiler.go Fix generated headers of snapshot 2019-12-09 12:38:34 +09:00
compiler_test.go Expand ClangExtraExternalCflags to non-Google vendor projects 2019-11-11 13:24:39 -08:00
coverage.go Merge "Add coverage flags for Clang coverage builds." 2020-01-22 22:34:35 +00:00
fuzz.go Add ramdisk image. 2020-01-22 16:54:18 -08:00
gen.go Performs same checks as aidl_interface.go before stripping leading "I". 2019-09-24 17:41:15 -07:00
gen_stub_libs.py Rename # vndk tag to # llndk 2019-11-13 05:50:27 +00:00
gen_test.go Use empty string for core image variant 2019-12-13 20:44:36 -08:00
genrule.go Add ramdisk image. 2020-01-22 16:54:18 -08:00
genrule_test.go Move filesystem into Config 2019-12-18 08:19:10 -08:00
installer.go Create product variant for product partition 2019-12-20 17:56:08 +09:00
kernel_headers.go Change exportedDirs and exportedSystemDirs from []string to android.Paths 2019-10-25 09:52:08 +09:00
library.go Disable no-vendor-variant VNDK for CFI modules 2020-01-31 10:41:27 -08:00
library_sdk_member.go Dedup adding of arch/common properties to cc library snapshot 2020-02-04 18:48:31 +00:00
library_test.go Use empty string for core image variant 2019-12-13 20:44:36 -08:00
linkable.go Add ramdisk image. 2020-01-22 16:54:18 -08:00
linker.go Merge "Use relocation-packer style relocation packing between 23 and 28." 2020-01-29 22:18:06 +00:00
llndk_library.go Create product variant for product partition 2019-12-20 17:56:08 +09:00
lto.go Split local and global cflags 2019-11-07 15:27:58 -08:00
makevars.go Exclude dirs from binder interface whitelisting 2019-12-04 09:10:21 -08:00
ndk_headers.go Sandbox soong_build by changing to root directory 2020-01-11 01:11:46 +00:00
ndk_library.go Revert "Revert "soong: upgrade Android platform to clang-r370808"" 2019-12-13 13:13:06 -08:00
ndk_prebuilt.go Expose some factories for aidl_test.go 2019-12-09 18:21:48 +09:00
ndk_sysroot.go Expose some factories for aidl_test.go 2019-12-09 18:21:48 +09:00
object.go Split local and global cflags 2019-11-07 15:27:58 -08:00
object_test.go Allow linker scripts when building objects. 2019-08-22 13:21:37 -07:00
pgo.go Add -fprofile-sample-accurate flag for sampling PGO 2020-01-31 12:36:38 +08:00
prebuilt.go Dedup cc prebuilts module type registration 2019-12-19 19:19:40 +00:00
prebuilt_test.go Improve cc tests by adding sanitizer mutators 2019-12-19 19:19:40 +00:00
proto.go Split local and global cflags 2019-11-07 15:27:58 -08:00
proto_test.go Use empty string for core image variant 2019-12-13 20:44:36 -08:00
pylintrc
rs.go Move/dedupe some host path functions in package_ctx.go. 2019-12-09 22:04:21 +00:00
sabi.go Revert "Also package recursive jni_libs deps of android_apps as well as direct deps." 2019-12-18 00:15:07 +00:00
sanitize.go Add ramdisk image. 2020-01-22 16:54:18 -08:00
stl.go build: Link the unwinder dynamically into platform and vendor binaries. 2020-01-10 11:38:30 -08:00
strip.go Remove use_gnu_strip option 2019-09-13 12:18:47 -07:00
sysprop.go Implement sysprop_library API stability check 2019-08-23 06:28:34 +00:00
test.go Split local and global cflags 2019-11-07 15:27:58 -08:00
test_data_test.go Move filesystem into Config 2019-12-18 08:19:10 -08:00
test_gen_stub_libs.py Rename # vndk tag to # llndk 2019-11-13 05:50:27 +00:00
testing.go Merge "build: Link the unwinder dynamically into platform and vendor binaries." 2020-01-21 21:28:44 +00:00
tidy.go
toolchain_library.go Repack libgcc.a to only include required objects 2019-10-24 16:34:54 -07:00
util.go Reorder local and global flags 2019-11-07 15:27:58 -08:00
vendor_public_library.go Split local and global cflags 2019-11-07 15:27:58 -08:00
vndk.go Revert "Revert "apex_vndk uses vendor variants only"" 2020-01-23 14:48:29 +09:00
vndk_prebuilt.go Merge "Change exportedDirs and exportedSystemDirs from []string to android.Paths" 2019-10-28 02:24:41 +00:00
xom.go soong: use -Wl,-z,separate-code w/ -Wl,--execute-only 2019-12-16 09:55:37 -08:00