Declare ConfiguredJarList in specific fragment implementations.
Each specific classpath_fragment module knows what jars must be part
of the corresponding classpaths.proto config.
Note that bootclasspath_fragment does not implement classpath_fragment
yet, thus all boot jars and all system server jars go into corresponding
platform classpaths.
Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I6a8c7b0a5d17d62e790a441b8e2c5c1a816e7f30
diff --git a/java/systemserver_classpath_fragment.go b/java/systemserver_classpath_fragment.go
index 3f8a083..82cdb89 100644
--- a/java/systemserver_classpath_fragment.go
+++ b/java/systemserver_classpath_fragment.go
@@ -16,6 +16,7 @@
import (
"android/soong/android"
+ "android/soong/dexpreopt"
)
func init() {
@@ -45,6 +46,22 @@
}
func (b *platformSystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- // TODO(satayev): split apex jars into separate configs.
- b.classpathFragmentBase().generateClasspathProtoBuildActions(ctx)
+ configuredJars := configuredJarListToClasspathJars(ctx, b.ClasspathFragmentToConfiguredJarList(ctx), b.classpathType)
+ b.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, configuredJars)
+}
+
+var platformSystemServerClasspathKey = android.NewOnceKey("platform_systemserverclasspath")
+
+func (b *platformSystemServerClasspathModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList {
+ return ctx.Config().Once(platformSystemServerClasspathKey, func() interface{} {
+ global := dexpreopt.GetGlobalConfig(ctx)
+
+ jars := global.SystemServerJars
+
+ // TODO(satayev): split apex jars into separate configs.
+ for i := 0; i < global.UpdatableSystemServerJars.Len(); i++ {
+ jars = jars.Append(global.UpdatableSystemServerJars.Apex(i), global.UpdatableSystemServerJars.Jar(i))
+ }
+ return jars
+ }).(android.ConfiguredJarList)
}