diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2d919a47f..bbf86f0d5 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -12,4 +12,5 @@ Paul Bethe Russ Cox Laurent Le Brun Justine Alexandra Roberts Tunney -Nilton Volpato \ No newline at end of file +Nilton Volpato +Matthew C Brown diff --git a/buildozer/buildozer_test.sh b/buildozer/buildozer_test.sh index 44695eb80..20cb08585 100755 --- a/buildozer/buildozer_test.sh +++ b/buildozer/buildozer_test.sh @@ -1384,7 +1384,15 @@ function test_rule_print_comment() { in='# Hello cc_library(name = "a")' run "$in" 'print_comment' //pkg:a - assert_output 'Hello' + assert_output 'Hello ' +} + +function test_rule_print_comment_with_suffix_and_after() { + in='# Hello Before +cc_library(name = "a") # Hello Suffix +# Hello After' + run "$in" 'print_comment' //pkg:a + assert_output 'Hello Before Hello Suffix Hello After' } function test_attribute_print_comment() { diff --git a/edit/buildozer.go b/edit/buildozer.go index e2dac0655..b502e1df3 100644 --- a/edit/buildozer.go +++ b/edit/buildozer.go @@ -158,6 +158,8 @@ func cmdPrintComment(opts *Options, env CmdEnvironment) (*build.File, error) { case 0: // Print rule comment. env.output.Fields = []*apipb.Output_Record_Field{ {Value: &apipb.Output_Record_Field_Text{commentsText(env.Rule.Call.Comments.Before)}}, + {Value: &apipb.Output_Record_Field_Text{commentsText(env.Rule.Call.Comments.Suffix)}}, + {Value: &apipb.Output_Record_Field_Text{commentsText(env.Rule.Call.Comments.After)}}, } case 1: // Print attribute comment. attr := env.Rule.AttrDefn(env.Args[0])