prebuildCommand(displayName:executable:arguments:environment:outputFilesDirectory:)

Returns a command that runs unconditionally before every build.

Command.swift:206

This declaration was deprecated in SwiftPM 6.0: Use `URL` type instead of `Path`.

static func prebuildCommand(displayName: String?, executable: Path, arguments: [CustomStringConvertible], environment: [String : CustomStringConvertible] = [:], outputFilesDirectory: Path) -> Command

Parameters

displayName

An optional string to show in build logs and other status areas.

executable

The absolute path to the executable to be invoked.

arguments

Command-line arguments to be passed to the executable.

environment

Environment variable assignments visible to the executable.

workingDirectory

Optional initial working directory when the executable runs.

outputFilesDirectory

A directory into which the command writes its output files. Any files there recognizable by their extension as source files (e.g. .swift) are compiled into the target for which this command was generated as if in its source directory; other files are treated as resources as if explicitly listed in Package.swift using .process(...).

Prebuild commands can have a significant performance impact and should only be used when there would be no way to know the list of output file paths without first reading the contents of one or more input files. Typically there is no way to determine this list without first running the command, so instead of encoding that list, the caller supplies an outputFilesDirectory parameter, and all files in that directory after the command runs are treated as output files.