bp2build: codegen singleton lists on one line.
This CL refactors the bp2build code generator to pretty print lists with
a single element on one line, instead of taking up three lines, which
can make BUILD files unnecessarily long. A single line singleton list is
also more commonly used in BUILD files.
Test: TH
Change-Id: Ic9e44741bbb070c8f45925466b9ccdd0608498b2
diff --git a/bp2build/python_binary_conversion_test.go b/bp2build/python_binary_conversion_test.go
index 7600e36..2054e06 100644
--- a/bp2build/python_binary_conversion_test.go
+++ b/bp2build/python_binary_conversion_test.go
@@ -33,24 +33,15 @@
blueprint: `python_binary_host {
name: "foo",
main: "a.py",
- srcs: [
- "**/*.py"
- ],
- exclude_srcs: [
- "b/e.py"
- ],
- data: [
- "files/data.txt",
- ],
-
+ srcs: ["**/*.py"],
+ exclude_srcs: ["b/e.py"],
+ data: ["files/data.txt",],
bazel_module: { bp2build_available: true },
}
`,
expectedBazelTargets: []string{`py_binary(
name = "foo",
- data = [
- "files/data.txt",
- ],
+ data = ["files/data.txt"],
main = "a.py",
srcs = [
"a.py",
@@ -83,9 +74,7 @@
expectedBazelTargets: []string{`py_binary(
name = "foo",
python_version = "PY2",
- srcs = [
- "a.py",
- ],
+ srcs = ["a.py"],
)`,
},
},
@@ -113,9 +102,7 @@
// python_version is PY3 by default.
`py_binary(
name = "foo",
- srcs = [
- "a.py",
- ],
+ srcs = ["a.py"],
)`,
},
},