| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 1 | // Copyright 2019 Google Inc. All rights reserved. | 
|  | 2 | // | 
|  | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 4 | // you may not use this file except in compliance with the License. | 
|  | 5 | // You may obtain a copy of the License at | 
|  | 6 | // | 
|  | 7 | //     http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 8 | // | 
|  | 9 | // Unless required by applicable law or agreed to in writing, software | 
|  | 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 12 | // See the License for the specific language governing permissions and | 
|  | 13 | // limitations under the License. | 
|  | 14 |  | 
|  | 15 | package java | 
|  | 16 |  | 
|  | 17 | import ( | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 18 | "path/filepath" | 
|  | 19 | "strings" | 
| Colin Cross | 2d00f0d | 2019-05-09 21:50:00 -0700 | [diff] [blame] | 20 |  | 
|  | 21 | "android/soong/android" | 
|  | 22 | "android/soong/dexpreopt" | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 23 | ) | 
|  | 24 |  | 
|  | 25 | // dexpreoptGlobalConfig returns the global dexpreopt.config.  It is loaded once the first time it is called for any | 
|  | 26 | // ctx.Config(), and returns the same data for all future calls with the same ctx.Config().  A value can be inserted | 
|  | 27 | // for tests using setDexpreoptTestGlobalConfig. | 
|  | 28 | func dexpreoptGlobalConfig(ctx android.PathContext) dexpreopt.GlobalConfig { | 
| Colin Cross | 2d00f0d | 2019-05-09 21:50:00 -0700 | [diff] [blame] | 29 | return dexpreoptGlobalConfigRaw(ctx).global | 
|  | 30 | } | 
|  | 31 |  | 
|  | 32 | type globalConfigAndRaw struct { | 
|  | 33 | global dexpreopt.GlobalConfig | 
|  | 34 | data   []byte | 
|  | 35 | } | 
|  | 36 |  | 
|  | 37 | func dexpreoptGlobalConfigRaw(ctx android.PathContext) globalConfigAndRaw { | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 38 | return ctx.Config().Once(dexpreoptGlobalConfigKey, func() interface{} { | 
| Colin Cross | 988414c | 2020-01-11 01:11:46 +0000 | [diff] [blame] | 39 | if data, err := ctx.Config().DexpreoptGlobalConfig(ctx); err != nil { | 
|  | 40 | panic(err) | 
|  | 41 | } else if data != nil { | 
| Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 42 | soongConfig := dexpreopt.CreateGlobalSoongConfig(ctx) | 
| Colin Cross | 988414c | 2020-01-11 01:11:46 +0000 | [diff] [blame] | 43 | globalConfig, err := dexpreopt.LoadGlobalConfig(ctx, data, soongConfig) | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 44 | if err != nil { | 
|  | 45 | panic(err) | 
|  | 46 | } | 
| Colin Cross | 2d00f0d | 2019-05-09 21:50:00 -0700 | [diff] [blame] | 47 | return globalConfigAndRaw{globalConfig, data} | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 48 | } | 
|  | 49 |  | 
|  | 50 | // No global config filename set, see if there is a test config set | 
|  | 51 | return ctx.Config().Once(dexpreoptTestGlobalConfigKey, func() interface{} { | 
|  | 52 | // Nope, return a config with preopting disabled | 
| Colin Cross | 2d00f0d | 2019-05-09 21:50:00 -0700 | [diff] [blame] | 53 | return globalConfigAndRaw{dexpreopt.GlobalConfig{ | 
| Mathieu Chartier | 6adeee1 | 2019-06-26 10:01:36 -0700 | [diff] [blame] | 54 | DisablePreopt:          true, | 
|  | 55 | DisableGenerateProfile: true, | 
| Colin Cross | 2d00f0d | 2019-05-09 21:50:00 -0700 | [diff] [blame] | 56 | }, nil} | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 57 | }) | 
| Colin Cross | 2d00f0d | 2019-05-09 21:50:00 -0700 | [diff] [blame] | 58 | }).(globalConfigAndRaw) | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 59 | } | 
|  | 60 |  | 
|  | 61 | // setDexpreoptTestGlobalConfig sets a GlobalConfig that future calls to dexpreoptGlobalConfig will return.  It must | 
|  | 62 | // be called before the first call to dexpreoptGlobalConfig for the config. | 
|  | 63 | func setDexpreoptTestGlobalConfig(config android.Config, globalConfig dexpreopt.GlobalConfig) { | 
| Colin Cross | 2d00f0d | 2019-05-09 21:50:00 -0700 | [diff] [blame] | 64 | config.Once(dexpreoptTestGlobalConfigKey, func() interface{} { return globalConfigAndRaw{globalConfig, nil} }) | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 65 | } | 
|  | 66 |  | 
|  | 67 | var dexpreoptGlobalConfigKey = android.NewOnceKey("DexpreoptGlobalConfig") | 
|  | 68 | var dexpreoptTestGlobalConfigKey = android.NewOnceKey("TestDexpreoptGlobalConfig") | 
|  | 69 |  | 
|  | 70 | // systemServerClasspath returns the on-device locations of the modules in the system server classpath.  It is computed | 
|  | 71 | // once the first time it is called for any ctx.Config(), and returns the same slice for all future calls with the same | 
|  | 72 | // ctx.Config(). | 
|  | 73 | func systemServerClasspath(ctx android.PathContext) []string { | 
|  | 74 | return ctx.Config().OnceStringSlice(systemServerClasspathKey, func() []string { | 
|  | 75 | global := dexpreoptGlobalConfig(ctx) | 
|  | 76 |  | 
|  | 77 | var systemServerClasspathLocations []string | 
|  | 78 | for _, m := range global.SystemServerJars { | 
|  | 79 | systemServerClasspathLocations = append(systemServerClasspathLocations, | 
|  | 80 | filepath.Join("/system/framework", m+".jar")) | 
|  | 81 | } | 
| Roshan Pius | 9b51a40 | 2019-11-21 12:36:53 -0800 | [diff] [blame] | 82 | for _, m := range global.UpdatableSystemServerJars { | 
| Roshan Pius | 9b51a40 | 2019-11-21 12:36:53 -0800 | [diff] [blame] | 83 | systemServerClasspathLocations = append(systemServerClasspathLocations, | 
| Roshan Pius | ccc26ef | 2019-11-27 09:37:46 -0800 | [diff] [blame] | 84 | dexpreopt.GetJarLocationFromApexJarPair(m)) | 
| Roshan Pius | 9b51a40 | 2019-11-21 12:36:53 -0800 | [diff] [blame] | 85 | } | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 86 | return systemServerClasspathLocations | 
|  | 87 | }) | 
|  | 88 | } | 
|  | 89 |  | 
|  | 90 | var systemServerClasspathKey = android.NewOnceKey("systemServerClasspath") | 
|  | 91 |  | 
| Colin Cross | c11e0c5 | 2019-05-08 15:18:22 -0700 | [diff] [blame] | 92 | // dexpreoptTargets returns the list of targets that are relevant to dexpreopting, which excludes architectures | 
|  | 93 | // supported through native bridge. | 
|  | 94 | func dexpreoptTargets(ctx android.PathContext) []android.Target { | 
|  | 95 | var targets []android.Target | 
| Colin Cross | 3b19f5d | 2019-09-17 14:45:31 -0700 | [diff] [blame] | 96 | for _, target := range ctx.Config().Targets[android.Android] { | 
| Colin Cross | c11e0c5 | 2019-05-08 15:18:22 -0700 | [diff] [blame] | 97 | if target.NativeBridge == android.NativeBridgeDisabled { | 
|  | 98 | targets = append(targets, target) | 
|  | 99 | } | 
|  | 100 | } | 
|  | 101 |  | 
|  | 102 | return targets | 
|  | 103 | } | 
|  | 104 |  | 
| Jiyong Park | 0b23875 | 2019-10-29 11:23:10 +0900 | [diff] [blame] | 105 | func stemOf(moduleName string) string { | 
|  | 106 | // b/139391334: the stem of framework-minus-apex is framework | 
|  | 107 | // This is hard coded here until we find a good way to query the stem | 
|  | 108 | // of a module before any other mutators are run | 
|  | 109 | if moduleName == "framework-minus-apex" { | 
|  | 110 | return "framework" | 
|  | 111 | } | 
|  | 112 | return moduleName | 
|  | 113 | } | 
|  | 114 |  | 
| Roshan Pius | ccc26ef | 2019-11-27 09:37:46 -0800 | [diff] [blame] | 115 | func getJarsFromApexJarPairs(apexJarPairs []string) []string { | 
|  | 116 | modules := make([]string, len(apexJarPairs)) | 
|  | 117 | for i, p := range apexJarPairs { | 
|  | 118 | _, jar := dexpreopt.SplitApexJarPair(p) | 
|  | 119 | modules[i] = jar | 
|  | 120 | } | 
|  | 121 | return modules | 
|  | 122 | } | 
|  | 123 |  | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 124 | var ( | 
| Ulya Trafimovich | 5754745 | 2019-12-09 15:40:17 +0000 | [diff] [blame] | 125 | bootImageConfigKey       = android.NewOnceKey("bootImageConfig") | 
|  | 126 | artBootImageName         = "art" | 
|  | 127 | frameworkBootImageName   = "boot" | 
|  | 128 | artJZBootImageName       = "jitzygote-art" | 
|  | 129 | frameworkJZBootImageName = "jitzygote-boot" | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 130 | ) | 
| Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 131 |  | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 132 | // Construct the global boot image configs. | 
|  | 133 | func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig { | 
|  | 134 | return ctx.Config().Once(bootImageConfigKey, func() interface{} { | 
|  | 135 |  | 
| Nicolas Geoffray | 72892f1 | 2019-02-22 15:34:40 +0000 | [diff] [blame] | 136 | global := dexpreoptGlobalConfig(ctx) | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 137 | targets := dexpreoptTargets(ctx) | 
|  | 138 | deviceDir := android.PathForOutput(ctx, ctx.Config().DeviceName()) | 
| Nicolas Geoffray | 72892f1 | 2019-02-22 15:34:40 +0000 | [diff] [blame] | 139 |  | 
| Martin Stjernholm | cc4b0ad | 2019-07-05 22:38:25 +0100 | [diff] [blame] | 140 | artModules := global.ArtApexJars | 
| Ulya Trafimovich | 4456188 | 2020-01-03 13:25:54 +0000 | [diff] [blame] | 141 | // With EMMA_INSTRUMENT_FRAMEWORK=true the Core libraries depend on jacoco. | 
|  | 142 | if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") { | 
|  | 143 | artModules = append(artModules, "jacocoagent") | 
|  | 144 | } | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 145 | frameworkModules := android.RemoveListFromList(global.BootJars, | 
|  | 146 | concat(artModules, getJarsFromApexJarPairs(global.UpdatableBootJars))) | 
| Nicolas Geoffray | 72892f1 | 2019-02-22 15:34:40 +0000 | [diff] [blame] | 147 |  | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 148 | artSubdir := "apex/com.android.art/javalib" | 
|  | 149 | frameworkSubdir := "system/framework" | 
| Nicolas Geoffray | 72892f1 | 2019-02-22 15:34:40 +0000 | [diff] [blame] | 150 |  | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 151 | var artLocations, frameworkLocations []string | 
| Martin Stjernholm | cc4b0ad | 2019-07-05 22:38:25 +0100 | [diff] [blame] | 152 | for _, m := range artModules { | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 153 | artLocations = append(artLocations, filepath.Join("/"+artSubdir, stemOf(m)+".jar")) | 
|  | 154 | } | 
|  | 155 | for _, m := range frameworkModules { | 
|  | 156 | frameworkLocations = append(frameworkLocations, filepath.Join("/"+frameworkSubdir, stemOf(m)+".jar")) | 
| Nicolas Geoffray | 72892f1 | 2019-02-22 15:34:40 +0000 | [diff] [blame] | 157 | } | 
|  | 158 |  | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 159 | // ART config for the primary boot image in the ART apex. | 
|  | 160 | // It includes the Core Libraries. | 
|  | 161 | artCfg := bootImageConfig{ | 
|  | 162 | extension:        false, | 
|  | 163 | name:             artBootImageName, | 
|  | 164 | stem:             "boot", | 
|  | 165 | installSubdir:    artSubdir, | 
|  | 166 | modules:          artModules, | 
|  | 167 | dexLocations:     artLocations, | 
|  | 168 | dexLocationsDeps: artLocations, | 
|  | 169 | } | 
| Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 170 |  | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 171 | // Framework config for the boot image extension. | 
| Ulyana Trafimovich | 5a4ccd1 | 2019-12-18 17:32:33 +0000 | [diff] [blame] | 172 | // It includes framework libraries and depends on the ART config. | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 173 | frameworkCfg := bootImageConfig{ | 
| Ulyana Trafimovich | 5a4ccd1 | 2019-12-18 17:32:33 +0000 | [diff] [blame] | 174 | extension:        true, | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 175 | name:             frameworkBootImageName, | 
|  | 176 | stem:             "boot", | 
|  | 177 | installSubdir:    frameworkSubdir, | 
| Ulyana Trafimovich | 5a4ccd1 | 2019-12-18 17:32:33 +0000 | [diff] [blame] | 178 | modules:          frameworkModules, | 
|  | 179 | dexLocations:     frameworkLocations, | 
|  | 180 | dexLocationsDeps: append(artLocations, frameworkLocations...), | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 181 | } | 
|  | 182 |  | 
| Ulya Trafimovich | 5754745 | 2019-12-09 15:40:17 +0000 | [diff] [blame] | 183 | // ART config for JIT-zygote boot image. | 
|  | 184 | artJZCfg := bootImageConfig{ | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 185 | extension:        false, | 
| Ulya Trafimovich | 5754745 | 2019-12-09 15:40:17 +0000 | [diff] [blame] | 186 | name:             artJZBootImageName, | 
|  | 187 | stem:             "apex", | 
|  | 188 | installSubdir:    artSubdir, | 
|  | 189 | modules:          artModules, | 
|  | 190 | dexLocations:     artLocations, | 
|  | 191 | dexLocationsDeps: artLocations, | 
|  | 192 | } | 
|  | 193 |  | 
|  | 194 | // Framework config for JIT-zygote boot image extension. | 
|  | 195 | frameworkJZCfg := bootImageConfig{ | 
|  | 196 | extension:        true, | 
|  | 197 | name:             frameworkJZBootImageName, | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 198 | stem:             "apex", | 
|  | 199 | installSubdir:    frameworkSubdir, | 
| Ulya Trafimovich | 5754745 | 2019-12-09 15:40:17 +0000 | [diff] [blame] | 200 | modules:          frameworkModules, | 
|  | 201 | dexLocations:     frameworkLocations, | 
|  | 202 | dexLocationsDeps: append(artLocations, frameworkLocations...), | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 203 | } | 
|  | 204 |  | 
|  | 205 | configs := map[string]*bootImageConfig{ | 
| Ulya Trafimovich | 5754745 | 2019-12-09 15:40:17 +0000 | [diff] [blame] | 206 | artBootImageName:         &artCfg, | 
|  | 207 | frameworkBootImageName:   &frameworkCfg, | 
|  | 208 | artJZBootImageName:       &artJZCfg, | 
|  | 209 | frameworkJZBootImageName: &frameworkJZCfg, | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 210 | } | 
|  | 211 |  | 
|  | 212 | // common to all configs | 
|  | 213 | for _, c := range configs { | 
|  | 214 | c.targets = targets | 
|  | 215 |  | 
|  | 216 | c.dir = deviceDir.Join(ctx, "dex_"+c.name+"jars") | 
|  | 217 | c.symbolsDir = deviceDir.Join(ctx, "dex_"+c.name+"jars_unstripped") | 
|  | 218 |  | 
|  | 219 | // expands to <stem>.art for primary image and <stem>-<1st module>.art for extension | 
|  | 220 | imageName := c.firstModuleNameOrStem() + ".art" | 
|  | 221 |  | 
|  | 222 | c.imageLocations = []string{c.dir.Join(ctx, c.installSubdir, imageName).String()} | 
|  | 223 |  | 
|  | 224 | // The path to bootclasspath dex files needs to be known at module | 
|  | 225 | // GenerateAndroidBuildAction time, before the bootclasspath modules have been compiled. | 
|  | 226 | // Set up known paths for them, the singleton rules will copy them there. | 
|  | 227 | // TODO(b/143682396): use module dependencies instead | 
|  | 228 | inputDir := deviceDir.Join(ctx, "dex_"+c.name+"jars_input") | 
|  | 229 | for _, m := range c.modules { | 
|  | 230 | c.dexPaths = append(c.dexPaths, inputDir.Join(ctx, stemOf(m)+".jar")) | 
|  | 231 | } | 
|  | 232 | c.dexPathsDeps = c.dexPaths | 
|  | 233 |  | 
|  | 234 | c.images = make(map[android.ArchType]android.OutputPath) | 
|  | 235 | c.imagesDeps = make(map[android.ArchType]android.OutputPaths) | 
|  | 236 |  | 
|  | 237 | for _, target := range targets { | 
|  | 238 | arch := target.Arch.ArchType | 
|  | 239 | imageDir := c.dir.Join(ctx, c.installSubdir, arch.String()) | 
|  | 240 | c.images[arch] = imageDir.Join(ctx, imageName) | 
|  | 241 | c.imagesDeps[arch] = c.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex") | 
| Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 242 | } | 
| Colin Cross | 31bf00d | 2019-12-04 13:16:01 -0800 | [diff] [blame] | 243 |  | 
|  | 244 | c.zip = c.dir.Join(ctx, c.name+".zip") | 
| Nicolas Geoffray | feef2ef | 2019-04-30 09:43:22 +0100 | [diff] [blame] | 245 | } | 
|  | 246 |  | 
| Ulyana Trafimovich | 5a4ccd1 | 2019-12-18 17:32:33 +0000 | [diff] [blame] | 247 | // specific to the framework config | 
|  | 248 | frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...) | 
|  | 249 | frameworkCfg.imageLocations = append(artCfg.imageLocations, frameworkCfg.imageLocations...) | 
|  | 250 |  | 
| Ulya Trafimovich | 5754745 | 2019-12-09 15:40:17 +0000 | [diff] [blame] | 251 | // specific to the jitzygote-framework config | 
|  | 252 | frameworkJZCfg.dexPathsDeps = append(artJZCfg.dexPathsDeps, frameworkJZCfg.dexPathsDeps...) | 
|  | 253 | frameworkJZCfg.imageLocations = append(artJZCfg.imageLocations, frameworkJZCfg.imageLocations...) | 
|  | 254 |  | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 255 | return configs | 
|  | 256 | }).(map[string]*bootImageConfig) | 
| Nicolas Geoffray | 72892f1 | 2019-02-22 15:34:40 +0000 | [diff] [blame] | 257 | } | 
|  | 258 |  | 
| Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 259 | func artBootImageConfig(ctx android.PathContext) bootImageConfig { | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 260 | return *genBootImageConfigs(ctx)[artBootImageName] | 
|  | 261 | } | 
|  | 262 |  | 
| Lingfeng Yang | 54191fa | 2019-12-19 16:40:09 +0000 | [diff] [blame] | 263 | func defaultBootImageConfig(ctx android.PathContext) bootImageConfig { | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 264 | return *genBootImageConfigs(ctx)[frameworkBootImageName] | 
|  | 265 | } | 
|  | 266 |  | 
| Ulya Trafimovich | 5754745 | 2019-12-09 15:40:17 +0000 | [diff] [blame] | 267 | func artJZBootImageConfig(ctx android.PathContext) bootImageConfig { | 
|  | 268 | return *genBootImageConfigs(ctx)[artJZBootImageName] | 
|  | 269 | } | 
|  | 270 |  | 
|  | 271 | func frameworkJZBootImageConfig(ctx android.PathContext) bootImageConfig { | 
|  | 272 | return *genBootImageConfigs(ctx)[frameworkJZBootImageName] | 
| Ulya Trafimovich | 1826338 | 2019-10-23 15:56:32 +0100 | [diff] [blame] | 273 | } | 
|  | 274 |  | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 275 | func defaultBootclasspath(ctx android.PathContext) []string { | 
|  | 276 | return ctx.Config().OnceStringSlice(defaultBootclasspathKey, func() []string { | 
|  | 277 | global := dexpreoptGlobalConfig(ctx) | 
|  | 278 | image := defaultBootImageConfig(ctx) | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 279 |  | 
| Roshan Pius | ccc26ef | 2019-11-27 09:37:46 -0800 | [diff] [blame] | 280 | updatableBootclasspath := make([]string, len(global.UpdatableBootJars)) | 
|  | 281 | for i, p := range global.UpdatableBootJars { | 
|  | 282 | updatableBootclasspath[i] = dexpreopt.GetJarLocationFromApexJarPair(p) | 
|  | 283 | } | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 284 |  | 
|  | 285 | bootclasspath := append(copyOf(image.dexLocationsDeps), updatableBootclasspath...) | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 286 | return bootclasspath | 
|  | 287 | }) | 
|  | 288 | } | 
|  | 289 |  | 
|  | 290 | var defaultBootclasspathKey = android.NewOnceKey("defaultBootclasspath") | 
|  | 291 |  | 
|  | 292 | var copyOf = android.CopyOf | 
|  | 293 |  | 
|  | 294 | func init() { | 
|  | 295 | android.RegisterMakeVarsProvider(pctx, dexpreoptConfigMakevars) | 
|  | 296 | } | 
|  | 297 |  | 
|  | 298 | func dexpreoptConfigMakevars(ctx android.MakeVarsContext) { | 
|  | 299 | ctx.Strict("PRODUCT_BOOTCLASSPATH", strings.Join(defaultBootclasspath(ctx), ":")) | 
| Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 300 | ctx.Strict("PRODUCT_DEX2OAT_BOOTCLASSPATH", strings.Join(defaultBootImageConfig(ctx).dexLocationsDeps, ":")) | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 301 | ctx.Strict("PRODUCT_SYSTEM_SERVER_CLASSPATH", strings.Join(systemServerClasspath(ctx), ":")) | 
| Colin Cross | 9be4152 | 2019-02-20 10:40:13 -0800 | [diff] [blame] | 302 |  | 
|  | 303 | ctx.Strict("DEXPREOPT_BOOT_JARS_MODULES", strings.Join(defaultBootImageConfig(ctx).modules, ":")) | 
| Colin Cross | 44df581 | 2019-02-15 23:06:46 -0800 | [diff] [blame] | 304 | } |