Skip to content

Commit 04fb76e

Browse files
oreflowbrandjonTim Malmström
authored
Add Starlarkified Python attributes to generate_tables.go (#1365)
* Add Starlarkified Python attributes to generate_tables.go This ensures backwards compatibility in the CLI for attributes like "main" and "python_version". Otherwise, they require quoting, when building buildozer against newer versions of Bazel. * Updating tables.gen.go to match new type definitions from generate_tables.go --------- Co-authored-by: Jon Brandvein <[email protected]> Co-authored-by: Tim Malmström <[email protected]>
1 parent b02f80d commit 04fb76e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

generatetables/generate_tables.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,24 @@ func generateTable(rules []*buildpb.RuleDefinition) map[string]buildpb.Attribute
8686
types["package_metadata"] = buildpb.Attribute_LABEL_LIST
8787
}
8888

89+
// The following attributes used to exist in the native Python rules but were removed
90+
// during Starlarkification. Add them here for backwards compatibility, at least for now.
91+
types["api_version"] = buildpb.Attribute_INTEGER
92+
types["bootstrap_template"] = buildpb.Attribute_LABEL
93+
types["buildpar"] = buildpb.Attribute_BOOLEAN
94+
types["coverage_tool"] = buildpb.Attribute_LABEL
95+
types["files"] = buildpb.Attribute_LABEL_LIST
96+
types["has_services"] = buildpb.Attribute_BOOLEAN
97+
types["interpreter"] = buildpb.Attribute_LABEL
98+
types["interpreter_path"] = buildpb.Attribute_STRING
99+
types["launcher"] = buildpb.Attribute_LABEL
100+
types["launcher_uses_whole_archive"] = buildpb.Attribute_BOOLEAN
101+
types["main"] = buildpb.Attribute_LABEL
102+
types["paropts"] = buildpb.Attribute_STRING_LIST
103+
types["python_version"] = buildpb.Attribute_STRING
104+
types["srcs_version"] = buildpb.Attribute_STRING
105+
types["stub_shebang"] = buildpb.Attribute_STRING
106+
89107
return types
90108
}
91109

lang/tables.gen.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ var TypeOf = map[string]buildpb.Attribute_Discriminator{
133133
"android_jar": buildpb.Attribute_LABEL,
134134
"annotations_jar": buildpb.Attribute_LABEL,
135135
"api_level": buildpb.Attribute_INTEGER,
136+
"api_version": buildpb.Attribute_INTEGER,
136137
"apkbuilder": buildpb.Attribute_LABEL,
137138
"apksigner": buildpb.Attribute_LABEL,
138139
"applicable_licenses": buildpb.Attribute_LABEL_LIST,
@@ -147,10 +148,12 @@ var TypeOf = map[string]buildpb.Attribute_Discriminator{
147148
"binary_type": buildpb.Attribute_STRING,
148149
"blacklisted_protos": buildpb.Attribute_LABEL_LIST,
149150
"bootclasspath": buildpb.Attribute_LABEL_LIST,
151+
"bootstrap_template": buildpb.Attribute_LABEL,
150152
"build_file": buildpb.Attribute_STRING,
151153
"build_file_content": buildpb.Attribute_STRING,
152154
"build_setting_default": buildpb.Attribute_LABEL,
153155
"build_tools_version": buildpb.Attribute_STRING,
156+
"buildpar": buildpb.Attribute_BOOLEAN,
154157
"bundle_loader": buildpb.Attribute_LABEL,
155158
"cache": buildpb.Attribute_INTEGER,
156159
"classpath_resources": buildpb.Attribute_LABEL_LIST,
@@ -169,6 +172,7 @@ var TypeOf = map[string]buildpb.Attribute_Discriminator{
169172
"constraints": buildpb.Attribute_STRING_LIST,
170173
"copts": buildpb.Attribute_STRING_LIST,
171174
"coverage_files": buildpb.Attribute_LABEL,
175+
"coverage_tool": buildpb.Attribute_LABEL,
172176
"cpu": buildpb.Attribute_STRING,
173177
"cpu_constraints": buildpb.Attribute_LABEL_LIST,
174178
"create_executable": buildpb.Attribute_BOOLEAN,
@@ -239,6 +243,7 @@ var TypeOf = map[string]buildpb.Attribute_Discriminator{
239243
"generator_function": buildpb.Attribute_STRING,
240244
"generator_location": buildpb.Attribute_STRING,
241245
"generator_name": buildpb.Attribute_STRING,
246+
"has_services": buildpb.Attribute_BOOLEAN,
242247
"hdrs": buildpb.Attribute_LABEL_LIST,
243248
"header_compiler": buildpb.Attribute_LABEL_LIST,
244249
"header_compiler_builtin_processors": buildpb.Attribute_STRING_LIST,
@@ -275,6 +280,7 @@ var TypeOf = map[string]buildpb.Attribute_Discriminator{
275280
"jvm_flags": buildpb.Attribute_STRING_LIST,
276281
"jvm_opts": buildpb.Attribute_STRING_LIST,
277282
"launcher": buildpb.Attribute_LABEL,
283+
"launcher_uses_whole_archive": buildpb.Attribute_BOOLEAN,
278284
"legacy_create_init": buildpb.Attribute_TRISTATE,
279285
"libc_top": buildpb.Attribute_LABEL,
280286
"licenses": buildpb.Attribute_LICENSE,
@@ -329,6 +335,7 @@ var TypeOf = map[string]buildpb.Attribute_Discriminator{
329335
"package_metadata": buildpb.Attribute_LABEL_LIST,
330336
"packages": buildpb.Attribute_LABEL_LIST,
331337
"parents": buildpb.Attribute_LABEL_LIST,
338+
"paropts": buildpb.Attribute_STRING_LIST,
332339
"path": buildpb.Attribute_STRING,
333340
"pch": buildpb.Attribute_LABEL,
334341
"platform_apks": buildpb.Attribute_LABEL_LIST,
@@ -392,6 +399,7 @@ var TypeOf = map[string]buildpb.Attribute_Discriminator{
392399
"strip_files": buildpb.Attribute_LABEL,
393400
"strip_import_prefix": buildpb.Attribute_STRING,
394401
"strip_include_prefix": buildpb.Attribute_STRING,
402+
"stub_shebang": buildpb.Attribute_STRING,
395403
"support_apks": buildpb.Attribute_LABEL_LIST,
396404
"supports_header_parsing": buildpb.Attribute_BOOLEAN,
397405
"supports_param_files": buildpb.Attribute_BOOLEAN,

0 commit comments

Comments
 (0)