Split SYSTEMSERVERCLASSPATH entries from platform_bootclasspath.
Boot jars are different to system server jars at build level, due to
added complexity of dexpreopt. As a logical separation add a new
classpath fragment type and split existing classpaths.proto generation
into relevant pieces.
Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I88bec09fc920166ffd0092faef980754ddeb6593
diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go
index 460cc3e..00e9591 100644
--- a/java/classpath_fragment.go
+++ b/java/classpath_fragment.go
@@ -58,6 +58,8 @@
type ClasspathFragmentBase struct {
properties classpathFragmentProperties
+ classpathType classpathType
+
outputFilepath android.OutputPath
installDirPath android.InstallPath
}
@@ -67,8 +69,9 @@
}
// Initializes ClasspathFragmentBase struct. Must be called by all modules that include ClasspathFragmentBase.
-func initClasspathFragment(c classpathFragment) {
+func initClasspathFragment(c classpathFragment, classpathType classpathType) {
base := c.classpathFragmentBase()
+ base.classpathType = classpathType
c.AddProperties(&base.properties)
}
@@ -87,9 +90,17 @@
c.installDirPath = android.PathForModuleInstall(ctx, "etc", "classpaths")
var jars []classpathJar
- jars = appendClasspathJar(jars, BOOTCLASSPATH, defaultBootclasspath(ctx)...)
- jars = appendClasspathJar(jars, DEX2OATBOOTCLASSPATH, defaultBootImageConfig(ctx).getAnyAndroidVariant().dexLocationsDeps...)
- jars = appendClasspathJar(jars, SYSTEMSERVERCLASSPATH, systemServerClasspath(ctx)...)
+ switch c.classpathType {
+ case BOOTCLASSPATH:
+ jars = appendClasspathJar(jars, BOOTCLASSPATH, defaultBootclasspath(ctx)...)
+ jars = appendClasspathJar(jars, DEX2OATBOOTCLASSPATH, defaultBootImageConfig(ctx).getAnyAndroidVariant().dexLocationsDeps...)
+ case SYSTEMSERVERCLASSPATH:
+ jars = appendClasspathJar(jars, SYSTEMSERVERCLASSPATH, systemServerClasspath(ctx)...)
+ default:
+ // Only supported classpath fragments are BOOTCLASSPATH and SYSTEMSERVERCLASSPATH.
+ // DEX2OATBOOTCLASSPATH is a special case of BOOTCLASSPATH and is auto-generated.
+ panic(fmt.Errorf("found %v, expected either BOOTCLASSPATH or SYSTEMSERVERCLASSPATH", c.classpathType))
+ }
generatedJson := android.PathForModuleOut(ctx, outputFilename+".json")
writeClasspathsJson(ctx, generatedJson, jars)