From 24cc4be60b138e6d5f6ed038179f0e1a46504829 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 3 Nov 2021 14:09:41 -0700 Subject: [PATCH] Move java module installation into Soong Move java module installation rules into Soong by overriding InstallBypassMake. Update the locations that find host java tools to look in the Make installation directory instead of the Soong installation directory, which will no longer be used. Bug: 204136549 Test: m checkbuild Change-Id: I5af6d764c97e7ddb5ee121fc9830166c25d831b1 --- android/config.go | 6 ++++++ java/androidmk.go | 5 ----- java/app_import.go | 2 ++ java/java.go | 16 ++++++++++++++++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/android/config.go b/android/config.go index 732015e7a..a07c4c893 100644 --- a/android/config.go +++ b/android/config.go @@ -593,11 +593,17 @@ func (c *config) HostJNIToolPath(ctx PathContext, lib string) Path { func (c *config) HostJavaToolPath(ctx PathContext, tool string) Path { path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "framework", false, tool) + if ctx.Config().KatiEnabled() { + path = path.ToMakePath() + } return path } func (c *config) HostJavaBinToolPath(ctx PathContext, tool string) Path { path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool) + if ctx.Config().KatiEnabled() { + path = path.ToMakePath() + } return path } diff --git a/java/androidmk.go b/java/androidmk.go index eca5caacb..35b4c8e19 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -285,11 +285,6 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries { }} } else { outputFile := binary.wrapperFile - // Have Make installation trigger Soong installation by using Soong's install path as - // the output file. - if binary.Host() { - outputFile = binary.binaryFile - } return []android.AndroidMkEntries{android.AndroidMkEntries{ Class: "EXECUTABLES", diff --git a/java/app_import.go b/java/app_import.go index 3e5f972a4..4d1969ebb 100644 --- a/java/app_import.go +++ b/java/app_import.go @@ -108,6 +108,8 @@ func (a *AndroidAppImport) IsInstallable() bool { return true } +func (a *AndroidAppImport) InstallBypassMake() bool { return true } + // Updates properties with variant-specific values. func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) { config := ctx.Config() diff --git a/java/java.go b/java/java.go index a538fbed9..3bb9a925b 100644 --- a/java/java.go +++ b/java/java.go @@ -265,6 +265,8 @@ func (j *Module) XrefJavaFiles() android.Paths { return j.kytheFiles } +func (j *Module) InstallBypassMake() bool { return true } + type dependencyTag struct { blueprint.BaseDependencyTag name string @@ -856,6 +858,20 @@ type JavaTestImport struct { dexJarFile android.Path } +func (j *Test) InstallInTestcases() bool { + // Host java tests install into $(HOST_OUT_JAVA_LIBRARIES), and then are copied into + // testcases by base_rules.mk. + return !j.Host() +} + +func (j *TestHelperLibrary) InstallInTestcases() bool { + return true +} + +func (j *JavaTestImport) InstallInTestcases() bool { + return true +} + func (j *TestHost) DepsMutator(ctx android.BottomUpMutatorContext) { if len(j.testHostProperties.Data_native_bins) > 0 { for _, target := range ctx.MultiTargets() {