aboutsummaryrefslogtreecommitdiffstats
path: root/dexpreopt
diff options
context:
space:
mode:
authorUlya Trafimovich <skvadrik@google.com>2019-11-25 15:12:48 +0000
committerUlya Trafimovich <skvadrik@google.com>2019-11-25 16:36:57 +0000
commit61c325ebcce0a1e2ac9149d28ae00e69a269dd93 (patch)
tree1631ee606e4dadc64f02bf4f91ce0b16a07e4a41 /dexpreopt
parent1670ca0d8b7e2a386f5314107a934f007c752430 (diff)
downloadbuild_soong-61c325ebcce0a1e2ac9149d28ae00e69a269dd93.tar.gz
build_soong-61c325ebcce0a1e2ac9149d28ae00e69a269dd93.tar.bz2
build_soong-61c325ebcce0a1e2ac9149d28ae00e69a269dd93.zip
Do not dexpreopt system server jars from updatable modules.
Test: m Test: The list of updatable system server jars is empty now, so I tested that the filer works with a manual experiment: - temporarily add ethernet-service to PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS - m nothing - fgrep -e 'ethernet-service' $ANDROID_BUILD_TOP/out/soong/build.ninja | grep dexpreopt - expect empty output (no dexpreopt command is generated) Change-Id: I0b231e823d5a5a97632daa2b5eb7be3e06782004
Diffstat (limited to 'dexpreopt')
-rw-r--r--dexpreopt/dexpreopt.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 46e0f0a0..18a38fbd 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -102,6 +102,13 @@ func dexpreoptDisabled(global GlobalConfig, module ModuleConfig) bool {
return true
}
+ // Don't preopt system server jars that are updatable.
+ for _, p := range global.UpdatableSystemServerJars {
+ if _, jar := SplitApexJarPair(p); jar == module.Name {
+ return true
+ }
+ }
+
// If OnlyPreoptBootImageAndSystemServer=true and module is not in boot class path skip
// Also preopt system server jars since selinux prevents system server from loading anything from
// /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
@@ -537,6 +544,16 @@ func makefileMatch(pattern, s string) bool {
}
}
+// Expected format for apexJarValue = <apex name>:<jar name>
+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: <apex>:<jar>",
+ apexJarValue))
+ }
+ return apexJarPair[0], apexJarPair[1]
+}
+
func contains(l []string, s string) bool {
for _, e := range l {
if e == s {