use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class KotlinBuckConfigTest method testFindsKotlinRuntimeLibraryInPath.
@Test
public void testFindsKotlinRuntimeLibraryInPath() throws IOException {
// Get faux kotlinc binary location in project
Path kotlinPath = workspace.resolve("bin");
Path kotlinCompiler = kotlinPath.resolve("kotlinc");
MoreFiles.makeExecutable(kotlinCompiler);
BuckConfig buckConfig = FakeBuckConfig.builder().setEnvironment(ImmutableMap.of("PATH", kotlinPath.toString() + pathSeparator + System.getenv("PATH"))).build();
KotlinBuckConfig kotlinBuckConfig = new KotlinBuckConfig(buckConfig);
Path runtimeJar = kotlinBuckConfig.getPathToRuntimeJar().getRight();
Assert.assertThat(runtimeJar.toString(), Matchers.containsString(workspace.getPath(".").normalize().toString()));
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class KotlinBuckConfigTest method testFindsKotlinCompilerInConfigWithAbsolutePath.
@Test
public void testFindsKotlinCompilerInConfigWithAbsolutePath() throws HumanReadableException, IOException {
// Get faux kotlinc binary location in project
Path kotlinCompiler = workspace.resolve("bin").resolve("kotlinc");
MoreFiles.makeExecutable(kotlinCompiler);
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of("kotlin", ImmutableMap.of("compiler", kotlinCompiler.toString()))).build();
KotlinBuckConfig kotlinBuckConfig = new KotlinBuckConfig(buckConfig);
String command = kotlinBuckConfig.getKotlinCompiler().get().getCommandPrefix(null).get(0);
assertEquals(command, kotlinCompiler.toString());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class KotlinBuckConfigTest method testFindsKotlinRuntimeInConfigWithRelativePath.
@Test
public void testFindsKotlinRuntimeInConfigWithRelativePath() throws HumanReadableException, IOException {
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.resolve("."));
BuckConfig buckConfig = FakeBuckConfig.builder().setFilesystem(filesystem).setSections(ImmutableMap.of("kotlin", ImmutableMap.of("runtime_jar", "lib/kotlin-runtime.jar"))).setEnvironment(ImmutableMap.of("KOTLIN_HOME", workspace.getPath(".").normalize().toString())).build();
KotlinBuckConfig kotlinBuckConfig = new KotlinBuckConfig(buckConfig);
PathSourcePath runtimeJar = (PathSourcePath) kotlinBuckConfig.getPathToRuntimeJar().getLeft();
assertEquals(runtimeJar.getRelativePath().toString(), "lib/kotlin-runtime.jar");
}
Aggregations