Skip to content

Latest commit

 

History

History
executable file
·
78 lines (47 loc) · 3.82 KB

rules_and_macros_overview.md

File metadata and controls

executable file
·
78 lines (47 loc) · 3.82 KB

Rules and Macros

The rules and macros described below are used to tidy Swift source files.

On this page:

swiftformat_format

swiftformat_format(name, config, output_suffix, srcs, swift_version)

Formats the Swift source files using nicklockwood/SwiftFormat.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
config A swiftformat config file. Label optional None
output_suffix The suffix to add to the output filename. String optional "_formatted"
srcs The Swift source files to format. List of labels required
swift_version The Swift version to be used by swiftformat. You probably want to add this to your config file instead of adding it here. String optional ""

swiftformat_pkg

swiftformat_pkg(name, srcs, config)

Defines targets that will format, test and update the specified Swift sources.

NOTE: Any labels detected in the srcs will be ignored.

PARAMETERS

Name Description Default Value
name The base name for the targets that will be defined. none
srcs Optional. The Swift source files that should be formatted. None
config Optional. The swiftformat YAML configuration file. None

swiftformat_register_prebuilt_toolchains

swiftformat_register_prebuilt_toolchains(name, swiftformat_assets, register_toolchains)

Register and configure the toolchains to download pre-built SwiftFormat binaries.

PARAMETERS

Name Description Default Value
name Optional. The name for the toolchains repository as a string. "swift_tidy_prebuilt_toolchains"
swiftformat_assets Optional. A list of tools to register. If not specified, it uses a recent version of SwiftFormat. None
register_toolchains Optional. A bool that determines whether this function should call register_toolchains(). True