diff options
author | Colin Cross <ccross@android.com> | 2019-02-15 10:39:37 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2019-02-20 14:23:37 -0800 |
commit | acdd6940719125104dfd2f692990c99682f95f05 (patch) | |
tree | c68a0c59d926ac2dfd22122afb765d7eafa208f6 /java/dexpreopt.go | |
parent | 45df0bd15a986aa4e202e3ed75548929fd9bdc23 (diff) | |
download | android_build_soong-acdd6940719125104dfd2f692990c99682f95f05.tar.gz android_build_soong-acdd6940719125104dfd2f692990c99682f95f05.tar.bz2 android_build_soong-acdd6940719125104dfd2f692990c99682f95f05.zip |
Make RuleBuilder methods take Paths
There are no more Make paths being used in Soong now that
dexpreopting and hiddenapi are in Soong. Use the Path types
in the inputs to RuleBuilder, and fix all users of RuleBuilder.
Test: all soong tests
Test: m checkbuild
Change-Id: I886f803d9a3419a43b2cae412537645f94c5dfbf
Diffstat (limited to 'java/dexpreopt.go')
-rw-r--r-- | java/dexpreopt.go | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/java/dexpreopt.go b/java/dexpreopt.go index 0a565297..b53e9c47 100644 --- a/java/dexpreopt.go +++ b/java/dexpreopt.go @@ -86,18 +86,28 @@ func (d *dexpreopter) dexpreoptDisabled(ctx android.ModuleContext) bool { } var dexpreoptGlobalConfigKey = android.NewOnceKey("DexpreoptGlobalConfig") +var dexpreoptTestGlobalConfigKey = android.NewOnceKey("TestDexpreoptGlobalConfig") + +func setDexpreoptGlobalConfig(config android.Config, globalConfig dexpreopt.GlobalConfig) { + config.Once(dexpreoptTestGlobalConfigKey, func() interface{} { return globalConfig }) +} func dexpreoptGlobalConfig(ctx android.PathContext) dexpreopt.GlobalConfig { return ctx.Config().Once(dexpreoptGlobalConfigKey, func() interface{} { if f := ctx.Config().DexpreoptGlobalConfig(); f != "" { ctx.AddNinjaFileDeps(f) - globalConfig, err := dexpreopt.LoadGlobalConfig(f) + globalConfig, err := dexpreopt.LoadGlobalConfig(ctx, f) if err != nil { panic(err) } return globalConfig } - return dexpreopt.GlobalConfig{} + + // No global config filename set, see if there is a test config set + return ctx.Config().Once(dexpreoptTestGlobalConfigKey, func() interface{} { + // Nope, return an empty config + return dexpreopt.GlobalConfig{} + }) }).(dexpreopt.GlobalConfig) } @@ -131,17 +141,15 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo archs = archs[:1] } - var images []string + var images android.Paths for _, arch := range archs { - images = append(images, info.images[arch].String()) + images = append(images, info.images[arch]) } dexLocation := android.InstallPathToOnDevicePath(ctx, d.installPath) strippedDexJarFile := android.PathForModuleOut(ctx, "dexpreopt", dexJarFile.Base()) - deps := android.Paths{dexJarFile} - var profileClassListing android.OptionalPath profileIsTextListing := false if BoolDefault(d.dexpreoptProperties.Dex_preopt.Profile_guided, true) { @@ -157,20 +165,16 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo } } - if profileClassListing.Valid() { - deps = append(deps, profileClassListing.Path()) - } - dexpreoptConfig := dexpreopt.ModuleConfig{ Name: ctx.ModuleName(), DexLocation: dexLocation, - BuildPath: android.PathForModuleOut(ctx, "dexpreopt", ctx.ModuleName()+".jar").String(), - DexPath: dexJarFile.String(), + BuildPath: android.PathForModuleOut(ctx, "dexpreopt", ctx.ModuleName()+".jar").OutputPath, + DexPath: dexJarFile, UncompressedDex: d.uncompressedDex, HasApkLibraries: false, PreoptFlags: nil, - ProfileClassListing: profileClassListing.String(), + ProfileClassListing: profileClassListing, ProfileIsTextListing: profileIsTextListing, EnforceUsesLibraries: false, @@ -181,7 +185,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo Archs: archs, DexPreoptImages: images, - PreoptBootClassPathDexFiles: info.preoptBootDex.Strings(), + PreoptBootClassPathDexFiles: info.preoptBootDex.Paths(), PreoptBootClassPathDexLocations: info.preoptBootLocations, PreoptExtractedApk: false, @@ -190,11 +194,11 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo ForceCreateAppImage: BoolDefault(d.dexpreoptProperties.Dex_preopt.App_image, false), NoStripping: Bool(d.dexpreoptProperties.Dex_preopt.No_stripping), - StripInputPath: dexJarFile.String(), - StripOutputPath: strippedDexJarFile.String(), + StripInputPath: dexJarFile, + StripOutputPath: strippedDexJarFile.OutputPath, } - dexpreoptRule, err := dexpreopt.GenerateDexpreoptRule(info.global, dexpreoptConfig) + dexpreoptRule, err := dexpreopt.GenerateDexpreoptRule(ctx, info.global, dexpreoptConfig) if err != nil { ctx.ModuleErrorf("error generating dexpreopt rule: %s", err.Error()) return dexJarFile |