From 1d0eb7a9d0a0fbff8db6eb9f3e872a5bc8ef6da6 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 3 Nov 2021 14:08:20 -0700 Subject: 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 --- java/java.go | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'java/java.go') 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) -- cgit v1.2.3