Append platform classpath proto configs with missing apex jars.

Any apex classpath fragment that doesn't generate its own classpaths
proto, must still propagate it's boot jars for the platform classpath
fragment to include for complete CLASSPATH variables on device.

Bug: 191127295
Test: atest CtsClasspathsTestCases derive_classpath_test
Change-Id: I93687f69006741fcd66eb6e04891a4b4bbcc3b47
This commit is contained in:
satayev
2021-06-15 17:49:10 +01:00
parent f93d38835c
commit b30905019f
6 changed files with 106 additions and 13 deletions

View File

@@ -481,3 +481,62 @@ func CheckModuleDependencies(t *testing.T, ctx *android.TestContext, name, varia
pairs := java.ApexNamePairsFromModules(ctx, modules)
android.AssertDeepEquals(t, "module dependencies", expected, pairs)
}
// TestPlatformBootclasspath_IncludesRemainingApexJars verifies that any apex boot jar is present in
// platform_bootclasspath's classpaths.proto config, if the apex does not generate its own config
// by setting generate_classpaths_proto property to false.
func TestPlatformBootclasspath_IncludesRemainingApexJars(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
prepareForTestWithMyapex,
java.FixtureConfigureUpdatableBootJars("myapex:foo"),
android.FixtureWithRootAndroidBp(`
platform_bootclasspath {
name: "platform-bootclasspath",
fragments: [
{
apex: "myapex",
module:"foo-fragment",
},
],
}
apex {
name: "myapex",
key: "myapex.key",
bootclasspath_fragments: ["foo-fragment"],
updatable: false,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
bootclasspath_fragment {
name: "foo-fragment",
generate_classpaths_proto: false,
contents: ["foo"],
apex_available: ["myapex"],
}
java_library {
name: "foo",
srcs: ["a.java"],
system_modules: "none",
sdk_version: "none",
compile_dex: true,
apex_available: ["myapex"],
permitted_packages: ["foo"],
}
`),
).RunTest(t)
java.CheckClasspathFragmentProtoContentInfoProvider(t, result,
true, // proto should be generated
"myapex:foo", // apex doesn't generate its own config, so must be in platform_bootclasspath
"bootclasspath.pb",
"out/soong/target/product/test_device/system/etc/classpaths",
)
}