Loading core/product_config.mk +5 −1 Original line number Diff line number Diff line Loading @@ -200,7 +200,11 @@ ifndef RBC_PRODUCT_CONFIG $(call import-products, $(current_product_makefile)) else rbcscript=build/soong/scripts/rbc-run rc := $(shell $(rbcscript) $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) >$(OUT_DIR)/rbctemp.mk || echo $$?) rc := $(shell $(rbcscript) $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) >$(OUT_DIR)/rbctemp.mk 2>$(OUT_DIR)/rbctemp.stderr || echo $$?) rbcerrors := $(file <(OUT_DIR)/rbctemp.stderr) ifneq (,$(rbcerrors)) $(info $(rbcerrors)) endif ifneq (,$(rc)) $(error product configuration converter failed: $(rc)) endif Loading core/product_config.rbc +2 −2 Original line number Diff line number Diff line Loading @@ -462,11 +462,11 @@ def _mkerror(file, message = ""): def _mkwarning(file, message = ""): """Prints warning.""" print("%s: warning: %s" % (file, message)) rblf_log(file, "warning", message, sep = ':') def _mkinfo(file, message = ""): """Prints info.""" print(message) rblf_log(message) def __mkparse_pattern(pattern): Loading tools/rbcrun/README.md +4 −0 Original line number Diff line number Diff line Loading @@ -87,3 +87,7 @@ Returns *True* if *text* matches *pattern*. Runs `sh -c "`*command*`"`, reads its output, converts all newlines into spaces, chops trailing newline returns this string. This is equivalent to Make's `shell` builtin function. *This function will be eventually removed*. #### rblf_log(*arg*,..., sep=' ') Same as `print` builtin but writes to stderr. No newline at end of file tools/rbcrun/host.go +24 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,28 @@ func structFromEnv(env []string) *starlarkstruct.Struct { return starlarkstruct.FromStringDict(starlarkstruct.Default, sd) } func log(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { sep := " " if err := starlark.UnpackArgs("print", nil, kwargs, "sep?", &sep); err != nil { return nil, err } for i, v := range args { if i > 0 { fmt.Fprint(os.Stderr, sep) } if s, ok := starlark.AsString(v); ok { fmt.Fprint(os.Stderr, s) } else if b, ok := v.(starlark.Bytes); ok { fmt.Fprint(os.Stderr, string(b)) } else { fmt.Fprintf(os.Stderr, "%s", v) } } fmt.Fprintln(os.Stderr) return starlark.None, nil } func setup(env []string) { // Create the symbols that aid makefile conversion. See README.md builtins = starlark.StringDict{ Loading @@ -273,6 +295,8 @@ func setup(env []string) { "rblf_regex": starlark.NewBuiltin("rblf_regex", regexMatch), // To convert makefile's $(shell cmd) "rblf_shell": starlark.NewBuiltin("rblf_shell", shell), // Output to stderr "rblf_log": starlark.NewBuiltin("rblf_log", log), // To convert makefile's $(wildcard foo*) "rblf_wildcard": starlark.NewBuiltin("rblf_wildcard", wildcard), } Loading Loading
core/product_config.mk +5 −1 Original line number Diff line number Diff line Loading @@ -200,7 +200,11 @@ ifndef RBC_PRODUCT_CONFIG $(call import-products, $(current_product_makefile)) else rbcscript=build/soong/scripts/rbc-run rc := $(shell $(rbcscript) $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) >$(OUT_DIR)/rbctemp.mk || echo $$?) rc := $(shell $(rbcscript) $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) >$(OUT_DIR)/rbctemp.mk 2>$(OUT_DIR)/rbctemp.stderr || echo $$?) rbcerrors := $(file <(OUT_DIR)/rbctemp.stderr) ifneq (,$(rbcerrors)) $(info $(rbcerrors)) endif ifneq (,$(rc)) $(error product configuration converter failed: $(rc)) endif Loading
core/product_config.rbc +2 −2 Original line number Diff line number Diff line Loading @@ -462,11 +462,11 @@ def _mkerror(file, message = ""): def _mkwarning(file, message = ""): """Prints warning.""" print("%s: warning: %s" % (file, message)) rblf_log(file, "warning", message, sep = ':') def _mkinfo(file, message = ""): """Prints info.""" print(message) rblf_log(message) def __mkparse_pattern(pattern): Loading
tools/rbcrun/README.md +4 −0 Original line number Diff line number Diff line Loading @@ -87,3 +87,7 @@ Returns *True* if *text* matches *pattern*. Runs `sh -c "`*command*`"`, reads its output, converts all newlines into spaces, chops trailing newline returns this string. This is equivalent to Make's `shell` builtin function. *This function will be eventually removed*. #### rblf_log(*arg*,..., sep=' ') Same as `print` builtin but writes to stderr. No newline at end of file
tools/rbcrun/host.go +24 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,28 @@ func structFromEnv(env []string) *starlarkstruct.Struct { return starlarkstruct.FromStringDict(starlarkstruct.Default, sd) } func log(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { sep := " " if err := starlark.UnpackArgs("print", nil, kwargs, "sep?", &sep); err != nil { return nil, err } for i, v := range args { if i > 0 { fmt.Fprint(os.Stderr, sep) } if s, ok := starlark.AsString(v); ok { fmt.Fprint(os.Stderr, s) } else if b, ok := v.(starlark.Bytes); ok { fmt.Fprint(os.Stderr, string(b)) } else { fmt.Fprintf(os.Stderr, "%s", v) } } fmt.Fprintln(os.Stderr) return starlark.None, nil } func setup(env []string) { // Create the symbols that aid makefile conversion. See README.md builtins = starlark.StringDict{ Loading @@ -273,6 +295,8 @@ func setup(env []string) { "rblf_regex": starlark.NewBuiltin("rblf_regex", regexMatch), // To convert makefile's $(shell cmd) "rblf_shell": starlark.NewBuiltin("rblf_shell", shell), // Output to stderr "rblf_log": starlark.NewBuiltin("rblf_log", log), // To convert makefile's $(wildcard foo*) "rblf_wildcard": starlark.NewBuiltin("rblf_wildcard", wildcard), } Loading