aboutsummaryrefslogtreecommitdiffstats
path: root/apex/apex.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2020-06-17 16:59:43 +0100
committerPaul Duffin <paulduffin@google.com>2020-06-20 11:38:08 +0100
commit9ee66da850cbc0be76e556f57af37781e5631662 (patch)
treed5d224336ca63f5a9f464f569a24d141ebc2aecf /apex/apex.go
parent5ef04d1ee7bf741611ff4be708bf88c7619f40ae (diff)
downloadbuild_soong-9ee66da850cbc0be76e556f57af37781e5631662.tar.gz
build_soong-9ee66da850cbc0be76e556f57af37781e5631662.tar.bz2
build_soong-9ee66da850cbc0be76e556f57af37781e5631662.zip
Fix check-boot-jars when a boot jar is provided by prebuilt
Previously, when a boot jar was provided by a java_sdk_library_import module the check-boot-jars check failed because the file it depended on was not available. In an incremental build the build failed due to the file in the out directory not having a rule to generate it. That was because the module was named prebuilt_<module>.<apex> instead of <module>.<apex>. This was fixed by simply removing prebuilt_ prefix from the name if it was present. After fixing that the check-boot-jars still did not work properly because it was expecting a jar file containing .class files but instead was given a jar file containing .dex files which meant the check did not work properly. This was fixed by defining a new ApexDependency interface for use by the apex/apex.go code to use instead of java.Dependency for generating the androidmk entries. The *SdkLibraryImport type then implemented those, by delegating to the implementation library. Bug: 158304459 Bug: 159112414 Test: m check-boot-jars m checkbuild manual inspection of the .jar file used by check-boot-jars to ensure it contained .class files and not .dex files. Change-Id: I545c5c9072dd472337d2f9b4dfdf08f53c981662 Merged-In: I545c5c9072dd472337d2f9b4dfdf08f53c981662
Diffstat (limited to 'apex/apex.go')
-rw-r--r--apex/apex.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/apex/apex.go b/apex/apex.go
index 387b29b1..994a0517 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1685,7 +1685,9 @@ type javaDependency interface {
func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaDependency, module android.Module) apexFile {
dirInApex := "javalib"
fileToCopy := lib.DexJar()
- 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.stem = lib.Stem() + ".jar"
return af