summaryrefslogtreecommitdiff
path: root/java/classpath_fragment.go
diff options
context:
space:
mode:
author satayev <satayev@google.com> 2021-04-29 11:50:26 +0100
committer satayev <satayev@google.com> 2021-05-07 13:24:16 +0100
commit95e9c5bbfa8a1a46433183830a2429ac83979d33 (patch)
tree76c55548b3b6dbf77648689940f2207f0eea86d0 /java/classpath_fragment.go
parent7c8769231b39e6682a9571342efcf20298734ff9 (diff)
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
Diffstat (limited to 'java/classpath_fragment.go')
-rw-r--r--java/classpath_fragment.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go
index 460cc3ef4..00e95913b 100644
--- a/java/classpath_fragment.go
+++ b/java/classpath_fragment.go
@@ -58,6 +58,8 @@ type classpathFragment interface {
type ClasspathFragmentBase struct {
properties classpathFragmentProperties
+ classpathType classpathType
+
outputFilepath android.OutputPath
installDirPath android.InstallPath
}
@@ -67,8 +69,9 @@ func (c *ClasspathFragmentBase) classpathFragmentBase() *ClasspathFragmentBase {
}
// 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 @@ func (c *ClasspathFragmentBase) generateClasspathProtoBuildActions(ctx android.M
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)