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
This commit is contained in:
@@ -33,24 +33,15 @@ func TestPythonBinaryHost(t *testing.T) {
|
||||
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 @@ func TestPythonBinaryHost(t *testing.T) {
|
||||
expectedBazelTargets: []string{`py_binary(
|
||||
name = "foo",
|
||||
python_version = "PY2",
|
||||
srcs = [
|
||||
"a.py",
|
||||
],
|
||||
srcs = ["a.py"],
|
||||
)`,
|
||||
},
|
||||
},
|
||||
@@ -113,9 +102,7 @@ func TestPythonBinaryHost(t *testing.T) {
|
||||
// python_version is PY3 by default.
|
||||
`py_binary(
|
||||
name = "foo",
|
||||
srcs = [
|
||||
"a.py",
|
||||
],
|
||||
srcs = ["a.py"],
|
||||
)`,
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user