aboutsummaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2021-11-03 14:08:20 -0700
committerColin Cross <ccross@android.com>2021-11-05 14:20:28 -0700
commit1d0eb7a9d0a0fbff8db6eb9f3e872a5bc8ef6da6 (patch)
treef445dfb564f34e915d1c81271c106c25537a4dcf /java/java.go
parentae5330a2d9d71fe6b61b0ca3ec02e18591de519d (diff)
Fix ctx.InstallFile calls for java modules
Call ctx.InstallFile on the primary install file last so that the primary install file can depend on the extra install files, and so that the primary install file can be inferred from the last installed file. Add missing ctx.InstallFile calls for the dexpreopt and hostdex outputs. Fix the install subdirectory for modules installing to the testcases directory. Bug: 204136549 Test: m checkbuild Change-Id: I7edd7647be27439d3ca0ecc589ca5e89d4ba8474
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go31
1 files changed, 27 insertions, 4 deletions
diff --git a/java/java.go b/java/java.go
index 854097b0a..a538fbed9 100644
--- a/java/java.go
+++ b/java/java.go
@@ -567,8 +567,22 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if j.InstallMixin != nil {
extraInstallDeps = j.InstallMixin(ctx, j.outputFile)
}
- j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
- j.Stem()+".jar", j.outputFile, extraInstallDeps...)
+ hostDexNeeded := Bool(j.deviceProperties.Hostdex) && !ctx.Host()
+ if hostDexNeeded {
+ ctx.InstallFile(android.PathForHostDexInstall(ctx, "framework"),
+ j.Stem()+"-hostdex.jar", j.outputFile)
+ }
+ var installDir android.InstallPath
+ if ctx.InstallInTestcases() {
+ var archDir string
+ if !ctx.Host() {
+ archDir = ctx.DeviceConfig().DeviceArch()
+ }
+ installDir = android.PathForModuleInstall(ctx, ctx.ModuleName(), archDir)
+ } else {
+ installDir = android.PathForModuleInstall(ctx, "framework")
+ }
+ j.installFile = ctx.InstallFile(installDir, j.Stem()+".jar", j.outputFile, extraInstallDeps...)
}
}
@@ -1376,8 +1390,17 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
})
if Bool(j.properties.Installable) {
- ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
- jarName, outputFile)
+ var installDir android.InstallPath
+ if ctx.InstallInTestcases() {
+ var archDir string
+ if !ctx.Host() {
+ archDir = ctx.DeviceConfig().DeviceArch()
+ }
+ installDir = android.PathForModuleInstall(ctx, ctx.ModuleName(), archDir)
+ } else {
+ installDir = android.PathForModuleInstall(ctx, "framework")
+ }
+ ctx.InstallFile(installDir, jarName, outputFile)
}
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Aidl.Export_include_dirs)