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