summaryrefslogtreecommitdiff
path: root/java/dexpreopt_test.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2024-07-01 17:04:46 +0000
committer Jihoon Kang <jihoonkang@google.com> 2024-08-27 17:30:42 +0000
commitbb678f82d6bb5cd89bf282e88a879123d9763d61 (patch)
treee158cdfc87bc019e85dc2f861c3abdebc7426927 /java/dexpreopt_test.go
parent601939d0a78e393058c2582b9ff73ffd500f6747 (diff)
Implement detecting container violations.
This change introduces a method to detect violating inter-container dependencies between modules. The method is run in `ModuleBase.GenerateBuildActions`, after the container info provider is set. Given that the provider of the direct dependencies would have been set at this time, the method utilizes this information to determine the violations, which are introduced in https://r.android.com/3141104. Note that this enforcement does not turn all inter-container dependencies as errors. Instead, it will only turn dependencies that matches the pre-defined violations into errors. Even if the dependency matches the violation, an error will not be thrown if the dependency satisfies any of the exception functions (e.g. the dependent module is stubs, or the two modules belong to the same apexes). Test: m nothing --no-skip-soong-tests Bug: 338660802 Change-Id: I36e9cd956c5a076a53635be0c6ff27f77725516e
Diffstat (limited to 'java/dexpreopt_test.go')
-rw-r--r--java/dexpreopt_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/java/dexpreopt_test.go b/java/dexpreopt_test.go
index 73e33f4fb..07d0595e6 100644
--- a/java/dexpreopt_test.go
+++ b/java/dexpreopt_test.go
@@ -54,6 +54,7 @@ func TestDexpreoptEnabled(t *testing.T) {
name: "foo",
installable: true,
srcs: ["a.java"],
+ sdk_version: "current",
}`,
enabled: true,
},
@@ -98,6 +99,7 @@ func TestDexpreoptEnabled(t *testing.T) {
java_library {
name: "foo",
installable: true,
+ sdk_version: "current",
}`,
enabled: false,
},
@@ -107,6 +109,7 @@ func TestDexpreoptEnabled(t *testing.T) {
java_library {
name: "foo",
srcs: ["a.java"],
+ sdk_version: "current",
}`,
enabled: false,
},
@@ -144,6 +147,7 @@ func TestDexpreoptEnabled(t *testing.T) {
name: "foo",
srcs: ["a.java"],
compile_dex: true,
+ sdk_version: "current",
}`,
enabled: false,
},
@@ -164,6 +168,7 @@ func TestDexpreoptEnabled(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
+ sdk_version: "current",
}`,
apexVariant: true,
enabled: false,
@@ -176,6 +181,7 @@ func TestDexpreoptEnabled(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
+ sdk_version: "current",
}`,
moduleName: "service-foo",
apexVariant: true,
@@ -189,6 +195,7 @@ func TestDexpreoptEnabled(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
+ sdk_version: "current",
}`,
moduleName: "prebuilt_service-foo",
apexVariant: true,
@@ -202,6 +209,7 @@ func TestDexpreoptEnabled(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
+ sdk_version: "current",
}`,
moduleName: "service-foo",
apexVariant: false,
@@ -311,6 +319,7 @@ func TestDexpreoptBuiltInstalledForApex(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
+ sdk_version: "current",
}`)
ctx := result.TestContext
module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
@@ -342,6 +351,7 @@ func TestDexpreoptBuiltInstalledForApex(t *testing.T) {
name: "foo",
installable: true,
srcs: ["a.java"],
+ sdk_version: "current",
}`)
ctx = result.TestContext
module = ctx.ModuleForTests("foo", "android_common")
@@ -398,6 +408,7 @@ func TestAndroidMkEntriesForApex(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
+ sdk_version: "current",
}`)
ctx := result.TestContext
module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
@@ -429,6 +440,7 @@ func TestAndroidMkEntriesForApex(t *testing.T) {
name: "foo",
installable: true,
srcs: ["a.java"],
+ sdk_version: "current",
}`)
ctx = result.TestContext
module = ctx.ModuleForTests("foo", "android_common")
@@ -454,6 +466,7 @@ func TestGenerateProfileEvenIfDexpreoptIsDisabled(t *testing.T) {
profile: "art-profile",
},
srcs: ["a.java"],
+ sdk_version: "current",
}`)
ctx := result.TestContext