diff options
author | Colin Cross <ccross@android.com> | 2017-11-28 17:34:01 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-11-29 05:04:30 +0000 |
commit | 0875c52de753b858b74a9ac285626536bee9cb57 (patch) | |
tree | f103285f38b0fab1b498eadc0d6ef2a42671e7a5 /android/api_levels.go | |
parent | f2a56f0e0d1394f19c9c9bd31d700d3ff9b198fb (diff) |
Wrap PackageContext and SingletonContext
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}. The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.
SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does. This requires
updating every Singleton to use the android-specific methods.
Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
Diffstat (limited to 'android/api_levels.go')
-rw-r--r-- | android/api_levels.go | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/android/api_levels.go b/android/api_levels.go index 2c4ae1a07..bdfbc43c8 100644 --- a/android/api_levels.go +++ b/android/api_levels.go @@ -16,22 +16,19 @@ package android import ( "encoding/json" - "path/filepath" - - "github.com/google/blueprint" ) func init() { RegisterSingletonType("api_levels", ApiLevelsSingleton) } -func ApiLevelsSingleton() blueprint.Singleton { +func ApiLevelsSingleton() Singleton { return &apiLevelsSingleton{} } type apiLevelsSingleton struct{} -func createApiLevelsJson(ctx blueprint.SingletonContext, file string, +func createApiLevelsJson(ctx SingletonContext, file WritablePath, apiLevelsMap map[string]int) { jsonStr, err := json.Marshal(apiLevelsMap) @@ -39,21 +36,21 @@ func createApiLevelsJson(ctx blueprint.SingletonContext, file string, ctx.Errorf(err.Error()) } - ctx.Build(pctx, blueprint.BuildParams{ + ctx.Build(pctx, BuildParams{ Rule: WriteFile, - Description: "generate " + filepath.Base(file), - Outputs: []string{file}, + Description: "generate " + file.Base(), + Output: file, Args: map[string]string{ "content": string(jsonStr[:]), }, }) } -func GetApiLevelsJson(ctx PathContext) Path { +func GetApiLevelsJson(ctx PathContext) WritablePath { return PathForOutput(ctx, "api_levels.json") } -func (a *apiLevelsSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) { +func (a *apiLevelsSingleton) GenerateBuildActions(ctx SingletonContext) { baseApiLevel := 9000 apiLevelsMap := map[string]int{ "G": 9, @@ -74,5 +71,5 @@ func (a *apiLevelsSingleton) GenerateBuildActions(ctx blueprint.SingletonContext } apiLevelsJson := GetApiLevelsJson(ctx) - createApiLevelsJson(ctx, apiLevelsJson.String(), apiLevelsMap) + createApiLevelsJson(ctx, apiLevelsJson, apiLevelsMap) } |