Merge "Fix check-boot-jars when a boot jar is provided by prebuilt"

This commit is contained in:
Anton Hansson 2020-06-17 19:30:09 +00:00 committed by Gerrit Code Review
commit 0e63a8e761
4 changed files with 31 additions and 4 deletions

View file

@ -184,7 +184,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
// we need to remove the suffix from LOCAL_MODULE_STEM, otherwise // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
// we will have foo.jar.jar // we will have foo.jar.jar
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.Stem(), ".jar")) fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.Stem(), ".jar"))
if javaModule, ok := fi.module.(java.Dependency); ok { if javaModule, ok := fi.module.(java.ApexDependency); ok {
fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", javaModule.ImplementationAndResourcesJars()[0].String()) fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", javaModule.ImplementationAndResourcesJars()[0].String())
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", javaModule.HeaderJars()[0].String()) fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", javaModule.HeaderJars()[0].String())
} else { } else {

View file

@ -1652,7 +1652,9 @@ type javaDependency interface {
func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaDependency, module android.Module) apexFile { func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaDependency, module android.Module) apexFile {
dirInApex := "javalib" dirInApex := "javalib"
fileToCopy := lib.DexJarBuildPath() fileToCopy := lib.DexJarBuildPath()
af := newApexFile(ctx, fileToCopy, module.Name(), dirInApex, javaSharedLib, module) // Remove prebuilt_ if necessary so the source and prebuilt modules have the same name.
name := strings.TrimPrefix(module.Name(), "prebuilt_")
af := newApexFile(ctx, fileToCopy, name, dirInApex, javaSharedLib, module)
af.jacocoReportClassesFile = lib.JacocoReportClassesFile() af.jacocoReportClassesFile = lib.JacocoReportClassesFile()
af.stem = lib.Stem() + ".jar" af.stem = lib.Stem() + ".jar"
return af return af

View file

@ -496,11 +496,16 @@ func (j *Module) OutputFiles(tag string) (android.Paths, error) {
var _ android.OutputFileProducer = (*Module)(nil) var _ android.OutputFileProducer = (*Module)(nil)
type Dependency interface { // Methods that need to be implemented for a module that is added to apex java_libs property.
type ApexDependency interface {
HeaderJars() android.Paths HeaderJars() android.Paths
ImplementationAndResourcesJars() android.Paths
}
type Dependency interface {
ApexDependency
ImplementationJars() android.Paths ImplementationJars() android.Paths
ResourceJars() android.Paths ResourceJars() android.Paths
ImplementationAndResourcesJars() android.Paths
DexJarBuildPath() android.Path DexJarBuildPath() android.Path
DexJarInstallPath() android.Path DexJarInstallPath() android.Path
AidlIncludeDirs() android.Paths AidlIncludeDirs() android.Paths

View file

@ -1999,6 +1999,26 @@ func (module *SdkLibraryImport) Stem() string {
return module.BaseModuleName() return module.BaseModuleName()
} }
var _ ApexDependency = (*SdkLibraryImport)(nil)
// to satisfy java.ApexDependency interface
func (module *SdkLibraryImport) HeaderJars() android.Paths {
if module.implLibraryModule == nil {
return nil
} else {
return module.implLibraryModule.HeaderJars()
}
}
// to satisfy java.ApexDependency interface
func (module *SdkLibraryImport) ImplementationAndResourcesJars() android.Paths {
if module.implLibraryModule == nil {
return nil
} else {
return module.implLibraryModule.ImplementationAndResourcesJars()
}
}
// //
// java_sdk_library_xml // java_sdk_library_xml
// //