use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class CellTest method shouldResolveFallbackCell.
@Test
public void shouldResolveFallbackCell() throws IOException, InterruptedException {
FileSystem vfs = Jimfs.newFileSystem(Configuration.unix());
Path root = vfs.getPath("/opt/local/");
Path cell1Root = root.resolve("repo1");
Files.createDirectories(cell1Root);
Path cell2Root = root.resolve("repo2");
Files.createDirectories(cell2Root);
ProjectFilesystem filesystem1 = new ProjectFilesystem(cell1Root.toAbsolutePath());
ProjectFilesystem filesystem2 = new ProjectFilesystem(cell2Root.toAbsolutePath());
BuckConfig config = FakeBuckConfig.builder().setFilesystem(filesystem1).setSections("[repositories]", "example = " + filesystem2.getRootPath().toString()).build();
Cell cell1 = new TestCellBuilder().setBuckConfig(config).setFilesystem(filesystem1).build();
Path path = cell1.getCellPathResolver().getCellPath(Optional.of("example"));
assertEquals(path, cell2Root);
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class PythonTestIntegrationTest method getPythonBuckConfig.
private PythonBuckConfig getPythonBuckConfig() throws IOException {
Config rawConfig = Configs.createDefaultConfig(tmp.getRoot());
BuckConfig buckConfig = new BuckConfig(rawConfig, new ProjectFilesystem(tmp.getRoot()), Architecture.detect(), Platform.detect(), ImmutableMap.copyOf(System.getenv()), new DefaultCellPathResolver(tmp.getRoot(), rawConfig));
return new PythonBuckConfig(buckConfig, new ExecutableFinder());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class PythonBinaryIntegrationTest method getPythonBuckConfig.
private PythonBuckConfig getPythonBuckConfig() throws IOException {
Config rawConfig = Configs.createDefaultConfig(tmp.getRoot());
BuckConfig buckConfig = new BuckConfig(rawConfig, new ProjectFilesystem(tmp.getRoot()), Architecture.detect(), Platform.detect(), ImmutableMap.copyOf(System.getenv()), new DefaultCellPathResolver(tmp.getRoot(), rawConfig));
return new PythonBuckConfig(buckConfig, new ExecutableFinder());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class VersionControlBuckConfigTest method givenHgCmdNotInConfigThenReturnDefault.
@Test
public void givenHgCmdNotInConfigThenReturnDefault() {
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of(VersionControlBuckConfig.VC_SECTION_KEY, ImmutableMap.of())).build();
VersionControlBuckConfig config = new VersionControlBuckConfig(buckConfig);
assertThat(VersionControlBuckConfig.HG_CMD_DEFAULT, is(equalTo(config.getHgCmd())));
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class VersionControlBuckConfigTest method givenGenerateStatisticsInConfigThenReturnGenerateStatisticsFromConfig.
@Test
public void givenGenerateStatisticsInConfigThenReturnGenerateStatisticsFromConfig() {
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of(VersionControlBuckConfig.VC_SECTION_KEY, ImmutableMap.of(VersionControlBuckConfig.GENERATE_STATISTICS_KEY, GENERATE_STATISTICS))).build();
VersionControlBuckConfig config = new VersionControlBuckConfig(buckConfig);
assertThat(GENERATE_STATISTICS_RESULT, is(equalTo(config.shouldGenerateStatistics())));
}
Aggregations