diff options
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/java/java.go b/java/java.go index bf139a80b..9000f7478 100644 --- a/java/java.go +++ b/java/java.go @@ -456,8 +456,6 @@ type Module struct { // list of the xref extraction files kytheFiles android.Paths - distFiles android.TaggedDistFiles - // Collect the module directory for IDE info in java/jdeps.go. modulePaths []string @@ -486,6 +484,8 @@ func (j *Module) OutputFiles(tag string) (android.Paths, error) { switch tag { case "": return append(android.Paths{j.outputFile}, j.extraOutputFiles...), nil + case android.DefaultDistTag: + return android.Paths{j.outputFile}, nil case ".jar": return android.Paths{j.implementationAndResourcesJar}, nil case ".proguard_map": @@ -772,6 +772,37 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { libDeps := ctx.AddVariationDependencies(nil, libTag, rewriteSyspropLibs(j.properties.Libs, "libs")...) ctx.AddVariationDependencies(nil, staticLibTag, rewriteSyspropLibs(j.properties.Static_libs, "static_libs")...) + if ctx.DeviceConfig().VndkVersion() != "" && ctx.Config().EnforceInterPartitionJavaSdkLibrary() { + // Require java_sdk_library at inter-partition java dependency to ensure stable + // interface between partitions. If inter-partition java_library dependency is detected, + // raise build error because java_library doesn't have a stable interface. + // + // Inputs: + // PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY + // if true, enable enforcement + // PRODUCT_INTER_PARTITION_JAVA_LIBRARY_ALLOWLIST + // exception list of java_library names to allow inter-partition dependency + for idx, lib := range j.properties.Libs { + if libDeps[idx] == nil { + continue + } + + if _, ok := syspropPublicStubs[lib]; ok { + continue + } + + if javaDep, ok := libDeps[idx].(javaSdkLibraryEnforceContext); ok { + // java_sdk_library is always allowed at inter-partition dependency. + // So, skip check. + if _, ok := javaDep.(*SdkLibrary); ok { + continue + } + + j.checkPartitionsForJavaDependency(ctx, "libs", javaDep) + } + } + } + // For library dependencies that are component libraries (like stubs), add the implementation // as a dependency (dexpreopt needs to be against the implementation library, not stubs). for _, dep := range libDeps { @@ -2112,8 +2143,6 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { if lib := proptools.String(j.usesLibraryProperties.Provides_uses_lib); lib != "" { j.classLoaderContexts.AddContext(ctx, lib, j.DexJarBuildPath(), j.DexJarInstallPath()) } - - j.distFiles = j.GenerateTaggedDistFiles(ctx) } func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) { |