Merge "Convert add-product-dex-preopt-module-config to Starlark" am: fc74246c98
am: a25eeab5e1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2002770 Change-Id: Id0185496888cc6c7c2903da23abb4ef06cb46fbf
This commit is contained in:
commit
413e73cee1
2 changed files with 50 additions and 43 deletions
|
@ -69,24 +69,25 @@ const (
|
|||
var knownFunctions = map[string]interface {
|
||||
parse(ctx *parseContext, node mkparser.Node, args *mkparser.MakeString) starlarkExpr
|
||||
}{
|
||||
"abspath": &simpleCallParser{name: baseName + ".abspath", returnType: starlarkTypeString, addGlobals: false},
|
||||
"abspath": &simpleCallParser{name: baseName + ".abspath", returnType: starlarkTypeString},
|
||||
"add-product-dex-preopt-module-config": &simpleCallParser{name: baseName + ".add_product_dex_preopt_module_config", returnType: starlarkTypeString, addHandle: true},
|
||||
"add_soong_config_namespace": &simpleCallParser{name: baseName + ".soong_config_namespace", returnType: starlarkTypeVoid, addGlobals: true},
|
||||
"add_soong_config_var_value": &simpleCallParser{name: baseName + ".soong_config_set", returnType: starlarkTypeVoid, addGlobals: true},
|
||||
soongConfigAssign: &simpleCallParser{name: baseName + ".soong_config_set", returnType: starlarkTypeVoid, addGlobals: true},
|
||||
soongConfigAppend: &simpleCallParser{name: baseName + ".soong_config_append", returnType: starlarkTypeVoid, addGlobals: true},
|
||||
"soong_config_get": &simpleCallParser{name: baseName + ".soong_config_get", returnType: starlarkTypeString, addGlobals: true},
|
||||
"add-to-product-copy-files-if-exists": &simpleCallParser{name: baseName + ".copy_if_exists", returnType: starlarkTypeList, addGlobals: false},
|
||||
"addprefix": &simpleCallParser{name: baseName + ".addprefix", returnType: starlarkTypeList, addGlobals: false},
|
||||
"addsuffix": &simpleCallParser{name: baseName + ".addsuffix", returnType: starlarkTypeList, addGlobals: false},
|
||||
"copy-files": &simpleCallParser{name: baseName + ".copy_files", returnType: starlarkTypeList, addGlobals: false},
|
||||
"dir": &simpleCallParser{name: baseName + ".dir", returnType: starlarkTypeList, addGlobals: false},
|
||||
"add-to-product-copy-files-if-exists": &simpleCallParser{name: baseName + ".copy_if_exists", returnType: starlarkTypeList},
|
||||
"addprefix": &simpleCallParser{name: baseName + ".addprefix", returnType: starlarkTypeList},
|
||||
"addsuffix": &simpleCallParser{name: baseName + ".addsuffix", returnType: starlarkTypeList},
|
||||
"copy-files": &simpleCallParser{name: baseName + ".copy_files", returnType: starlarkTypeList},
|
||||
"dir": &simpleCallParser{name: baseName + ".dir", returnType: starlarkTypeList},
|
||||
"dist-for-goals": &simpleCallParser{name: baseName + ".mkdist_for_goals", returnType: starlarkTypeVoid, addGlobals: true},
|
||||
"enforce-product-packages-exist": &simpleCallParser{name: baseName + ".enforce_product_packages_exist", returnType: starlarkTypeVoid, addGlobals: false},
|
||||
"enforce-product-packages-exist": &simpleCallParser{name: baseName + ".enforce_product_packages_exist", returnType: starlarkTypeVoid},
|
||||
"error": &makeControlFuncParser{name: baseName + ".mkerror"},
|
||||
"findstring": &simpleCallParser{name: baseName + ".findstring", returnType: starlarkTypeInt, addGlobals: false},
|
||||
"find-copy-subdir-files": &simpleCallParser{name: baseName + ".find_and_copy", returnType: starlarkTypeList, addGlobals: false},
|
||||
"filter": &simpleCallParser{name: baseName + ".filter", returnType: starlarkTypeList, addGlobals: false},
|
||||
"filter-out": &simpleCallParser{name: baseName + ".filter_out", returnType: starlarkTypeList, addGlobals: false},
|
||||
"findstring": &simpleCallParser{name: baseName + ".findstring", returnType: starlarkTypeInt},
|
||||
"find-copy-subdir-files": &simpleCallParser{name: baseName + ".find_and_copy", returnType: starlarkTypeList},
|
||||
"filter": &simpleCallParser{name: baseName + ".filter", returnType: starlarkTypeList},
|
||||
"filter-out": &simpleCallParser{name: baseName + ".filter_out", returnType: starlarkTypeList},
|
||||
"firstword": &firstOrLastwordCallParser{isLastWord: false},
|
||||
"foreach": &foreachCallPaser{},
|
||||
"if": &ifCallParser{},
|
||||
|
@ -99,7 +100,7 @@ var knownFunctions = map[string]interface {
|
|||
"is-vendor-board-platform": &isVendorBoardPlatformCallParser{},
|
||||
"is-vendor-board-qcom": &isVendorBoardQcomCallParser{},
|
||||
"lastword": &firstOrLastwordCallParser{isLastWord: true},
|
||||
"notdir": &simpleCallParser{name: baseName + ".notdir", returnType: starlarkTypeString, addGlobals: false},
|
||||
"notdir": &simpleCallParser{name: baseName + ".notdir", returnType: starlarkTypeString},
|
||||
"math_max": &mathMaxOrMinCallParser{function: "max"},
|
||||
"math_min": &mathMaxOrMinCallParser{function: "min"},
|
||||
"math_gt_or_eq": &mathComparisonCallParser{op: ">="},
|
||||
|
@ -107,16 +108,16 @@ var knownFunctions = map[string]interface {
|
|||
"math_lt": &mathComparisonCallParser{op: "<"},
|
||||
"my-dir": &myDirCallParser{},
|
||||
"patsubst": &substCallParser{fname: "patsubst"},
|
||||
"product-copy-files-by-pattern": &simpleCallParser{name: baseName + ".product_copy_files_by_pattern", returnType: starlarkTypeList, addGlobals: false},
|
||||
"require-artifacts-in-path": &simpleCallParser{name: baseName + ".require_artifacts_in_path", returnType: starlarkTypeVoid, addGlobals: false},
|
||||
"require-artifacts-in-path-relaxed": &simpleCallParser{name: baseName + ".require_artifacts_in_path_relaxed", returnType: starlarkTypeVoid, addGlobals: false},
|
||||
"product-copy-files-by-pattern": &simpleCallParser{name: baseName + ".product_copy_files_by_pattern", returnType: starlarkTypeList},
|
||||
"require-artifacts-in-path": &simpleCallParser{name: baseName + ".require_artifacts_in_path", returnType: starlarkTypeVoid},
|
||||
"require-artifacts-in-path-relaxed": &simpleCallParser{name: baseName + ".require_artifacts_in_path_relaxed", returnType: starlarkTypeVoid},
|
||||
// TODO(asmundak): remove it once all calls are removed from configuration makefiles. see b/183161002
|
||||
"shell": &shellCallParser{},
|
||||
"strip": &simpleCallParser{name: baseName + ".mkstrip", returnType: starlarkTypeString, addGlobals: false},
|
||||
"strip": &simpleCallParser{name: baseName + ".mkstrip", returnType: starlarkTypeString},
|
||||
"subst": &substCallParser{fname: "subst"},
|
||||
"warning": &makeControlFuncParser{name: baseName + ".mkwarning"},
|
||||
"word": &wordCallParser{},
|
||||
"wildcard": &simpleCallParser{name: baseName + ".expand_wildcard", returnType: starlarkTypeList, addGlobals: false},
|
||||
"wildcard": &simpleCallParser{name: baseName + ".expand_wildcard", returnType: starlarkTypeList},
|
||||
}
|
||||
|
||||
// These are functions that we don't implement conversions for, but
|
||||
|
@ -1310,6 +1311,7 @@ type simpleCallParser struct {
|
|||
name string
|
||||
returnType starlarkType
|
||||
addGlobals bool
|
||||
addHandle bool
|
||||
}
|
||||
|
||||
func (p *simpleCallParser) parse(ctx *parseContext, node mkparser.Node, args *mkparser.MakeString) starlarkExpr {
|
||||
|
@ -1317,6 +1319,9 @@ func (p *simpleCallParser) parse(ctx *parseContext, node mkparser.Node, args *mk
|
|||
if p.addGlobals {
|
||||
expr.args = append(expr.args, &globalsExpr{})
|
||||
}
|
||||
if p.addHandle {
|
||||
expr.args = append(expr.args, &identifierExpr{name: "handle"})
|
||||
}
|
||||
for _, arg := range args.Split(",") {
|
||||
arg.TrimLeftSpaces()
|
||||
arg.TrimRightSpaces()
|
||||
|
|
|
@ -739,6 +739,7 @@ $(call enforce-product-packages-exist, foo)
|
|||
$(call require-artifacts-in-path, foo, bar)
|
||||
$(call require-artifacts-in-path-relaxed, foo, bar)
|
||||
$(call dist-for-goals, goal, from:to)
|
||||
$(call add-product-dex-preopt-module-config,MyModule,disable)
|
||||
`,
|
||||
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
||||
|
||||
|
@ -749,6 +750,7 @@ def init(g, handle):
|
|||
rblf.require_artifacts_in_path("foo", "bar")
|
||||
rblf.require_artifacts_in_path_relaxed("foo", "bar")
|
||||
rblf.mkdist_for_goals(g, "goal", "from:to")
|
||||
rblf.add_product_dex_preopt_module_config(handle, "MyModule", "disable")
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue