public abstract class VersionedTool extends Object implements Tool, HasCustomInputsLogic
Tool
which only contributes a fixed name and version when appended to a rule key. This
class also holds a Path
reference to the tool and additional flags used when invoking the
tool, which do *not* themselves contribute to the rule key. This is useful in situations such as
supporting cross-compilation, in which case the different tools themselves might not be
bit-by-bit identical (and, similarly, they might need to invoked with slightly different flags)
but we know that they produce identical output, in which case they should also generate identical
rule keys.Constructor and Description |
---|
VersionedTool() |
Modifier and Type | Method and Description |
---|---|
<E extends Exception> |
computeInputs(ThrowingConsumer<SourcePath,E> consumer) |
com.google.common.collect.ImmutableList<String> |
getCommandPrefix(SourcePathResolverAdapter resolver) |
com.google.common.collect.ImmutableMap<String,String> |
getEnvironment(SourcePathResolverAdapter resolver) |
abstract com.google.common.collect.ImmutableList<String> |
getExtraArgs()
Additional flags that we pass to the tool, but which do *not* contribute to the rule key.
|
abstract String |
getName() |
abstract PathSourcePath |
getPath()
The path to the tool.
|
abstract String |
getVersion() |
static VersionedTool |
of(String name,
PathSourcePath path,
String version) |
static VersionedTool |
of(String name,
PathSourcePath path,
String version,
com.google.common.collect.ImmutableList<String> extraArgs) |
public abstract String getName()
public abstract PathSourcePath getPath()
public abstract String getVersion()
public abstract com.google.common.collect.ImmutableList<String> getExtraArgs()
public com.google.common.collect.ImmutableList<String> getCommandPrefix(SourcePathResolverAdapter resolver)
getCommandPrefix
in interface Tool
public com.google.common.collect.ImmutableMap<String,String> getEnvironment(SourcePathResolverAdapter resolver)
getEnvironment
in interface Tool
public <E extends Exception> void computeInputs(ThrowingConsumer<SourcePath,E> consumer) throws E extends Exception
computeInputs
in interface HasCustomInputsLogic
E extends Exception
public static VersionedTool of(String name, PathSourcePath path, String version)
public static VersionedTool of(String name, PathSourcePath path, String version, com.google.common.collect.ImmutableList<String> extraArgs)