use of com.facebook.buck.rules.HashedFileTool in project buck by facebook.
the class HaskellBuckConfig method getCompiler.
@Override
public ToolProvider getCompiler() {
Optional<ToolProvider> configuredCompiler = delegate.getToolProvider(SECTION, "compiler");
if (configuredCompiler.isPresent()) {
return configuredCompiler.get();
}
Optional<Path> systemCompiler = getSystemCompiler();
if (systemCompiler.isPresent()) {
return new ConstantToolProvider(new HashedFileTool(systemCompiler.get()));
}
throw new HumanReadableException("No Haskell compiler found in .buckconfig (%s.compiler) or on system", SECTION);
}
use of com.facebook.buck.rules.HashedFileTool in project buck by facebook.
the class GoBuckConfig method getGoTool.
private Tool getGoTool(final String configName, final String toolName, final String extraFlagsConfigKey) {
Optional<Path> toolPath = delegate.getPath(SECTION, configName);
if (!toolPath.isPresent()) {
toolPath = Optional.of(goToolDirSupplier.get().resolve(toolName));
}
CommandTool.Builder builder = new CommandTool.Builder(new HashedFileTool(toolPath.get()));
if (!extraFlagsConfigKey.isEmpty()) {
for (String arg : getFlags(extraFlagsConfigKey)) {
builder.addArg(arg);
}
}
builder.addEnv("GOROOT", goRootSupplier.get().toString());
return builder.build();
}
use of com.facebook.buck.rules.HashedFileTool in project buck by facebook.
the class GroovyBuckConfig method getGroovyCompiler.
Supplier<Tool> getGroovyCompiler() {
Optional<Path> path = delegate.getPath("groovy", "groovy_home");
final Path groovyHomePath;
if (path.isPresent()) {
groovyHomePath = path.get();
} else {
String defaultGroovyHome = delegate.getEnvironment().get("GROOVY_HOME");
if (defaultGroovyHome == null) {
throw new HumanReadableException("Unable to locate groovy compiler:" + " GROOVY_HOME is not set, and groovy.groovy_home was not provided");
} else {
groovyHomePath = Paths.get(defaultGroovyHome);
}
}
Path compiler = new ExecutableFinder().getExecutable(groovyHomePath.resolve("bin/groovyc"), delegate.getEnvironment());
return Suppliers.ofInstance(new HashedFileTool(compiler));
}
use of com.facebook.buck.rules.HashedFileTool in project buck by facebook.
the class KotlinBuckConfig method getKotlinCompiler.
/**
* Get the Tool instance for the Kotlin compiler.
* @return the Kotlin compiler Tool
*/
public Supplier<Tool> getKotlinCompiler() {
Path compilerPath = getKotlinHome().resolve("kotlinc");
if (!Files.isExecutable(compilerPath)) {
compilerPath = getKotlinHome().resolve(Paths.get("bin", "kotlinc"));
if (!Files.isExecutable(compilerPath)) {
throw new HumanReadableException("Could not resolve kotlinc location.");
}
}
Path compiler = new ExecutableFinder().getExecutable(compilerPath, delegate.getEnvironment());
return Suppliers.ofInstance(new HashedFileTool(compiler));
}
use of com.facebook.buck.rules.HashedFileTool in project buck by facebook.
the class ScalaBuckConfig method findScalac.
private Tool findScalac(BuildRuleResolver resolver) {
Optional<Tool> configScalac = delegate.getTool(SECTION, "compiler", resolver);
if (configScalac.isPresent()) {
return configScalac.get();
}
Optional<Path> externalScalac = new ExecutableFinder().getOptionalExecutable(Paths.get("scalac"), delegate.getEnvironment());
if (externalScalac.isPresent()) {
return new HashedFileTool(externalScalac.get());
}
String scalaHome = delegate.getEnvironment().get("SCALA_HOME");
if (scalaHome != null) {
Path scalacInHomePath = Paths.get(scalaHome, "bin", "scalac");
if (scalacInHomePath.toFile().exists()) {
return new HashedFileTool(scalacInHomePath);
}
throw new HumanReadableException("Could not find scalac at $SCALA_HOME/bin/scalac.");
}
throw new HumanReadableException("Could not find scalac. Consider setting scala.compiler or $SCALA_HOME.");
}
Aggregations