summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Ulya Trafimovich <skvadrik@google.com> 2022-05-04 12:00:02 +0100
committer Ulya Trafimovich <skvadrik@google.com> 2022-05-04 12:10:06 +0100
commitf5d91bb3b4cb907a4fbcd1ea6cf36b9d1a3094ed (patch)
tree544fd78c34bf5119e468668f3236a343e208621d /java/java.go
parent91f015e73e6260b10f055972dd9f6bca9ca30f9d (diff)
Revert "Don't add `uses_libs`/`optional_uses_libs` to the manifest_fixer."
This reverts commit 0b1c70efbcbb0c8408f44964923f5b156d025936. The reverted commit was based on the idea that uses-libraries that are explicitly specified in build files should not be implicitly added to the manifest, as that would mean that anything added to the build files will flow to the manifest. Although this logic is correct, it prevents propagation of uses-libraries from dependencies, which is wrong: if a library has an explicit uses-library property in Android.bp, this property is expected to be propagated to the library's dependencies. Failing to do so would mean that every user of that library has to add uses-library property to their build files, which doesn't scale (see b/214255490 for example). Bug: 214255490 Test: lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd \ && adb wait-for-device && adb root \ && adb logcat | grep -E 'ClassLoaderContext [a-z ]+ mismatch' # empty output, no errors at boot Change-Id: I6f420e76a89aa2f37be99f877711736640f2c361
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go28
1 files changed, 11 insertions, 17 deletions
diff --git a/java/java.go b/java/java.go
index b34d6de8a..6127a0526 100644
--- a/java/java.go
+++ b/java/java.go
@@ -300,19 +300,11 @@ var _ android.LicenseAnnotationsDependencyTag = dependencyTag{}
type usesLibraryDependencyTag struct {
dependencyTag
-
- // SDK version in which the library appared as a standalone library.
- sdkVersion int
-
- // If the dependency is optional or required.
- optional bool
-
- // Whether this is an implicit dependency inferred by Soong, or an explicit one added via
- // `uses_libs`/`optional_uses_libs` properties.
- implicit bool
+ sdkVersion int // SDK version in which the library appared as a standalone library.
+ optional bool // If the dependency is optional or required.
}
-func makeUsesLibraryDependencyTag(sdkVersion int, optional bool, implicit bool) usesLibraryDependencyTag {
+func makeUsesLibraryDependencyTag(sdkVersion int, optional bool) usesLibraryDependencyTag {
return usesLibraryDependencyTag{
dependencyTag: dependencyTag{
name: fmt.Sprintf("uses-library-%d", sdkVersion),
@@ -320,7 +312,6 @@ func makeUsesLibraryDependencyTag(sdkVersion int, optional bool, implicit bool)
},
sdkVersion: sdkVersion,
optional: optional,
- implicit: implicit,
}
}
@@ -351,6 +342,11 @@ var (
syspropPublicStubDepTag = dependencyTag{name: "sysprop public stub"}
jniInstallTag = installDependencyTag{name: "jni install"}
binaryInstallTag = installDependencyTag{name: "binary install"}
+ usesLibReqTag = makeUsesLibraryDependencyTag(dexpreopt.AnySdkVersion, false)
+ usesLibOptTag = makeUsesLibraryDependencyTag(dexpreopt.AnySdkVersion, true)
+ usesLibCompat28OptTag = makeUsesLibraryDependencyTag(28, true)
+ usesLibCompat29ReqTag = makeUsesLibraryDependencyTag(29, false)
+ usesLibCompat30OptTag = makeUsesLibraryDependencyTag(30, true)
)
func IsLibDepTag(depTag blueprint.DependencyTag) bool {
@@ -1996,10 +1992,8 @@ func addCLCFromDep(ctx android.ModuleContext, depModule android.Module,
depTag := ctx.OtherModuleDependencyTag(depModule)
if depTag == libTag {
// Ok, propagate <uses-library> through non-static library dependencies.
- } else if tag, ok := depTag.(usesLibraryDependencyTag); ok &&
- tag.sdkVersion == dexpreopt.AnySdkVersion && tag.implicit {
- // Ok, propagate <uses-library> through non-compatibility implicit <uses-library>
- // dependencies.
+ } else if tag, ok := depTag.(usesLibraryDependencyTag); ok && tag.sdkVersion == dexpreopt.AnySdkVersion {
+ // Ok, propagate <uses-library> through non-compatibility <uses-library> dependencies.
} else if depTag == staticLibTag {
// Propagate <uses-library> through static library dependencies, unless it is a component
// library (such as stubs). Component libraries have a dependency on their SDK library,
@@ -2017,7 +2011,7 @@ func addCLCFromDep(ctx android.ModuleContext, depModule android.Module,
// <uses_library> and should not be added to CLC, but the transitive <uses-library> dependencies
// from its CLC should be added to the current CLC.
if sdkLib != nil {
- clcMap.AddContext(ctx, dexpreopt.AnySdkVersion, *sdkLib, false, true,
+ clcMap.AddContext(ctx, dexpreopt.AnySdkVersion, *sdkLib, false,
dep.DexJarBuildPath().PathOrNil(), dep.DexJarInstallPath(), dep.ClassLoaderContexts())
} else {
clcMap.AddContextMap(dep.ClassLoaderContexts(), depName)