CompilationCommand

constructor(directory: EnvPath, file: EnvPath, arguments: ParsedArgs, output: EnvPath? = null)

Throws

if file is blank, or arguments are empty.


constructor(directory: EnvPath, file: EnvPath, command: RawCommandLine, output: EnvPath? = null)

Throws

if either file or command is blank.


constructor(directory: EnvPath, file: EnvPath, arguments: ParsedArgs, command: RawCommandLine? = null, output: EnvPath? = null)

Parameters

directory

the working directory of the compilation. All paths specified in the command or file fields must be either absolute or relative to this directory.

file

the main translation unit source processed by this compilation step. This is used by tools as the key into the compilation database. There can be multiple command objects for the same file, for example if the same source file is compiled with different configurations.

command

the compile command executed. After JSON unescaping, this must be a valid command to rerun the exact compilation step for the translation unit in the environment the build system uses. Parameters use shell quoting and shell escaping of quotes, with " and \ being the only special characters. Shell expansion is not supported.

arguments

the compile command argv as list of strings. This should run the compilation step for the translation unit file. arguments[0] should be the executable name, such as clang++. Arguments should not be escaped, but ready to pass to execvp().

output

the name of the output created by this compilation step. This field is optional. It can be used to distinguish different processing modes of the same input file.