From 3108ce17b0d56fb5ca2b73a013001ca32d6143ea Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 10 Nov 2021 14:38:50 -0800 Subject: [PATCH 1/2] Add dependency from hostdex installed module to Make intermediates The art tests rely on a dependency existing from out/host/linux-x86/framework/core-oj-hostdex.jar to out/host/common/obj/JAVA_LIBRARIES/core-oj-hostdex_intermediates/classes.jar, override LOCAL_SOONG_INSTALLED_MODULE for the hostdex modules so that soong_java_prebuilt.mk adds the dependency. Test: art/tools/buildbot-build.sh --host && art/tools/run-libcore-tests.sh '--mode=host' '--variant=X64' --debug Change-Id: I9412147fc66d5e5f0dae52d522868a37251f781e --- java/androidmk.go | 1 + java/base.go | 3 +++ java/java.go | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/java/androidmk.go b/java/androidmk.go index 35b4c8e19..4c115d58c 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -47,6 +47,7 @@ func (library *Library) AndroidMkEntriesHostDex() android.AndroidMkEntries { if library.dexJarFile.IsSet() { entries.SetPath("LOCAL_SOONG_DEX_JAR", library.dexJarFile.Path()) } + entries.SetPath("LOCAL_SOONG_INSTALLED_MODULE", library.hostdexInstallFile) entries.SetPath("LOCAL_SOONG_HEADER_JAR", library.headerJarFile) entries.SetPath("LOCAL_SOONG_CLASSES_JAR", library.implementationAndResourcesJar) entries.SetString("LOCAL_MODULE_STEM", library.Stem()+"-hostdex") diff --git a/java/base.go b/java/base.go index 859baaff7..6930bcd17 100644 --- a/java/base.go +++ b/java/base.go @@ -407,6 +407,9 @@ type Module struct { // installed file for binary dependency installFile android.Path + // installed file for hostdex copy + hostdexInstallFile android.InstallPath + // list of .java files and srcjars that was passed to javac compiledJavaSrcs android.Paths compiledSrcJars android.Paths diff --git a/java/java.go b/java/java.go index 3bb9a925b..2f9e03a80 100644 --- a/java/java.go +++ b/java/java.go @@ -571,7 +571,8 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { } hostDexNeeded := Bool(j.deviceProperties.Hostdex) && !ctx.Host() if hostDexNeeded { - ctx.InstallFile(android.PathForHostDexInstall(ctx, "framework"), + j.hostdexInstallFile = ctx.InstallFile( + android.PathForHostDexInstall(ctx, "framework"), j.Stem()+"-hostdex.jar", j.outputFile) } var installDir android.InstallPath From fa9bfcd0d27a2439a30f00849abec28ca490bf1d Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 10 Nov 2021 16:42:38 -0800 Subject: [PATCH 2/2] Honor PreventInstall for APKs and dexpreopt files Native coverage builds create a second variant of APKs and set PreventInstall on the non-coverage variant. Skip calling ctx.InstallFile for APKs and in dexpreopt when PreventInstall is set. Fixes: 205865567 Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS="*" NATIVE_COVERAGE_EXCLUDE_PATHS="art bionic/libc device external/compiler-rt external/clang external/llvm external/swiftshader/third_party/llvm-10.0" Change-Id: I9e38ac737315db12475e8f9bfb3e0e7c0327fc06 --- java/app.go | 5 ++++- java/dexpreopt.go | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/java/app.go b/java/app.go index 7c195fc3f..c08ec0697 100755 --- a/java/app.go +++ b/java/app.go @@ -471,6 +471,7 @@ func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path { a.dexpreopter.enforceUsesLibs = a.usesLibrary.enforceUsesLibraries() a.dexpreopter.classLoaderContexts = a.classLoaderContexts a.dexpreopter.manifestFile = a.mergedManifestFile + a.dexpreopter.preventInstall = a.appProperties.PreventInstall if ctx.ModuleName() != "framework-res" { a.Module.compile(ctx, a.aaptSrcJar) @@ -720,7 +721,9 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) { apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo) // Install the app package. - if (Bool(a.Module.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() { + if (Bool(a.Module.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() && + !a.appProperties.PreventInstall { + var extraInstalledPaths android.Paths for _, extra := range a.extraOutputFiles { installed := ctx.InstallFile(a.installDir, extra.Base(), extra) diff --git a/java/dexpreopt.go b/java/dexpreopt.go index 8ab5a4549..7c081b6e5 100644 --- a/java/dexpreopt.go +++ b/java/dexpreopt.go @@ -66,6 +66,7 @@ type dexpreopter struct { isApp bool isTest bool isPresignedPrebuilt bool + preventInstall bool manifestFile android.Path statusFile android.WritablePath @@ -356,7 +357,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr installDirOnDevice: installPath, installFileOnDevice: installBase, }) - } else { + } else if !d.preventInstall { ctx.InstallFile(installPath, installBase, install.From) } }