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
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user