use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class ParserConfigTest method whenParserPythonIsExecutableFileThenItIsUsed.
@Test
public void whenParserPythonIsExecutableFileThenItIsUsed() throws IOException {
Path configPythonFile = temporaryFolder.newExecutableFile("python");
ParserConfig parserConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of("parser", ImmutableMap.of("python_interpreter", configPythonFile.toAbsolutePath().toString()))).build().getView(ParserConfig.class);
assertEquals("Should return path to temp file.", configPythonFile.toAbsolutePath().toString(), parserConfig.getPythonInterpreter(new ExecutableFinder()));
}
use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class MissingSymbolsHandler method create.
public static MissingSymbolsHandler create(ProjectFilesystem projectFilesystem, ImmutableSet<Description<?>> descriptions, BuckConfig config, BuckEventBus buckEventBus, Console console, JavacOptions javacOptions, ImmutableMap<String, String> environment) {
SrcRootsFinder srcRootsFinder = new SrcRootsFinder(projectFilesystem);
ParserConfig parserConfig = config.getView(ParserConfig.class);
PythonBuckConfig pythonBuckConfig = new PythonBuckConfig(config, new ExecutableFinder());
ProjectBuildFileParserFactory projectBuildFileParserFactory = new DefaultProjectBuildFileParserFactory(ProjectBuildFileParserOptions.builder().setProjectRoot(projectFilesystem.getRootPath()).setPythonInterpreter(pythonBuckConfig.getPythonInterpreter()).setAllowEmptyGlobs(parserConfig.getAllowEmptyGlobs()).setIgnorePaths(projectFilesystem.getIgnorePaths()).setBuildFileName(parserConfig.getBuildFileName()).setAutodepsFilesHaveSignatures(config.getIncludeAutodepsSignature()).setDefaultIncludes(parserConfig.getDefaultIncludes()).setDescriptions(descriptions).setBuildFileImportWhitelist(parserConfig.getBuildFileImportWhitelist()).build());
JavaSymbolFinder javaSymbolFinder = new JavaSymbolFinder(projectFilesystem, srcRootsFinder, javacOptions, new ConstructorArgMarshaller(new DefaultTypeCoercerFactory(ObjectMappers.newDefaultInstance())), projectBuildFileParserFactory, config, buckEventBus, console, environment);
return new MissingSymbolsHandler(console, javaSymbolFinder, parserConfig.getBuildFileName());
}
use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class CsharpLibraryCompile method getShellCommandInternal.
@Override
protected ImmutableList<String> getShellCommandInternal(ExecutionContext context) {
Path csc = new ExecutableFinder().getExecutable(CSC, context.getEnvironment());
DotnetFramework netFramework = DotnetFramework.resolveFramework(context.getEnvironment(), version);
ImmutableList.Builder<String> args = ImmutableList.builder();
args.add(csc.toAbsolutePath().toString()).add("/target:library").add("/out:" + output.toString());
for (Either<Path, String> ref : references) {
args.add("/reference:" + resolveReference(netFramework, ref));
}
for (Path resource : resources.keySet()) {
for (String name : resources.get(resource)) {
args.add("/resource:" + Escaper.escapeAsShellString(resource.toString()) + "," + name);
}
}
args.addAll(srcs.stream().map(input -> Escaper.escapeAsShellString(input.toAbsolutePath().toString())).collect(MoreCollectors.toImmutableSet()));
return args.build();
}
use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class ElfExtractSectionsStepTest method assumeObjcopy.
private Path assumeObjcopy() {
assumeThat(Platform.detect(), Matchers.oneOf(Platform.LINUX, Platform.MACOS));
ExecutableFinder finder = new ExecutableFinder();
Optional<Path> objcopy = Optional.empty();
for (String name : OBJCOPY_NAMES) {
objcopy = finder.getOptionalExecutable(tmp.getRoot().getFileSystem().getPath(name), ImmutableMap.copyOf(System.getenv()));
if (objcopy.isPresent()) {
break;
}
}
assumeTrue(objcopy.isPresent());
return objcopy.get();
}
use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class PythonBuckConfigTest method whenPython2OnPathThenItIsUsed.
@Test
public void whenPython2OnPathThenItIsUsed() throws IOException {
temporaryFolder.newExecutableFile("python");
Path python2 = temporaryFolder.newExecutableFile("python2");
PythonBuckConfig config = new PythonBuckConfig(FakeBuckConfig.builder().setEnvironment(ImmutableMap.<String, String>builder().put("PATH", temporaryFolder.getRoot().toAbsolutePath().toString()).put("PATHEXT", "").build()).build(), new ExecutableFinder());
assertEquals("Should return path to python2.", python2.toAbsolutePath().toString(), config.getPythonInterpreter());
}
Aggregations