1- load ("@bazel_skylib//lib:paths.bzl" , "paths" )
1+ """A build rule that formats Swift source files. """
2+
23load (
34 "@cgrindel_bazel_starlib//updatesrc:defs.bzl" ,
45 "UpdateSrcsInfo" ,
56 "update_srcs" ,
67)
78
8- """A build rule that formats Swift source files.
9- """
10-
119def _swiftformat_format_impl (ctx ):
1210 updsrcs = []
1311 for src in ctx .files .srcs :
@@ -48,6 +46,15 @@ def _swiftformat_format_impl(ctx):
4846swiftformat_format = rule (
4947 implementation = _swiftformat_format_impl ,
5048 attrs = {
49+ "config" : attr .label (
50+ allow_single_file = True ,
51+ doc = "A swiftformat config file." ,
52+ default = "@//:.swiftformat" ,
53+ ),
54+ "output_suffix" : attr .string (
55+ default = "_formatted" ,
56+ doc = "The suffix to add to the output filename." ,
57+ ),
5158 "srcs" : attr .label_list (
5259 allow_files = True ,
5360 mandatory = True ,
@@ -59,15 +66,6 @@ The Swift version to be used by `swiftformat`. You probably want to add this \
5966 to your config file instead of adding it here.\
6067 """ ,
6168 ),
62- "config" : attr .label (
63- allow_single_file = True ,
64- doc = "A swiftformat config file." ,
65- default = "@//:.swiftformat" ,
66- ),
67- "output_suffix" : attr .string (
68- default = "_formatted" ,
69- doc = "The suffix to add to the output filename." ,
70- ),
7169 "_swiftformat" : attr .label (
7270 default = "@swiftformat_repos//SwiftFormat:swiftformat" ,
7371 executable = True ,
0 commit comments