public class BuckFixSpecParser extends Object
BuildLogEntry
Modifier and Type | Class and Description |
---|---|
static class |
BuckFixSpecParser.FixSpecFailure
The various ways that trying to parse a FixSpec can fail
|
Constructor and Description |
---|
BuckFixSpecParser() |
Modifier and Type | Method and Description |
---|---|
static Either<BuckFixSpec,BuckFixSpecParser.FixSpecFailure> |
parseFromBuildId(BuildLogHelper helper,
FixBuckConfig fixConfig,
BuildId buildId,
boolean manuallyInvoked)
Tries to construct a
BuckFixSpec from a specific invocation of buck |
static Either<BuckFixSpec,BuckFixSpecParser.FixSpecFailure> |
parseFromBuildIdWithExitCode(BuildLogHelper helper,
FixBuckConfig fixConfig,
BuildId buildId,
ExitCode exitCode,
boolean manuallyInvoked,
Optional<Exception> runException)
Tries to construct a
BuckFixSpec from a specific
invocation of buck |
static Either<BuckFixSpec,BuckFixSpecParser.FixSpecFailure> |
parseFromFixSpecFile(Path fixSpecPath)
Tries to parse a
BuckFixSpec from a file already with the information of a fix spec. |
static Either<BuckFixSpec,BuckFixSpecParser.FixSpecFailure> |
parseLastCommand(BuildLogHelper helper,
FixBuckConfig fixConfig,
boolean manuallyInvoked)
Tries to construct a
BuckFixSpec from the newest invocation of buck |
public static Either<BuckFixSpec,BuckFixSpecParser.FixSpecFailure> parseLastCommand(BuildLogHelper helper, FixBuckConfig fixConfig, boolean manuallyInvoked) throws IOException
BuckFixSpec
from the newest invocation of buck
This excludes commands like fix, server, doctor, etc (see BuildLogHelper
), and will
not return a spec if required fields were not able to be found in the logs (e.g. if exitCode is
missing, a useful spec will not be able to be constructed)
helper
- The helper used to find all build logsfixConfig
- The configuration for this invocation of fixmanuallyInvoked
- Whether or not this spec will be used in a command that was manually
invokedBuckFixSpec
constructed from the build logs or an error if one could not be
found or constructedIOException
- There was a problem reading the logs on diskpublic static Either<BuckFixSpec,BuckFixSpecParser.FixSpecFailure> parseFromBuildId(BuildLogHelper helper, FixBuckConfig fixConfig, BuildId buildId, boolean manuallyInvoked) throws IOException
BuckFixSpec
from a specific invocation of buck
A spec will not be returned if the log could not be found, or if required fields were not able to be found in the logs (e.g. if exitCode is missing, a useful spec will not be able to be constructed)
helper
- The helper used to find all build logsfixConfig
- The configuration for this invocation of fixbuildId
- The build id to look formanuallyInvoked
- Whether or not this spec will be used in a command that was manually
invokedBuckFixSpec
constructed from the build logs or an error if one could not be
found or constructedIOException
- There was a problem reading the logs on diskpublic static Either<BuckFixSpec,BuckFixSpecParser.FixSpecFailure> parseFromBuildIdWithExitCode(BuildLogHelper helper, FixBuckConfig fixConfig, BuildId buildId, ExitCode exitCode, boolean manuallyInvoked, Optional<Exception> runException) throws IOException
BuckFixSpec
from a specific
invocation of buck
A spec will not be returned if the log could not be found, or if required fields were not able to be found in the logs (e.g. if command args are missing, a useful spec will not be able to be constructed)
Exit code is passed in, as there may not be enough information in the log yet (if this is called before the command has terminated) to otherwise construct a valid spec
helper
- The helper used to find all build logsfixConfig
- The configuration for this invocation of fixbuildId
- The build id to look forexitCode
- The exit code for the commandmanuallyInvoked
- Whether or not this spec will be used in a command that was manually
invokedBuckFixSpec
constructed from the build logsIOException
- There was a problem reading the logs on diskpublic static Either<BuckFixSpec,BuckFixSpecParser.FixSpecFailure> parseFromFixSpecFile(Path fixSpecPath) throws IOException
BuckFixSpec
from a file already with the information of a fix spec.
This differs from other parse... methods in that it doesn't try to construct a fix spec from
various different log files, only from a single spec file.fixSpecPath
- the absolute path to the fix spec fileBuckFixSpec
or a Failure if the spec file is missing in the given pathIOException
- for any other error in the process of reading the file