Search in sources :

Example 46 with ExecutableFinder

use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.

the class PythonBuckConfigTest method whenToolsPythonDoesNotExistThenItIsNotUsed.

@Test(expected = HumanReadableException.class)
public void whenToolsPythonDoesNotExistThenItIsNotUsed() throws IOException {
    String invalidPath = temporaryFolder.getRoot().toAbsolutePath() + "DoesNotExist";
    PythonBuckConfig config = new PythonBuckConfig(FakeBuckConfig.builder().setSections(ImmutableMap.of("python", ImmutableMap.of("interpreter", invalidPath))).build(), new ExecutableFinder());
    config.getPythonInterpreter();
    fail("Should throw exception as python config is invalid.");
}
Also used : ExecutableFinder(com.facebook.buck.io.ExecutableFinder) AlwaysFoundExecutableFinder(com.facebook.buck.io.AlwaysFoundExecutableFinder) Test(org.junit.Test)

Example 47 with ExecutableFinder

use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.

the class NdkLibraryTest method setUp.

@Before
public void setUp() {
    AssumeAndroidPlatform.assumeNdkIsAvailable();
    projectFilesystem = new ProjectFilesystem(Paths.get(".").toAbsolutePath());
    AndroidDirectoryResolver resolver = new DefaultAndroidDirectoryResolver(projectFilesystem.getRootPath().getFileSystem(), ImmutableMap.copyOf(System.getenv()), Optional.empty(), Optional.empty());
    AndroidPlatformTarget androidPlatformTarget = AndroidPlatformTarget.getDefaultPlatformTarget(resolver, Optional.empty());
    executionContext = TestExecutionContext.newBuilder().setAndroidPlatformTargetSupplier(Suppliers.ofInstance(androidPlatformTarget)).build();
    ndkBuildCommand = new ExecutableFinder().getOptionalExecutable(Paths.get("ndk-build"), resolver.getNdkOrAbsent().get()).get().toAbsolutePath().toString();
}
Also used : ExecutableFinder(com.facebook.buck.io.ExecutableFinder) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) Before(org.junit.Before)

Aggregations

ExecutableFinder (com.facebook.buck.io.ExecutableFinder)47 Path (java.nio.file.Path)28 Test (org.junit.Test)20 AlwaysFoundExecutableFinder (com.facebook.buck.io.AlwaysFoundExecutableFinder)13 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)9 PythonBuckConfig (com.facebook.buck.python.PythonBuckConfig)6 HumanReadableException (com.facebook.buck.util.HumanReadableException)6 CxxBuckConfig (com.facebook.buck.cxx.CxxBuckConfig)5 BuildTarget (com.facebook.buck.model.BuildTarget)5 ParserConfig (com.facebook.buck.parser.ParserConfig)5 DefaultProcessExecutor (com.facebook.buck.util.DefaultProcessExecutor)5 ProcessExecutor (com.facebook.buck.util.ProcessExecutor)5 BuckConfig (com.facebook.buck.cli.BuckConfig)4 DefaultProjectBuildFileParserFactory (com.facebook.buck.json.DefaultProjectBuildFileParserFactory)4 FakeSourcePath (com.facebook.buck.rules.FakeSourcePath)4 TestConsole (com.facebook.buck.testutil.TestConsole)4 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)4 FakeBuckConfig (com.facebook.buck.cli.FakeBuckConfig)3 Config (com.facebook.buck.config.Config)3 CxxPlatform (com.facebook.buck.cxx.CxxPlatform)3