Merge changes Ia41a5a2e,Ib29654e7 am: 45f97c6a1e
am: 63861ddea8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1883569 Change-Id: I99af4477e2f270b4762253bb6818a30733c76776
This commit is contained in:
@@ -1388,11 +1388,14 @@ func (ctx *parseContext) parseSubstFunc(node mkparser.Node, fname string, args *
|
|||||||
if len(words) != 3 {
|
if len(words) != 3 {
|
||||||
return ctx.newBadExpr(node, "%s function should have 3 arguments", fname)
|
return ctx.newBadExpr(node, "%s function should have 3 arguments", fname)
|
||||||
}
|
}
|
||||||
if !words[0].Const() || !words[1].Const() {
|
from := ctx.parseMakeString(node, words[0])
|
||||||
return ctx.newBadExpr(node, "%s function's from and to arguments should be constant", fname)
|
if xBad, ok := from.(*badExpr); ok {
|
||||||
|
return xBad
|
||||||
|
}
|
||||||
|
to := ctx.parseMakeString(node, words[1])
|
||||||
|
if xBad, ok := to.(*badExpr); ok {
|
||||||
|
return xBad
|
||||||
}
|
}
|
||||||
from := words[0].Strings[0]
|
|
||||||
to := words[1].Strings[0]
|
|
||||||
words[2].TrimLeftSpaces()
|
words[2].TrimLeftSpaces()
|
||||||
words[2].TrimRightSpaces()
|
words[2].TrimRightSpaces()
|
||||||
obj := ctx.parseMakeString(node, words[2])
|
obj := ctx.parseMakeString(node, words[2])
|
||||||
@@ -1402,13 +1405,13 @@ func (ctx *parseContext) parseSubstFunc(node mkparser.Node, fname string, args *
|
|||||||
return &callExpr{
|
return &callExpr{
|
||||||
object: obj,
|
object: obj,
|
||||||
name: "replace",
|
name: "replace",
|
||||||
args: []starlarkExpr{&stringLiteralExpr{from}, &stringLiteralExpr{to}},
|
args: []starlarkExpr{from, to},
|
||||||
returnType: typ,
|
returnType: typ,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &callExpr{
|
return &callExpr{
|
||||||
name: fname,
|
name: fname,
|
||||||
args: []starlarkExpr{&stringLiteralExpr{from}, &stringLiteralExpr{to}, obj},
|
args: []starlarkExpr{from, to, obj},
|
||||||
returnType: obj.typ(),
|
returnType: obj.typ(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -226,6 +226,9 @@ ifdef PRODUCT_NAME
|
|||||||
PRODUCT_NAME = gizmo
|
PRODUCT_NAME = gizmo
|
||||||
else
|
else
|
||||||
endif
|
endif
|
||||||
|
local_var :=
|
||||||
|
ifdef local_var
|
||||||
|
endif
|
||||||
`,
|
`,
|
||||||
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
||||||
|
|
||||||
@@ -235,6 +238,9 @@ def init(g, handle):
|
|||||||
cfg["PRODUCT_NAME"] = "gizmo"
|
cfg["PRODUCT_NAME"] = "gizmo"
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
_local_var = ""
|
||||||
|
if _local_var:
|
||||||
|
pass
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -691,7 +697,7 @@ def init(g, handle):
|
|||||||
PRODUCT_COPY_FILES := $(addprefix pfx-,a b c)
|
PRODUCT_COPY_FILES := $(addprefix pfx-,a b c)
|
||||||
PRODUCT_COPY_FILES := $(addsuffix .sff, a b c)
|
PRODUCT_COPY_FILES := $(addsuffix .sff, a b c)
|
||||||
PRODUCT_NAME := $(word 1, $(subst ., ,$(TARGET_BOARD_PLATFORM)))
|
PRODUCT_NAME := $(word 1, $(subst ., ,$(TARGET_BOARD_PLATFORM)))
|
||||||
$(info $(patsubst %.pub,%,$(PRODUCT_ADB_KEYS)))
|
$(info $(patsubst %.pub,$(PRODUCT_NAME)%,$(PRODUCT_ADB_KEYS)))
|
||||||
$(info $(dir foo/bar))
|
$(info $(dir foo/bar))
|
||||||
$(info $(firstword $(PRODUCT_COPY_FILES)))
|
$(info $(firstword $(PRODUCT_COPY_FILES)))
|
||||||
$(info $(lastword $(PRODUCT_COPY_FILES)))
|
$(info $(lastword $(PRODUCT_COPY_FILES)))
|
||||||
@@ -714,7 +720,7 @@ def init(g, handle):
|
|||||||
cfg["PRODUCT_COPY_FILES"] = rblf.addprefix("pfx-", "a b c")
|
cfg["PRODUCT_COPY_FILES"] = rblf.addprefix("pfx-", "a b c")
|
||||||
cfg["PRODUCT_COPY_FILES"] = rblf.addsuffix(".sff", "a b c")
|
cfg["PRODUCT_COPY_FILES"] = rblf.addsuffix(".sff", "a b c")
|
||||||
cfg["PRODUCT_NAME"] = ((g.get("TARGET_BOARD_PLATFORM", "")).replace(".", " ")).split()[0]
|
cfg["PRODUCT_NAME"] = ((g.get("TARGET_BOARD_PLATFORM", "")).replace(".", " ")).split()[0]
|
||||||
rblf.mkinfo("product.mk", rblf.mkpatsubst("%.pub", "%", g.get("PRODUCT_ADB_KEYS", "")))
|
rblf.mkinfo("product.mk", rblf.mkpatsubst("%.pub", "%s%%" % cfg["PRODUCT_NAME"], g.get("PRODUCT_ADB_KEYS", "")))
|
||||||
rblf.mkinfo("product.mk", rblf.dir("foo/bar"))
|
rblf.mkinfo("product.mk", rblf.dir("foo/bar"))
|
||||||
rblf.mkinfo("product.mk", cfg["PRODUCT_COPY_FILES"][0])
|
rblf.mkinfo("product.mk", cfg["PRODUCT_COPY_FILES"][0])
|
||||||
rblf.mkinfo("product.mk", cfg["PRODUCT_COPY_FILES"][-1])
|
rblf.mkinfo("product.mk", cfg["PRODUCT_COPY_FILES"][-1])
|
||||||
|
@@ -177,8 +177,8 @@ type localVariable struct {
|
|||||||
baseVariable
|
baseVariable
|
||||||
}
|
}
|
||||||
|
|
||||||
func (lv localVariable) emitDefined(_ *generationContext) {
|
func (lv localVariable) emitDefined(gctx *generationContext) {
|
||||||
panic("implement me")
|
gctx.writef(lv.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (lv localVariable) String() string {
|
func (lv localVariable) String() string {
|
||||||
|
Reference in New Issue
Block a user