summaryrefslogtreecommitdiff
path: root/java/testing.go
diff options
context:
space:
mode:
author Martin Stjernholm <mast@google.com> 2021-05-13 02:38:35 +0100
committer Martin Stjernholm <mast@google.com> 2021-05-18 21:58:38 +0100
commit0e4ccebb1681ba464d4ae816347fbd86159d354c (patch)
tree6db58d0283709bdf252a38624fb9b44f654a8e82 /java/testing.go
parent0780372ae82137817b7f352e066d65bd988fcc01 (diff)
Don't fail if the target module is disabled in dex2oat tool
dependencies. dexpreopt.RegisterToolDeps runs late after prebuilt dependencies have been resolved, and there's special code in dex2oatPathFromDep to resolve the prebuilt from the source module. However, if the source module is disabled then the dependencies check in validateAndroidModule will complain, so we need to disable that check in this particular situation. Also add a comment to explain why dexpreopt.RegisterToolDeps needs to run so late. Test: m nothing Bug: 145934348 Bug: 172480615 Change-Id: Ibc673303d0336768fa23261a2068e91a08f46a30
Diffstat (limited to 'java/testing.go')
-rw-r--r--java/testing.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/java/testing.go b/java/testing.go
index 387d59573..51a1c621d 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -24,6 +24,7 @@ import (
"android/soong/android"
"android/soong/cc"
"android/soong/dexpreopt"
+
"github.com/google/blueprint"
)
@@ -55,8 +56,9 @@ var PrepareForTestWithJavaBuildComponents = android.GroupFixturePreparers(
}.AddToFixture(),
)
-// Test fixture preparer that will define default java modules, e.g. standard prebuilt modules.
-var PrepareForTestWithJavaDefaultModules = android.GroupFixturePreparers(
+// Test fixture preparer that will define all default java modules except the
+// fake_tool_binary for dex2oatd.
+var PrepareForTestWithJavaDefaultModulesWithoutFakeDex2oatd = android.GroupFixturePreparers(
// Make sure that all the module types used in the defaults are registered.
PrepareForTestWithJavaBuildComponents,
// Additional files needed when test disallows non-existent source.
@@ -72,6 +74,11 @@ var PrepareForTestWithJavaDefaultModules = android.GroupFixturePreparers(
android.FixtureAddTextFile(defaultJavaDir+"/Android.bp", gatherRequiredDepsForTest()),
// Add dexpreopt compat libs (android.test.base, etc.) and a fake dex2oatd module.
dexpreopt.PrepareForTestWithDexpreoptCompatLibs,
+)
+
+// Test fixture preparer that will define default java modules, e.g. standard prebuilt modules.
+var PrepareForTestWithJavaDefaultModules = android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModulesWithoutFakeDex2oatd,
dexpreopt.PrepareForTestWithFakeDex2oatd,
)