lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.generator.GeneratorCommandFactory Class Reference

A factory class responsible for creating commands for use by the LF code generators. More...

Public Member Functions

LFCommand createCommand (String cmd, List< String > args)
 Create a LFCommand instance from a given command and an argument list.
LFCommand createCommand (String cmd, List< String > args, boolean failOnError)
 Create a LFCommand instance from a given command, an argument list and a directory.
LFCommand createCommand (String cmd, List< String > args, Path dir)
 Create a LFCommand instance from a given command, an argument list and a directory.
LFCommand createCommand (String cmd, List< String > args, Path dir, boolean failOnError)
 Create a LFCommand instance from a given command, an argument list and a directory.
 GeneratorCommandFactory (MessageReporter messageReporter, FileConfig fileConfig)
void setQuiet ()
 enable quiet mode (command output is not printed)
void setVerbose ()
 enable verbose mode (command output is printed)

Protected Attributes

final FileConfig fileConfig
final MessageReporter messageReporter
boolean quiet = false

Detailed Description

A factory class responsible for creating commands for use by the LF code generators.

In addition to the basic functionality of LFCommand, this class additionally ensures that error messages (or optionally warnings) are shown when a command is not found and that certain environment variables are set (see createCommand).

Constructor & Destructor Documentation

◆ GeneratorCommandFactory()

org.lflang.generator.GeneratorCommandFactory.GeneratorCommandFactory ( MessageReporter messageReporter,
FileConfig fileConfig )

Member Function Documentation

◆ createCommand() [1/4]

LFCommand org.lflang.generator.GeneratorCommandFactory.createCommand ( String cmd,
List< String > args )

Create a LFCommand instance from a given command and an argument list.

The command will be executed in the CWD and if the command cannot be found an error message is shown.

Parameters
cmdthe command to look up
argsa list of arguments
Returns
an LFCommand object or null if the command could not be found
See also
createCommand

◆ createCommand() [2/4]

LFCommand org.lflang.generator.GeneratorCommandFactory.createCommand ( String cmd,
List< String > args,
boolean failOnError )

Create a LFCommand instance from a given command, an argument list and a directory.

Parameters
cmdthe command to look up
argsa list of arguments
failOnErrorIf true, an error is shown if the command cannot be found. Otherwise, only a warning is displayed.
Returns
an LFCommand object or null if the command could not be found
See also
createCommand

◆ createCommand() [3/4]

LFCommand org.lflang.generator.GeneratorCommandFactory.createCommand ( String cmd,
List< String > args,
Path dir )

Create a LFCommand instance from a given command, an argument list and a directory.

The command will be executed in the CWD and if the command cannot be found an error message is shown.

Parameters
cmdthe command to look up
argsa list of arguments
dirthe directory to execute the command in. If null, this will default to the CWD
Returns
an LFCommand object or null if the command could not be found
See also
createCommand

◆ createCommand() [4/4]

LFCommand org.lflang.generator.GeneratorCommandFactory.createCommand ( String cmd,
List< String > args,
Path dir,
boolean failOnError )

Create a LFCommand instance from a given command, an argument list and a directory.

This will check first if the command can actually be found and executed. If the command is not found, null is returned. In addition, an error message will be shown if failOnError is true. Otherwise, a warning will be displayed.

Parameters
cmdthe command to look up
argsa list of arguments
dirthe directory to execute the command in. If null, this will default to the CWD
failOnErrorIf true, an error is shown if the command cannot be found. Otherwise, only a warning is displayed.
Returns
an LFCommand object or null if the command could not be found
See also
LFCommand.get

◆ setQuiet()

void org.lflang.generator.GeneratorCommandFactory.setQuiet ( )

enable quiet mode (command output is not printed)

◆ setVerbose()

void org.lflang.generator.GeneratorCommandFactory.setVerbose ( )

enable verbose mode (command output is printed)

Member Data Documentation

◆ fileConfig

final FileConfig org.lflang.generator.GeneratorCommandFactory.fileConfig
protected

◆ messageReporter

final MessageReporter org.lflang.generator.GeneratorCommandFactory.messageReporter
protected

◆ quiet

boolean org.lflang.generator.GeneratorCommandFactory.quiet = false
protected

The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/generator/GeneratorCommandFactory.java