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
This commit is contained in:
Jihoon Kang
2024-07-01 17:04:46 +00:00
parent 601939d0a7
commit bb678f82d6
17 changed files with 225 additions and 19 deletions

View File

@@ -104,6 +104,7 @@ func TestBootclasspathFragments_FragmentDependency(t *testing.T) {
test: {
enabled: true,
},
sdk_version: "core_current",
}
java_library {
@@ -749,6 +750,7 @@ func TestBootclasspathFragment_HiddenAPIList(t *testing.T) {
],
srcs: ["b.java"],
compile_dex: true,
sdk_version: "core_current",
}
java_sdk_library {
@@ -922,6 +924,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromSource(t *testing.T) {
],
srcs: ["b.java"],
compile_dex: true,
sdk_version: "core_current",
}
java_library {
@@ -1093,6 +1096,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromText(t *testing.T) {
],
srcs: ["b.java"],
compile_dex: true,
sdk_version: "core_current",
}
java_library {
@@ -1245,6 +1249,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *test
],
srcs: ["b.java"],
compile_dex: true,
sdk_version: "core_current",
}
java_library {