Add separate dependency tags for compat libs based on SDK version.
The version in the tag is the SDK version that in which compatibility library was added as a separate libary. Using distinct tags makes it possible to differentiate between dependencies for different SDK versions (this will be needed in subsequent CLs). Test: lunch aosp_cf_x86_phone-userdebug && m Bug: 132357300 Change-Id: I72296c05d6649e811ddc701aaeb84f91d1ba66cb
This commit is contained in:
parent
46b3d5bd05
commit
b521811d7b
23
java/app.go
23
java/app.go
|
@ -1962,8 +1962,9 @@ func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, hasFrameworkLibs
|
|||
if hasFrameworkLibs {
|
||||
// Dexpreopt needs paths to the dex jars of these libraries in order to construct
|
||||
// class loader context for dex2oat. Add them as a dependency with a special tag.
|
||||
ctx.AddVariationDependencies(nil, usesLibTag, dexpreopt.CompatUsesLibs...)
|
||||
ctx.AddVariationDependencies(nil, usesLibTag, dexpreopt.OptionalCompatUsesLibs...)
|
||||
ctx.AddVariationDependencies(nil, usesLibCompat29Tag, dexpreopt.CompatUsesLibs29...)
|
||||
ctx.AddVariationDependencies(nil, usesLibCompat28Tag, dexpreopt.OptionalCompatUsesLibs28...)
|
||||
ctx.AddVariationDependencies(nil, usesLibCompat30Tag, dexpreopt.OptionalCompatUsesLibs30...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1981,14 +1982,16 @@ func (u *usesLibrary) usesLibraryPaths(ctx android.ModuleContext) dexpreopt.Libr
|
|||
usesLibPaths := make(dexpreopt.LibraryPaths)
|
||||
|
||||
if !ctx.Config().UnbundledBuild() {
|
||||
ctx.VisitDirectDepsWithTag(usesLibTag, func(m android.Module) {
|
||||
dep := ctx.OtherModuleName(m)
|
||||
if lib, ok := m.(Dependency); ok {
|
||||
usesLibPaths.AddLibraryPath(ctx, dep, lib.DexJarBuildPath(), lib.DexJarInstallPath())
|
||||
} else if ctx.Config().AllowMissingDependencies() {
|
||||
ctx.AddMissingDependencies([]string{dep})
|
||||
} else {
|
||||
ctx.ModuleErrorf("module %q in uses_libs or optional_uses_libs must be a java library", dep)
|
||||
ctx.VisitDirectDeps(func(m android.Module) {
|
||||
if _, ok := ctx.OtherModuleDependencyTag(m).(usesLibraryDependencyTag); ok {
|
||||
dep := ctx.OtherModuleName(m)
|
||||
if lib, ok := m.(Dependency); ok {
|
||||
usesLibPaths.AddLibraryPath(ctx, dep, lib.DexJarBuildPath(), lib.DexJarInstallPath())
|
||||
} else if ctx.Config().AllowMissingDependencies() {
|
||||
ctx.AddMissingDependencies([]string{dep})
|
||||
} else {
|
||||
ctx.ModuleErrorf("module %q in uses_libs or optional_uses_libs must be a java library", dep)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
17
java/java.go
17
java/java.go
|
@ -547,6 +547,18 @@ type dependencyTag struct {
|
|||
name string
|
||||
}
|
||||
|
||||
type usesLibraryDependencyTag struct {
|
||||
dependencyTag
|
||||
sdkVersion int // SDK version in which the library appared as a standalone library.
|
||||
}
|
||||
|
||||
func makeUsesLibraryDependencyTag(sdkVersion int) usesLibraryDependencyTag {
|
||||
return usesLibraryDependencyTag{
|
||||
dependencyTag: dependencyTag{name: fmt.Sprintf("uses-library-%d", sdkVersion)},
|
||||
sdkVersion: sdkVersion,
|
||||
}
|
||||
}
|
||||
|
||||
func IsJniDepTag(depTag blueprint.DependencyTag) bool {
|
||||
return depTag == jniLibTag
|
||||
}
|
||||
|
@ -566,9 +578,12 @@ var (
|
|||
proguardRaiseTag = dependencyTag{name: "proguard-raise"}
|
||||
certificateTag = dependencyTag{name: "certificate"}
|
||||
instrumentationForTag = dependencyTag{name: "instrumentation_for"}
|
||||
usesLibTag = dependencyTag{name: "uses-library"}
|
||||
extraLintCheckTag = dependencyTag{name: "extra-lint-check"}
|
||||
jniLibTag = dependencyTag{name: "jnilib"}
|
||||
usesLibTag = makeUsesLibraryDependencyTag(dexpreopt.AnySdkVersion)
|
||||
usesLibCompat28Tag = makeUsesLibraryDependencyTag(28)
|
||||
usesLibCompat29Tag = makeUsesLibraryDependencyTag(29)
|
||||
usesLibCompat30Tag = makeUsesLibraryDependencyTag(30)
|
||||
)
|
||||
|
||||
func IsLibDepTag(depTag blueprint.DependencyTag) bool {
|
||||
|
|
Loading…
Reference in New Issue