Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 1 | // Copyright 2018 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 dexpreopt |
| 16 | |
| 17 | import ( |
| 18 | "encoding/json" |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 19 | "fmt" |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 20 | "strings" |
Colin Cross | 74ba962 | 2019-02-11 15:11:14 -0800 | [diff] [blame] | 21 | |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 22 | "github.com/google/blueprint" |
| 23 | |
Colin Cross | 74ba962 | 2019-02-11 15:11:14 -0800 | [diff] [blame] | 24 | "android/soong/android" |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 25 | ) |
| 26 | |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 27 | // GlobalConfig stores the configuration for dex preopting. The fields are set |
Martin Stjernholm | 75a48d8 | 2020-01-10 20:32:59 +0000 | [diff] [blame] | 28 | // from product variables via dex_preopt_config.mk. |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 29 | type GlobalConfig struct { |
Ulya Trafimovich | a4a1c4e | 2021-01-15 18:40:04 +0000 | [diff] [blame] | 30 | DisablePreopt bool // disable preopt for all modules (excluding boot images) |
| 31 | DisablePreoptBootImages bool // disable prepot for boot images |
| 32 | DisablePreoptModules []string // modules with preopt disabled by product-specific config |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 33 | |
| 34 | OnlyPreoptBootImageAndSystemServer bool // only preopt jars in the boot image or system server |
| 35 | |
Ulya Trafimovich | 9023b02 | 2021-03-22 16:02:28 +0000 | [diff] [blame] | 36 | PreoptWithUpdatableBcp bool // If updatable boot jars are included in dexpreopt or not. |
| 37 | |
Vladimir Marko | 40139d6 | 2020-02-06 15:14:29 +0000 | [diff] [blame] | 38 | UseArtImage bool // use the art image (use other boot class path dex files without image) |
| 39 | |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 40 | HasSystemOther bool // store odex files that match PatternsOnSystemOther on the system_other partition |
| 41 | PatternsOnSystemOther []string // patterns (using '%' to denote a prefix match) to put odex on the system_other partition |
| 42 | |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 43 | DisableGenerateProfile bool // don't generate profiles |
| 44 | ProfileDir string // directory to find profiles in |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 45 | |
Ulya Trafimovich | 249386a | 2020-07-01 14:31:13 +0100 | [diff] [blame] | 46 | BootJars android.ConfiguredJarList // modules for jars that form the boot class path |
| 47 | UpdatableBootJars android.ConfiguredJarList // jars within apex that form the boot class path |
Vladimir Marko | d2ee532 | 2018-12-19 17:57:57 +0000 | [diff] [blame] | 48 | |
Ulya Trafimovich | 249386a | 2020-07-01 14:31:13 +0100 | [diff] [blame] | 49 | ArtApexJars android.ConfiguredJarList // modules for jars that are in the ART APEX |
Colin Cross | 800fe13 | 2019-02-11 14:21:24 -0800 | [diff] [blame] | 50 | |
Ulya Trafimovich | 249386a | 2020-07-01 14:31:13 +0100 | [diff] [blame] | 51 | SystemServerJars []string // jars that form the system server |
| 52 | SystemServerApps []string // apps that are loaded into system server |
| 53 | UpdatableSystemServerJars android.ConfiguredJarList // jars within apex that are loaded into system server |
| 54 | SpeedApps []string // apps that should be speed optimized |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 55 | |
Ulya Trafimovich | cd3203f | 2020-03-27 11:30:00 +0000 | [diff] [blame] | 56 | BrokenSuboptimalOrderOfSystemServerJars bool // if true, sub-optimal order does not cause a build error |
| 57 | |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 58 | PreoptFlags []string // global dex2oat flags that should be used if no module-specific dex2oat flags are specified |
| 59 | |
| 60 | DefaultCompilerFilter string // default compiler filter to pass to dex2oat, overridden by --compiler-filter= in module-specific dex2oat flags |
| 61 | SystemServerCompilerFilter string // default compiler filter to pass to dex2oat for system server jars |
| 62 | |
Nicolas Geoffray | c1bf724 | 2019-10-18 14:51:38 +0100 | [diff] [blame] | 63 | GenerateDMFiles bool // generate Dex Metadata files |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 64 | |
| 65 | NoDebugInfo bool // don't generate debug info by default |
Mathieu Chartier | 3f7ddbb | 2019-04-29 09:33:50 -0700 | [diff] [blame] | 66 | DontResolveStartupStrings bool // don't resolve string literals loaded during application startup. |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 67 | AlwaysSystemServerDebugInfo bool // always generate mini debug info for system server modules (overrides NoDebugInfo=true) |
| 68 | NeverSystemServerDebugInfo bool // never generate mini debug info for system server modules (overrides NoDebugInfo=false) |
| 69 | AlwaysOtherDebugInfo bool // always generate mini debug info for non-system server modules (overrides NoDebugInfo=true) |
| 70 | NeverOtherDebugInfo bool // never generate mini debug info for non-system server modules (overrides NoDebugInfo=true) |
| 71 | |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 72 | IsEng bool // build is a eng variant |
| 73 | SanitizeLite bool // build is the second phase of a SANITIZE_LITE build |
| 74 | |
| 75 | DefaultAppImages bool // build app images (TODO: .art files?) by default |
| 76 | |
Colin Cross | 800fe13 | 2019-02-11 14:21:24 -0800 | [diff] [blame] | 77 | Dex2oatXmx string // max heap size for dex2oat |
| 78 | Dex2oatXms string // initial heap size for dex2oat |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 79 | |
| 80 | EmptyDirectory string // path to an empty directory |
| 81 | |
Colin Cross | 74ba962 | 2019-02-11 15:11:14 -0800 | [diff] [blame] | 82 | CpuVariant map[android.ArchType]string // cpu variant for each architecture |
| 83 | InstructionSetFeatures map[android.ArchType]string // instruction set for each architecture |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 84 | |
Nicolas Geoffray | 1086e60 | 2021-01-20 14:30:40 +0000 | [diff] [blame] | 85 | BootImageProfiles android.Paths // path to a boot-image-profile.txt file |
| 86 | BootFlags string // extra flags to pass to dex2oat for the boot image |
| 87 | Dex2oatImageXmx string // max heap size for dex2oat for the boot image |
| 88 | Dex2oatImageXms string // initial heap size for dex2oat for the boot image |
Ulya Trafimovich | 8c35fcf | 2021-02-17 16:23:28 +0000 | [diff] [blame] | 89 | |
Ulya Trafimovich | 4a13acb | 2021-03-02 12:25:02 +0000 | [diff] [blame] | 90 | // If true, downgrade the compiler filter of dexpreopt to "verify" when verify_uses_libraries |
Ulya Trafimovich | 8c35fcf | 2021-02-17 16:23:28 +0000 | [diff] [blame] | 91 | // check fails, instead of failing the build. This will disable any AOT-compilation. |
| 92 | // |
| 93 | // The intended use case for this flag is to have a smoother migration path for the Java |
| 94 | // modules that need to add <uses-library> information in their build files. The flag allows to |
| 95 | // quickly silence build errors. This flag should be used with caution and only as a temporary |
| 96 | // measure, as it masks real errors and affects performance. |
| 97 | RelaxUsesLibraryCheck bool |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 98 | } |
| 99 | |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 100 | // GlobalSoongConfig contains the global config that is generated from Soong, |
| 101 | // stored in dexpreopt_soong.config. |
| 102 | type GlobalSoongConfig struct { |
| 103 | // Paths to tools possibly used by the generated commands. |
| 104 | Profman android.Path |
| 105 | Dex2oat android.Path |
| 106 | Aapt android.Path |
| 107 | SoongZip android.Path |
| 108 | Zip2zip android.Path |
| 109 | ManifestCheck android.Path |
Colin Cross | 38b9685 | 2019-05-22 10:21:09 -0700 | [diff] [blame] | 110 | ConstructContext android.Path |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | type ModuleConfig struct { |
Victor Hsieh | d181c8b | 2019-01-29 13:00:33 -0800 | [diff] [blame] | 114 | Name string |
| 115 | DexLocation string // dex location on device |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 116 | BuildPath android.OutputPath |
| 117 | DexPath android.Path |
Jeongik Cha | 33a3a81 | 2021-04-15 09:12:49 +0900 | [diff] [blame] | 118 | ManifestPath android.OptionalPath |
Victor Hsieh | d181c8b | 2019-01-29 13:00:33 -0800 | [diff] [blame] | 119 | UncompressedDex bool |
| 120 | HasApkLibraries bool |
| 121 | PreoptFlags []string |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 122 | |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 123 | ProfileClassListing android.OptionalPath |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 124 | ProfileIsTextListing bool |
Nicolas Geoffray | e710242 | 2019-07-24 13:19:29 +0100 | [diff] [blame] | 125 | ProfileBootListing android.OptionalPath |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 126 | |
Ulya Trafimovich | 8c35fcf | 2021-02-17 16:23:28 +0000 | [diff] [blame] | 127 | EnforceUsesLibraries bool // turn on build-time verify_uses_libraries check |
| 128 | EnforceUsesLibrariesStatusFile android.Path // a file with verify_uses_libraries errors (if any) |
| 129 | ProvidesUsesLibrary string // library name (usually the same as module name) |
| 130 | ClassLoaderContexts ClassLoaderContextMap |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 131 | |
Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 132 | Archs []android.ArchType |
Jeongik Cha | c624667 | 2021-04-08 00:00:19 +0900 | [diff] [blame^] | 133 | DexPreoptImages android.Paths |
Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 134 | DexPreoptImagesDeps []android.OutputPaths |
| 135 | DexPreoptImageLocations []string |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 136 | |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 137 | PreoptBootClassPathDexFiles android.Paths // file paths of boot class path files |
| 138 | PreoptBootClassPathDexLocations []string // virtual locations of boot class path files |
Colin Cross | 800fe13 | 2019-02-11 14:21:24 -0800 | [diff] [blame] | 139 | |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 140 | PreoptExtractedApk bool // Overrides OnlyPreoptModules |
| 141 | |
| 142 | NoCreateAppImage bool |
| 143 | ForceCreateAppImage bool |
| 144 | |
| 145 | PresignedPrebuilt bool |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 146 | } |
| 147 | |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 148 | type globalSoongConfigSingleton struct{} |
| 149 | |
| 150 | var pctx = android.NewPackageContext("android/soong/dexpreopt") |
| 151 | |
| 152 | func init() { |
| 153 | pctx.Import("android/soong/android") |
| 154 | android.RegisterSingletonType("dexpreopt-soong-config", func() android.Singleton { |
| 155 | return &globalSoongConfigSingleton{} |
| 156 | }) |
| 157 | } |
| 158 | |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 159 | func constructPath(ctx android.PathContext, path string) android.Path { |
| 160 | buildDirPrefix := ctx.Config().BuildDir() + "/" |
| 161 | if path == "" { |
| 162 | return nil |
| 163 | } else if strings.HasPrefix(path, buildDirPrefix) { |
| 164 | return android.PathForOutput(ctx, strings.TrimPrefix(path, buildDirPrefix)) |
| 165 | } else { |
| 166 | return android.PathForSource(ctx, path) |
| 167 | } |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 168 | } |
| 169 | |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 170 | func constructPaths(ctx android.PathContext, paths []string) android.Paths { |
| 171 | var ret android.Paths |
| 172 | for _, path := range paths { |
| 173 | ret = append(ret, constructPath(ctx, path)) |
| 174 | } |
| 175 | return ret |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 176 | } |
| 177 | |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 178 | func constructWritablePath(ctx android.PathContext, path string) android.WritablePath { |
| 179 | if path == "" { |
| 180 | return nil |
| 181 | } |
| 182 | return constructPath(ctx, path).(android.WritablePath) |
| 183 | } |
| 184 | |
Martin Stjernholm | 40f9f3c | 2020-01-20 18:12:23 +0000 | [diff] [blame] | 185 | // ParseGlobalConfig parses the given data assumed to be read from the global |
| 186 | // dexpreopt.config file into a GlobalConfig struct. |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 187 | func ParseGlobalConfig(ctx android.PathContext, data []byte) (*GlobalConfig, error) { |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 188 | type GlobalJSONConfig struct { |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 189 | *GlobalConfig |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 190 | |
| 191 | // Copies of entries in GlobalConfig that are not constructable without extra parameters. They will be |
| 192 | // used to construct the real value manually below. |
Paul Duffin | 7ccacae | 2020-10-23 21:14:20 +0100 | [diff] [blame] | 193 | BootImageProfiles []string |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | config := GlobalJSONConfig{} |
Colin Cross | 988414c | 2020-01-11 01:11:46 +0000 | [diff] [blame] | 197 | err := json.Unmarshal(data, &config) |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 198 | if err != nil { |
Colin Cross | 988414c | 2020-01-11 01:11:46 +0000 | [diff] [blame] | 199 | return config.GlobalConfig, err |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | // Construct paths that require a PathContext. |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 203 | config.GlobalConfig.BootImageProfiles = constructPaths(ctx, config.BootImageProfiles) |
| 204 | |
Colin Cross | 988414c | 2020-01-11 01:11:46 +0000 | [diff] [blame] | 205 | return config.GlobalConfig, nil |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 206 | } |
| 207 | |
Martin Stjernholm | 40f9f3c | 2020-01-20 18:12:23 +0000 | [diff] [blame] | 208 | type globalConfigAndRaw struct { |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 209 | global *GlobalConfig |
Martin Stjernholm | 40f9f3c | 2020-01-20 18:12:23 +0000 | [diff] [blame] | 210 | data []byte |
| 211 | } |
| 212 | |
| 213 | // GetGlobalConfig returns the global dexpreopt.config that's created in the |
| 214 | // make config phase. It is loaded once the first time it is called for any |
| 215 | // ctx.Config(), and returns the same data for all future calls with the same |
| 216 | // ctx.Config(). A value can be inserted for tests using |
| 217 | // setDexpreoptTestGlobalConfig. |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 218 | func GetGlobalConfig(ctx android.PathContext) *GlobalConfig { |
Martin Stjernholm | 40f9f3c | 2020-01-20 18:12:23 +0000 | [diff] [blame] | 219 | return getGlobalConfigRaw(ctx).global |
| 220 | } |
| 221 | |
| 222 | // GetGlobalConfigRawData is the same as GetGlobalConfig, except that it returns |
| 223 | // the literal content of dexpreopt.config. |
| 224 | func GetGlobalConfigRawData(ctx android.PathContext) []byte { |
| 225 | return getGlobalConfigRaw(ctx).data |
| 226 | } |
| 227 | |
| 228 | var globalConfigOnceKey = android.NewOnceKey("DexpreoptGlobalConfig") |
| 229 | var testGlobalConfigOnceKey = android.NewOnceKey("TestDexpreoptGlobalConfig") |
| 230 | |
| 231 | func getGlobalConfigRaw(ctx android.PathContext) globalConfigAndRaw { |
| 232 | return ctx.Config().Once(globalConfigOnceKey, func() interface{} { |
| 233 | if data, err := ctx.Config().DexpreoptGlobalConfig(ctx); err != nil { |
| 234 | panic(err) |
| 235 | } else if data != nil { |
| 236 | globalConfig, err := ParseGlobalConfig(ctx, data) |
| 237 | if err != nil { |
| 238 | panic(err) |
| 239 | } |
| 240 | return globalConfigAndRaw{globalConfig, data} |
| 241 | } |
| 242 | |
| 243 | // No global config filename set, see if there is a test config set |
| 244 | return ctx.Config().Once(testGlobalConfigOnceKey, func() interface{} { |
| 245 | // Nope, return a config with preopting disabled |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 246 | return globalConfigAndRaw{&GlobalConfig{ |
Ulya Trafimovich | a4a1c4e | 2021-01-15 18:40:04 +0000 | [diff] [blame] | 247 | DisablePreopt: true, |
| 248 | DisablePreoptBootImages: true, |
| 249 | DisableGenerateProfile: true, |
Martin Stjernholm | 40f9f3c | 2020-01-20 18:12:23 +0000 | [diff] [blame] | 250 | }, nil} |
| 251 | }) |
| 252 | }).(globalConfigAndRaw) |
| 253 | } |
| 254 | |
| 255 | // SetTestGlobalConfig sets a GlobalConfig that future calls to GetGlobalConfig |
| 256 | // will return. It must be called before the first call to GetGlobalConfig for |
| 257 | // the config. |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 258 | func SetTestGlobalConfig(config android.Config, globalConfig *GlobalConfig) { |
Martin Stjernholm | 40f9f3c | 2020-01-20 18:12:23 +0000 | [diff] [blame] | 259 | config.Once(testGlobalConfigOnceKey, func() interface{} { return globalConfigAndRaw{globalConfig, nil} }) |
| 260 | } |
| 261 | |
Jeongik Cha | c624667 | 2021-04-08 00:00:19 +0900 | [diff] [blame^] | 262 | // This struct is required to convert ModuleConfig from/to JSON. |
| 263 | // The types of fields in ModuleConfig are not convertible, |
| 264 | // so moduleJSONConfig has those fields as a convertible type. |
| 265 | type moduleJSONConfig struct { |
| 266 | *ModuleConfig |
| 267 | |
| 268 | BuildPath string |
| 269 | DexPath string |
| 270 | ManifestPath string |
| 271 | |
| 272 | ProfileClassListing string |
| 273 | ProfileBootListing string |
| 274 | |
| 275 | EnforceUsesLibrariesStatusFile string |
| 276 | ClassLoaderContexts jsonClassLoaderContextMap |
| 277 | |
| 278 | DexPreoptImages []string |
| 279 | DexPreoptImagesDeps [][]string |
| 280 | |
| 281 | PreoptBootClassPathDexFiles []string |
| 282 | } |
| 283 | |
Martin Stjernholm | 40f9f3c | 2020-01-20 18:12:23 +0000 | [diff] [blame] | 284 | // ParseModuleConfig parses a per-module dexpreopt.config file into a |
| 285 | // ModuleConfig struct. It is not used in Soong, which receives a ModuleConfig |
| 286 | // struct directly from java/dexpreopt.go. It is used in dexpreopt_gen called |
| 287 | // from Make to read the module dexpreopt.config written in the Make config |
| 288 | // stage. |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 289 | func ParseModuleConfig(ctx android.PathContext, data []byte) (*ModuleConfig, error) { |
Jeongik Cha | c624667 | 2021-04-08 00:00:19 +0900 | [diff] [blame^] | 290 | config := moduleJSONConfig{} |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 291 | |
Colin Cross | 988414c | 2020-01-11 01:11:46 +0000 | [diff] [blame] | 292 | err := json.Unmarshal(data, &config) |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 293 | if err != nil { |
| 294 | return config.ModuleConfig, err |
| 295 | } |
| 296 | |
| 297 | // Construct paths that require a PathContext. |
| 298 | config.ModuleConfig.BuildPath = constructPath(ctx, config.BuildPath).(android.OutputPath) |
| 299 | config.ModuleConfig.DexPath = constructPath(ctx, config.DexPath) |
Jeongik Cha | 33a3a81 | 2021-04-15 09:12:49 +0900 | [diff] [blame] | 300 | config.ModuleConfig.ManifestPath = android.OptionalPathForPath(constructPath(ctx, config.ManifestPath)) |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 301 | config.ModuleConfig.ProfileClassListing = android.OptionalPathForPath(constructPath(ctx, config.ProfileClassListing)) |
Ulya Trafimovich | 8c35fcf | 2021-02-17 16:23:28 +0000 | [diff] [blame] | 302 | config.ModuleConfig.EnforceUsesLibrariesStatusFile = constructPath(ctx, config.EnforceUsesLibrariesStatusFile) |
Ulya Trafimovich | 8cbc5d2 | 2020-11-03 15:15:46 +0000 | [diff] [blame] | 303 | config.ModuleConfig.ClassLoaderContexts = fromJsonClassLoaderContext(ctx, config.ClassLoaderContexts) |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 304 | config.ModuleConfig.DexPreoptImages = constructPaths(ctx, config.DexPreoptImages) |
| 305 | config.ModuleConfig.PreoptBootClassPathDexFiles = constructPaths(ctx, config.PreoptBootClassPathDexFiles) |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 306 | |
Dan Willemsen | 0f41678 | 2019-06-13 21:44:53 +0000 | [diff] [blame] | 307 | // This needs to exist, but dependencies are already handled in Make, so we don't need to pass them through JSON. |
Ulya Trafimovich | 4d2eeed | 2019-11-08 10:54:21 +0000 | [diff] [blame] | 308 | config.ModuleConfig.DexPreoptImagesDeps = make([]android.OutputPaths, len(config.ModuleConfig.DexPreoptImages)) |
Dan Willemsen | 0f41678 | 2019-06-13 21:44:53 +0000 | [diff] [blame] | 309 | |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 310 | return config.ModuleConfig, nil |
| 311 | } |
| 312 | |
Jeongik Cha | c624667 | 2021-04-08 00:00:19 +0900 | [diff] [blame^] | 313 | func pathsListToStringLists(pathsList []android.OutputPaths) [][]string { |
| 314 | ret := make([][]string, 0, len(pathsList)) |
| 315 | for _, paths := range pathsList { |
| 316 | ret = append(ret, paths.Strings()) |
| 317 | } |
| 318 | return ret |
| 319 | } |
| 320 | |
| 321 | func moduleConfigToJSON(config *ModuleConfig) ([]byte, error) { |
| 322 | return json.MarshalIndent(&moduleJSONConfig{ |
| 323 | BuildPath: config.BuildPath.String(), |
| 324 | DexPath: config.DexPath.String(), |
| 325 | ManifestPath: config.ManifestPath.String(), |
| 326 | ProfileClassListing: config.ProfileClassListing.String(), |
| 327 | ProfileBootListing: config.ProfileBootListing.String(), |
| 328 | EnforceUsesLibrariesStatusFile: config.EnforceUsesLibrariesStatusFile.String(), |
| 329 | ClassLoaderContexts: toJsonClassLoaderContext(config.ClassLoaderContexts), |
| 330 | DexPreoptImages: config.DexPreoptImages.Strings(), |
| 331 | DexPreoptImagesDeps: pathsListToStringLists(config.DexPreoptImagesDeps), |
| 332 | PreoptBootClassPathDexFiles: config.PreoptBootClassPathDexFiles.Strings(), |
| 333 | ModuleConfig: config, |
| 334 | }, "", " ") |
| 335 | } |
| 336 | |
| 337 | // WriteModuleConfig serializes a ModuleConfig into a per-module dexpreopt.config JSON file. |
| 338 | // These config files are used for post-processing. |
| 339 | func WriteModuleConfig(ctx android.ModuleContext, config *ModuleConfig, path android.WritablePath) { |
Ulya Trafimovich | 76b0852 | 2021-01-14 17:52:43 +0000 | [diff] [blame] | 340 | if path == nil { |
| 341 | return |
| 342 | } |
| 343 | |
Jeongik Cha | c624667 | 2021-04-08 00:00:19 +0900 | [diff] [blame^] | 344 | data, err := moduleConfigToJSON(config) |
Ulya Trafimovich | 76b0852 | 2021-01-14 17:52:43 +0000 | [diff] [blame] | 345 | if err != nil { |
| 346 | ctx.ModuleErrorf("failed to JSON marshal module dexpreopt.config: %v", err) |
| 347 | return |
| 348 | } |
| 349 | |
| 350 | android.WriteFileRule(ctx, path, string(data)) |
| 351 | } |
| 352 | |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 353 | // dex2oatModuleName returns the name of the module to use for the dex2oat host |
| 354 | // tool. It should be a binary module with public visibility that is compiled |
| 355 | // and installed for host. |
| 356 | func dex2oatModuleName(config android.Config) string { |
| 357 | // Default to the debug variant of dex2oat to help find bugs. |
| 358 | // Set USE_DEX2OAT_DEBUG to false for only building non-debug versions. |
| 359 | if config.Getenv("USE_DEX2OAT_DEBUG") == "false" { |
| 360 | return "dex2oat" |
| 361 | } else { |
| 362 | return "dex2oatd" |
| 363 | } |
| 364 | } |
| 365 | |
Paul Duffin | b506c9d | 2021-03-24 14:34:40 +0000 | [diff] [blame] | 366 | type dex2oatDependencyTag struct { |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 367 | blueprint.BaseDependencyTag |
Paul Duffin | b506c9d | 2021-03-24 14:34:40 +0000 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | func (d dex2oatDependencyTag) ExcludeFromVisibilityEnforcement() { |
| 371 | } |
| 372 | |
| 373 | func (d dex2oatDependencyTag) ExcludeFromApexContents() { |
| 374 | } |
| 375 | |
| 376 | // Dex2oatDepTag represents the dependency onto the dex2oatd module. It is added to any module that |
| 377 | // needs dexpreopting and so it makes no sense for it to be checked for visibility or included in |
| 378 | // the apex. |
| 379 | var Dex2oatDepTag = dex2oatDependencyTag{} |
| 380 | |
| 381 | var _ android.ExcludeFromVisibilityEnforcementTag = Dex2oatDepTag |
| 382 | var _ android.ExcludeFromApexContentsTag = Dex2oatDepTag |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 383 | |
Martin Stjernholm | 6d41527 | 2020-01-31 17:10:36 +0000 | [diff] [blame] | 384 | // RegisterToolDeps adds the necessary dependencies to binary modules for tools |
| 385 | // that are required later when Get(Cached)GlobalSoongConfig is called. It |
| 386 | // should be called from a mutator that's registered with |
| 387 | // android.RegistrationContext.FinalDepsMutators. |
| 388 | func RegisterToolDeps(ctx android.BottomUpMutatorContext) { |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 389 | dex2oatBin := dex2oatModuleName(ctx.Config()) |
| 390 | v := ctx.Config().BuildOSTarget.Variations() |
Ulya Trafimovich | a4a1c4e | 2021-01-15 18:40:04 +0000 | [diff] [blame] | 391 | ctx.AddFarVariationDependencies(v, Dex2oatDepTag, dex2oatBin) |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | func dex2oatPathFromDep(ctx android.ModuleContext) android.Path { |
| 395 | dex2oatBin := dex2oatModuleName(ctx.Config()) |
| 396 | |
Martin Stjernholm | c004862 | 2020-08-18 17:37:41 +0100 | [diff] [blame] | 397 | // Find the right dex2oat module, trying to follow PrebuiltDepTag from source |
| 398 | // to prebuilt if there is one. We wouldn't have to do this if the |
| 399 | // prebuilt_postdeps mutator that replaces source deps with prebuilt deps was |
| 400 | // run after RegisterToolDeps above, but changing that leads to ordering |
| 401 | // problems between mutators (RegisterToolDeps needs to run late to act on |
| 402 | // final variants, while prebuilt_postdeps needs to run before many of the |
| 403 | // PostDeps mutators, like the APEX mutators). Hence we need to dig out the |
| 404 | // prebuilt explicitly here instead. |
| 405 | var dex2oatModule android.Module |
| 406 | ctx.WalkDeps(func(child, parent android.Module) bool { |
Ulya Trafimovich | a4a1c4e | 2021-01-15 18:40:04 +0000 | [diff] [blame] | 407 | if parent == ctx.Module() && ctx.OtherModuleDependencyTag(child) == Dex2oatDepTag { |
Martin Stjernholm | c004862 | 2020-08-18 17:37:41 +0100 | [diff] [blame] | 408 | // Found the source module, or prebuilt module that has replaced the source. |
| 409 | dex2oatModule = child |
| 410 | if p, ok := child.(android.PrebuiltInterface); ok && p.Prebuilt() != nil { |
| 411 | return false // If it's the prebuilt we're done. |
| 412 | } else { |
| 413 | return true // Recurse to check if the source has a prebuilt dependency. |
| 414 | } |
| 415 | } |
| 416 | if parent == dex2oatModule && ctx.OtherModuleDependencyTag(child) == android.PrebuiltDepTag { |
| 417 | if p, ok := child.(android.PrebuiltInterface); ok && p.Prebuilt() != nil && p.Prebuilt().UsePrebuilt() { |
| 418 | dex2oatModule = child // Found a prebuilt that should be used. |
| 419 | } |
| 420 | } |
| 421 | return false |
| 422 | }) |
| 423 | |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 424 | if dex2oatModule == nil { |
| 425 | // If this happens there's probably a missing call to AddToolDeps in DepsMutator. |
| 426 | panic(fmt.Sprintf("Failed to lookup %s dependency", dex2oatBin)) |
| 427 | } |
| 428 | |
| 429 | dex2oatPath := dex2oatModule.(android.HostToolProvider).HostToolPath() |
| 430 | if !dex2oatPath.Valid() { |
| 431 | panic(fmt.Sprintf("Failed to find host tool path in %s", dex2oatModule)) |
| 432 | } |
| 433 | |
| 434 | return dex2oatPath.Path() |
| 435 | } |
| 436 | |
Martin Stjernholm | 75a48d8 | 2020-01-10 20:32:59 +0000 | [diff] [blame] | 437 | // createGlobalSoongConfig creates a GlobalSoongConfig from the current context. |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 438 | // Should not be used in dexpreopt_gen. |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 439 | func createGlobalSoongConfig(ctx android.ModuleContext) *GlobalSoongConfig { |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 440 | return &GlobalSoongConfig{ |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 441 | Profman: ctx.Config().HostToolPath(ctx, "profman"), |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 442 | Dex2oat: dex2oatPathFromDep(ctx), |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 443 | Aapt: ctx.Config().HostToolPath(ctx, "aapt"), |
| 444 | SoongZip: ctx.Config().HostToolPath(ctx, "soong_zip"), |
| 445 | Zip2zip: ctx.Config().HostToolPath(ctx, "zip2zip"), |
| 446 | ManifestCheck: ctx.Config().HostToolPath(ctx, "manifest_check"), |
Ulya Trafimovich | 5f364b6 | 2020-06-30 12:39:01 +0100 | [diff] [blame] | 447 | ConstructContext: ctx.Config().HostToolPath(ctx, "construct_context"), |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 448 | } |
| 449 | } |
| 450 | |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 451 | // The main reason for this Once cache for GlobalSoongConfig is to make the |
| 452 | // dex2oat path available to singletons. In ordinary modules we get it through a |
Ulya Trafimovich | a4a1c4e | 2021-01-15 18:40:04 +0000 | [diff] [blame] | 453 | // Dex2oatDepTag dependency, but in singletons there's no simple way to do the |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 454 | // same thing and ensure the right variant is selected, hence this cache to make |
| 455 | // the resolved path available to singletons. This means we depend on there |
Ulya Trafimovich | a4a1c4e | 2021-01-15 18:40:04 +0000 | [diff] [blame] | 456 | // being at least one ordinary module with a Dex2oatDepTag dependency. |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 457 | // |
| 458 | // TODO(b/147613152): Implement a way to deal with dependencies from singletons, |
Paul Duffin | 9f04524 | 2021-01-21 15:05:11 +0000 | [diff] [blame] | 459 | // and then possibly remove this cache altogether. |
Martin Stjernholm | 75a48d8 | 2020-01-10 20:32:59 +0000 | [diff] [blame] | 460 | var globalSoongConfigOnceKey = android.NewOnceKey("DexpreoptGlobalSoongConfig") |
| 461 | |
| 462 | // GetGlobalSoongConfig creates a GlobalSoongConfig the first time it's called, |
| 463 | // and later returns the same cached instance. |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 464 | func GetGlobalSoongConfig(ctx android.ModuleContext) *GlobalSoongConfig { |
Martin Stjernholm | 75a48d8 | 2020-01-10 20:32:59 +0000 | [diff] [blame] | 465 | globalSoong := ctx.Config().Once(globalSoongConfigOnceKey, func() interface{} { |
| 466 | return createGlobalSoongConfig(ctx) |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 467 | }).(*GlobalSoongConfig) |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 468 | |
| 469 | // Always resolve the tool path from the dependency, to ensure that every |
| 470 | // module has the dependency added properly. |
| 471 | myDex2oat := dex2oatPathFromDep(ctx) |
| 472 | if myDex2oat != globalSoong.Dex2oat { |
| 473 | panic(fmt.Sprintf("Inconsistent dex2oat path in cached config: expected %s, got %s", globalSoong.Dex2oat, myDex2oat)) |
| 474 | } |
| 475 | |
Martin Stjernholm | 75a48d8 | 2020-01-10 20:32:59 +0000 | [diff] [blame] | 476 | return globalSoong |
| 477 | } |
| 478 | |
| 479 | // GetCachedGlobalSoongConfig returns a cached GlobalSoongConfig created by an |
| 480 | // earlier GetGlobalSoongConfig call. This function works with any context |
| 481 | // compatible with a basic PathContext, since it doesn't try to create a |
Martin Stjernholm | 6d41527 | 2020-01-31 17:10:36 +0000 | [diff] [blame] | 482 | // GlobalSoongConfig with the proper paths (which requires a full |
| 483 | // ModuleContext). If there has been no prior call to GetGlobalSoongConfig, nil |
| 484 | // is returned. |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 485 | func GetCachedGlobalSoongConfig(ctx android.PathContext) *GlobalSoongConfig { |
Martin Stjernholm | 6d41527 | 2020-01-31 17:10:36 +0000 | [diff] [blame] | 486 | return ctx.Config().Once(globalSoongConfigOnceKey, func() interface{} { |
| 487 | return (*GlobalSoongConfig)(nil) |
| 488 | }).(*GlobalSoongConfig) |
Martin Stjernholm | 75a48d8 | 2020-01-10 20:32:59 +0000 | [diff] [blame] | 489 | } |
| 490 | |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 491 | type globalJsonSoongConfig struct { |
| 492 | Profman string |
| 493 | Dex2oat string |
| 494 | Aapt string |
| 495 | SoongZip string |
| 496 | Zip2zip string |
| 497 | ManifestCheck string |
| 498 | ConstructContext string |
| 499 | } |
| 500 | |
Martin Stjernholm | 40f9f3c | 2020-01-20 18:12:23 +0000 | [diff] [blame] | 501 | // ParseGlobalSoongConfig parses the given data assumed to be read from the |
| 502 | // global dexpreopt_soong.config file into a GlobalSoongConfig struct. It is |
| 503 | // only used in dexpreopt_gen. |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 504 | func ParseGlobalSoongConfig(ctx android.PathContext, data []byte) (*GlobalSoongConfig, error) { |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 505 | var jc globalJsonSoongConfig |
| 506 | |
Colin Cross | 988414c | 2020-01-11 01:11:46 +0000 | [diff] [blame] | 507 | err := json.Unmarshal(data, &jc) |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 508 | if err != nil { |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 509 | return &GlobalSoongConfig{}, err |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 510 | } |
| 511 | |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 512 | config := &GlobalSoongConfig{ |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 513 | Profman: constructPath(ctx, jc.Profman), |
| 514 | Dex2oat: constructPath(ctx, jc.Dex2oat), |
| 515 | Aapt: constructPath(ctx, jc.Aapt), |
| 516 | SoongZip: constructPath(ctx, jc.SoongZip), |
| 517 | Zip2zip: constructPath(ctx, jc.Zip2zip), |
| 518 | ManifestCheck: constructPath(ctx, jc.ManifestCheck), |
| 519 | ConstructContext: constructPath(ctx, jc.ConstructContext), |
| 520 | } |
| 521 | |
| 522 | return config, nil |
| 523 | } |
| 524 | |
| 525 | func (s *globalSoongConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) { |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 526 | if GetGlobalConfig(ctx).DisablePreopt { |
| 527 | return |
| 528 | } |
| 529 | |
Martin Stjernholm | 75a48d8 | 2020-01-10 20:32:59 +0000 | [diff] [blame] | 530 | config := GetCachedGlobalSoongConfig(ctx) |
Martin Stjernholm | 6d41527 | 2020-01-31 17:10:36 +0000 | [diff] [blame] | 531 | if config == nil { |
| 532 | // No module has enabled dexpreopting, so we assume there will be no calls |
| 533 | // to dexpreopt_gen. |
| 534 | return |
| 535 | } |
| 536 | |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 537 | jc := globalJsonSoongConfig{ |
| 538 | Profman: config.Profman.String(), |
| 539 | Dex2oat: config.Dex2oat.String(), |
| 540 | Aapt: config.Aapt.String(), |
| 541 | SoongZip: config.SoongZip.String(), |
| 542 | Zip2zip: config.Zip2zip.String(), |
| 543 | ManifestCheck: config.ManifestCheck.String(), |
| 544 | ConstructContext: config.ConstructContext.String(), |
| 545 | } |
| 546 | |
| 547 | data, err := json.Marshal(jc) |
| 548 | if err != nil { |
| 549 | ctx.Errorf("failed to JSON marshal GlobalSoongConfig: %v", err) |
| 550 | return |
| 551 | } |
| 552 | |
Colin Cross | cf371cc | 2020-11-13 11:48:42 -0800 | [diff] [blame] | 553 | android.WriteFileRule(ctx, android.PathForOutput(ctx, "dexpreopt_soong.config"), string(data)) |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 554 | } |
| 555 | |
| 556 | func (s *globalSoongConfigSingleton) MakeVars(ctx android.MakeVarsContext) { |
Martin Stjernholm | d90676f | 2020-01-11 00:37:30 +0000 | [diff] [blame] | 557 | if GetGlobalConfig(ctx).DisablePreopt { |
| 558 | return |
| 559 | } |
| 560 | |
Martin Stjernholm | 75a48d8 | 2020-01-10 20:32:59 +0000 | [diff] [blame] | 561 | config := GetCachedGlobalSoongConfig(ctx) |
Martin Stjernholm | 6d41527 | 2020-01-31 17:10:36 +0000 | [diff] [blame] | 562 | if config == nil { |
| 563 | return |
| 564 | } |
Martin Stjernholm | c52aaf1 | 2020-01-06 23:11:37 +0000 | [diff] [blame] | 565 | |
| 566 | ctx.Strict("DEX2OAT", config.Dex2oat.String()) |
| 567 | ctx.Strict("DEXPREOPT_GEN_DEPS", strings.Join([]string{ |
| 568 | config.Profman.String(), |
| 569 | config.Dex2oat.String(), |
| 570 | config.Aapt.String(), |
| 571 | config.SoongZip.String(), |
| 572 | config.Zip2zip.String(), |
| 573 | config.ManifestCheck.String(), |
| 574 | config.ConstructContext.String(), |
| 575 | }, " ")) |
| 576 | } |
| 577 | |
Martin Stjernholm | 8d80cee | 2020-01-31 17:44:54 +0000 | [diff] [blame] | 578 | func GlobalConfigForTests(ctx android.PathContext) *GlobalConfig { |
| 579 | return &GlobalConfig{ |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 580 | DisablePreopt: false, |
| 581 | DisablePreoptModules: nil, |
| 582 | OnlyPreoptBootImageAndSystemServer: false, |
| 583 | HasSystemOther: false, |
| 584 | PatternsOnSystemOther: nil, |
| 585 | DisableGenerateProfile: false, |
| 586 | ProfileDir: "", |
Ulya Trafimovich | 249386a | 2020-07-01 14:31:13 +0100 | [diff] [blame] | 587 | BootJars: android.EmptyConfiguredJarList(), |
| 588 | UpdatableBootJars: android.EmptyConfiguredJarList(), |
| 589 | ArtApexJars: android.EmptyConfiguredJarList(), |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 590 | SystemServerJars: nil, |
| 591 | SystemServerApps: nil, |
Ulya Trafimovich | 249386a | 2020-07-01 14:31:13 +0100 | [diff] [blame] | 592 | UpdatableSystemServerJars: android.EmptyConfiguredJarList(), |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 593 | SpeedApps: nil, |
| 594 | PreoptFlags: nil, |
| 595 | DefaultCompilerFilter: "", |
| 596 | SystemServerCompilerFilter: "", |
| 597 | GenerateDMFiles: false, |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 598 | NoDebugInfo: false, |
Mathieu Chartier | 3f7ddbb | 2019-04-29 09:33:50 -0700 | [diff] [blame] | 599 | DontResolveStartupStrings: false, |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 600 | AlwaysSystemServerDebugInfo: false, |
| 601 | NeverSystemServerDebugInfo: false, |
| 602 | AlwaysOtherDebugInfo: false, |
| 603 | NeverOtherDebugInfo: false, |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 604 | IsEng: false, |
| 605 | SanitizeLite: false, |
| 606 | DefaultAppImages: false, |
| 607 | Dex2oatXmx: "", |
| 608 | Dex2oatXms: "", |
| 609 | EmptyDirectory: "empty_dir", |
| 610 | CpuVariant: nil, |
| 611 | InstructionSetFeatures: nil, |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 612 | BootImageProfiles: nil, |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 613 | BootFlags: "", |
| 614 | Dex2oatImageXmx: "", |
| 615 | Dex2oatImageXms: "", |
Martin Stjernholm | 75a48d8 | 2020-01-10 20:32:59 +0000 | [diff] [blame] | 616 | } |
| 617 | } |
| 618 | |
Paul Duffin | 9f04524 | 2021-01-21 15:05:11 +0000 | [diff] [blame] | 619 | func globalSoongConfigForTests() *GlobalSoongConfig { |
| 620 | return &GlobalSoongConfig{ |
| 621 | Profman: android.PathForTesting("profman"), |
| 622 | Dex2oat: android.PathForTesting("dex2oat"), |
| 623 | Aapt: android.PathForTesting("aapt"), |
| 624 | SoongZip: android.PathForTesting("soong_zip"), |
| 625 | Zip2zip: android.PathForTesting("zip2zip"), |
| 626 | ManifestCheck: android.PathForTesting("manifest_check"), |
| 627 | ConstructContext: android.PathForTesting("construct_context"), |
| 628 | } |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 629 | } |