Add systemserverclasspath_fragments property to apex.

- All contents of the fragment are added as java_lib dependencies.
- Generated classpaths.proto is added into etc as required.

Bug: 180105615
Test: m nothing
Change-Id: I8e8e8b019c4ca2909182f205a47deffa946de6da
This commit is contained in:
satayev
2021-05-17 21:35:26 +01:00
parent 9366a053da
commit 333a1732b1
4 changed files with 114 additions and 6 deletions

View File

@@ -102,6 +102,9 @@ type apexBundleProperties struct {
// List of bootclasspath fragments that are embedded inside this APEX bundle.
Bootclasspath_fragments []string
// List of systemserverclasspath fragments that are embedded inside this APEX bundle.
Systemserverclasspath_fragments []string
// List of java libraries that are embedded inside this APEX bundle.
Java_libs []string
@@ -575,6 +578,7 @@ var (
executableTag = dependencyTag{name: "executable", payload: true}
fsTag = dependencyTag{name: "filesystem", payload: true}
bcpfTag = dependencyTag{name: "bootclasspathFragment", payload: true, sourceOnly: true}
sscpfTag = dependencyTag{name: "systemserverclasspathFragment", payload: true, sourceOnly: true}
compatConfigTag = dependencyTag{name: "compatConfig", payload: true, sourceOnly: true}
javaLibTag = dependencyTag{name: "javaLib", payload: true}
jniLibTag = dependencyTag{name: "jniLib", payload: true}
@@ -755,6 +759,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
// Common-arch dependencies come next
commonVariation := ctx.Config().AndroidCommonTarget.Variations()
ctx.AddFarVariationDependencies(commonVariation, bcpfTag, a.properties.Bootclasspath_fragments...)
ctx.AddFarVariationDependencies(commonVariation, sscpfTag, a.properties.Systemserverclasspath_fragments...)
ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...)
ctx.AddFarVariationDependencies(commonVariation, bpfTag, a.properties.Bpfs...)
ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...)
@@ -1715,6 +1720,15 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
filesInfo = append(filesInfo, filesToAdd...)
return true
}
case sscpfTag:
{
if _, ok := child.(*java.SystemServerClasspathModule); !ok {
ctx.PropertyErrorf("systemserverclasspath_fragments", "%q is not a systemserverclasspath_fragment module", depName)
return false
}
filesInfo = append(filesInfo, apexClasspathFragmentProtoFile(ctx, child))
return true
}
case javaLibTag:
switch child.(type) {
case *java.Library, *java.SdkLibrary, *java.DexImport, *java.SdkLibraryImport, *java.Import:
@@ -1941,7 +1955,16 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
default:
ctx.PropertyErrorf("bootclasspath_fragments", "bootclasspath_fragment content %q of type %q is not supported", depName, ctx.OtherModuleType(child))
}
} else if java.IsSystemServerClasspathFragmentContentDepTag(depTag) {
// Add the contents of the systemserverclasspath fragment to the apex.
switch child.(type) {
case *java.Library, *java.SdkLibrary:
af := apexFileForJavaModule(ctx, child.(javaModule))
filesInfo = append(filesInfo, af)
return true // track transitive dependencies
default:
ctx.PropertyErrorf("systemserverclasspath_fragments", "systemserverclasspath_fragment content %q of type %q is not supported", depName, ctx.OtherModuleType(child))
}
} else if _, ok := depTag.(android.CopyDirectlyInAnyApexTag); ok {
// nothing
} else if am.CanHaveApexVariants() && am.IsInstallableToApex() {