Prevent non-app/non-test modules from statically including jacocoagent
Previously, the .impl library of java_sdk_library modules would end up with the jacocoagent statically included. That is because their Instrument flag was set to true when created by their parent. As that was before the deps were added that meant that they ended up with a static dependency on jacoagent (at least when UnbundledBuild() was true). That was not previously a problem because the .impl files were only used at build time. However, a recent change to make updatable-media statically include framework-media.impl (which statically included the jacocoagent classes) broke the coverage build because the jacocoagent classes are not in the permitted packages for the updatable-media. When instrumenting the bootclasspath the jacocoagent library is added to the art-bootclasspath-fragment. The jacocoagent should only be statically included in apps, or test apps. This change adds an extra flag to specify whether the module type supports statically including the jacocoagent. This is set to true by apps and test apps but not when the java_sdk_library creates the .impl java_library preventing it from statically including jacocoagent. Bug: 230967146 Bug: 229932396 Test: COVERAGE_MODULES=media \ PRODUCT=mainline_modules_x86 \ TARGET_BUILD_APPS=com.google.android.media \ vendor/google/build/build_unbundled_coverage_mainline_module.sh # Fails without this change, passes with it. Change-Id: Ic95cf11a05f59b67e623474ed3dd9be6b4442c42
Loading
Please register or sign in to comment