From 9b51a4078a80b815a888c0846c76cf9e21b0196a Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 21 Nov 2019 12:36:53 -0800 Subject: soong: Support system_server jars from apexes Allow system_server jars delivered via apex. Regular system_server jars are located in /system/framework folder. But, jars delivered via apex are mounted at /apex//javalib. Bug: 144722612 Bug: 141785760 Test: Compiles Change-Id: Ia40bb91d2e05b2601a52eac28a985fe2d8da3481 --- java/dexpreopt_config.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'java') diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go index a6661b33d..15f11e11c 100644 --- a/java/dexpreopt_config.go +++ b/java/dexpreopt_config.go @@ -15,6 +15,7 @@ package java import ( + "fmt" "path/filepath" "strings" @@ -65,6 +66,16 @@ func setDexpreoptTestGlobalConfig(config android.Config, globalConfig dexpreopt. var dexpreoptGlobalConfigKey = android.NewOnceKey("DexpreoptGlobalConfig") var dexpreoptTestGlobalConfigKey = android.NewOnceKey("TestDexpreoptGlobalConfig") +// Expected format for apexJarValue = : +func splitApexJarPair(apexJarValue string) (string, string) { + var apexJarPair []string = strings.SplitN(apexJarValue, ":", 2) + if apexJarPair == nil || len(apexJarPair) != 2 { + panic(fmt.Errorf("malformed apexJarValue: %q, expected format: :", + apexJarValue)) + } + return apexJarPair[0], apexJarPair[1] +} + // systemServerClasspath returns the on-device locations of the modules in the system server classpath. It is computed // once the first time it is called for any ctx.Config(), and returns the same slice for all future calls with the same // ctx.Config(). @@ -77,6 +88,11 @@ func systemServerClasspath(ctx android.PathContext) []string { systemServerClasspathLocations = append(systemServerClasspathLocations, filepath.Join("/system/framework", m+".jar")) } + for _, m := range global.UpdatableSystemServerJars { + apex, jar := splitApexJarPair(m) + systemServerClasspathLocations = append(systemServerClasspathLocations, + filepath.Join("/apex", apex, "javalib", jar + ".jar")) + } return systemServerClasspathLocations }) } -- cgit v1.2.3-59-g8ed1b