Merge "Add system server jars expressed in make in the system server classpath."

This commit is contained in:
Nicolas Geoffray 2020-02-19 07:40:19 +00:00 committed by Gerrit Code Review
commit cbeaab2974

View file

@ -15,6 +15,7 @@
package java package java
import ( import (
"fmt"
"path/filepath" "path/filepath"
"strings" "strings"
@ -29,14 +30,29 @@ func systemServerClasspath(ctx android.MakeVarsContext) []string {
return ctx.Config().OnceStringSlice(systemServerClasspathKey, func() []string { return ctx.Config().OnceStringSlice(systemServerClasspathKey, func() []string {
global := dexpreopt.GetGlobalConfig(ctx) global := dexpreopt.GetGlobalConfig(ctx)
var systemServerClasspathLocations []string var systemServerClasspathLocations []string
for _, m := range *DexpreoptedSystemServerJars(ctx.Config()) { var dexpreoptJars = *DexpreoptedSystemServerJars(ctx.Config())
// 1) The jars that are dexpreopted.
for _, m := range dexpreoptJars {
systemServerClasspathLocations = append(systemServerClasspathLocations, systemServerClasspathLocations = append(systemServerClasspathLocations,
filepath.Join("/system/framework", m+".jar")) filepath.Join("/system/framework", m+".jar"))
} }
// 2) The jars that are from an updatable apex.
for _, m := range global.UpdatableSystemServerJars { for _, m := range global.UpdatableSystemServerJars {
systemServerClasspathLocations = append(systemServerClasspathLocations, systemServerClasspathLocations = append(systemServerClasspathLocations,
dexpreopt.GetJarLocationFromApexJarPair(m)) dexpreopt.GetJarLocationFromApexJarPair(m))
} }
// 3) The jars from make (which are not updatable, not preopted).
for _, m := range dexpreopt.NonUpdatableSystemServerJars(ctx, global) {
if !android.InList(m, dexpreoptJars) {
systemServerClasspathLocations = append(systemServerClasspathLocations,
filepath.Join("/system/framework", m+".jar"))
}
}
if len(systemServerClasspathLocations) != len(global.SystemServerJars)+len(global.UpdatableSystemServerJars) {
panic(fmt.Errorf("Wrong number of system server jars, got %d, expected %d",
len(systemServerClasspathLocations),
len(global.SystemServerJars)+len(global.UpdatableSystemServerJars)))
}
return systemServerClasspathLocations return systemServerClasspathLocations
}) })
} }