Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support line continuations in strings #812

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chatura-atapattu
Copy link
Contributor

Strings used in attributes for build rules that contain commands may use line continuations to format the command for readability. Currently, these multiline commands are unwrapped into one line with poor spacing.

Example:

genrule(
    name = "foo",
    srcs = [],
    outs = ["foo.h"],
    cmd = "./$(location create_foo.pl) \
                  > \"$@\"",
    tools = ["create_foo.pl"],
)

becomes

./$(location create_foo.pl) 	> "$@"

genrule(
    name = "foo",
    srcs = [],
    outs = ["foo.h"],
    cmd = "./$(location create_foo.pl)                   > \"$@\"",
    tools = ["create_foo.pl"],
)

We should maintain these line continuations such that if a backslash is followed by a newline, this is not stripped as it currently is.

Copy link
Member

@vladmos vladmos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also add a test for the formatter? build/testdata/060.in would be a good place (in the "correct escape sequence" block). Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants