use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class KnownBuildRuleTypesTest method createInstanceShouldReturnDifferentInstancesIfCalledWithDifferentParameters.
@Test
public void createInstanceShouldReturnDifferentInstancesIfCalledWithDifferentParameters() throws Exception {
ProjectFilesystem filesystem = new ProjectFilesystem(temporaryFolder.getRoot());
KnownBuildRuleTypes knownBuildRuleTypes1 = KnownBuildRuleTypes.createInstance(FakeBuckConfig.builder().build(), filesystem, createExecutor(), new FakeAndroidDirectoryResolver());
final Path javac = temporaryFolder.newExecutableFile();
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("tools", ImmutableMap.of("javac", javac.toString()));
BuckConfig buckConfig = FakeBuckConfig.builder().setFilesystem(filesystem).setSections(sections).build();
ProcessExecutor processExecutor = createExecutor(javac.toString(), "");
KnownBuildRuleTypes knownBuildRuleTypes2 = KnownBuildRuleTypes.createInstance(buckConfig, filesystem, processExecutor, new FakeAndroidDirectoryResolver());
assertNotEquals(knownBuildRuleTypes1, knownBuildRuleTypes2);
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class KnownBuildRuleTypesTestUtil method getDefaultKnownBuildRuleTypes.
public static KnownBuildRuleTypes getDefaultKnownBuildRuleTypes(ProjectFilesystem filesystem, ImmutableMap<String, String> environment) throws InterruptedException, IOException {
BuckConfig config = FakeBuckConfig.builder().setFilesystem(filesystem).build();
List<String> paths = getPaths(environment);
return KnownBuildRuleTypes.createInstance(config, filesystem, new FakeProcessExecutor(ImmutableMap.<ProcessExecutorParams, FakeProcess>builder().put(XCODE_SELECT_PARAMS, XCODE_SELECT_PROCESS).putAll(getPythonProcessMap(paths)).build()), new FakeAndroidDirectoryResolver());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class RageConfigTest method testUploadConfigs.
@Test
public void testUploadConfigs() {
String testPath = "rage/upload/test";
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of("rage", ImmutableMap.of("report_upload_path", testPath, "slb_server_pool", "http://buck-frontend-dual.05.atn1.facebook.com"))).build();
RageConfig config = RageConfig.of(buckConfig);
assertThat(config.getReportUploadPath(), Matchers.equalTo(testPath));
assertThat(config.getFrontendConfig().get().tryCreatingClientSideSlb(clock, eventBus, threadFactory), Matchers.not(Matchers.equalTo(Optional.empty())));
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class TestCellBuilder method build.
public Cell build() throws IOException, InterruptedException {
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
BuckConfig config = buckConfig == null ? FakeBuckConfig.builder().setFilesystem(filesystem).build() : buckConfig;
KnownBuildRuleTypesFactory typesFactory = new KnownBuildRuleTypesFactory(executor, androidDirectoryResolver);
if (parserFactory == null) {
return CellProvider.createForLocalBuild(filesystem, watchman, config, cellConfig, typesFactory).getCellByPath(filesystem.getRootPath());
}
// The constructor for `Cell` is private, and it's in such a central location I don't really
// want to make it public. Brace yourselves.
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(Cell.class);
enhancer.setCallback((MethodInterceptor) (obj, method, args, proxy) -> {
if ("createBuildFileParserFactory".equals(method.getName())) {
return parserFactory;
}
return proxy.invokeSuper(obj, args);
});
return (Cell) enhancer.create();
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class WorkspaceAndProjectGeneratorTest method setUp.
@Before
public void setUp() throws InterruptedException, IOException {
rootCell = (new TestCellBuilder()).build();
ProjectFilesystem projectFilesystem = rootCell.getFilesystem();
halideBuckConfig = HalideLibraryBuilder.createDefaultHalideConfig(projectFilesystem);
cxxBuckConfig = CxxLibraryBuilder.createDefaultConfig();
BuckConfig fakeBuckConfig = FakeBuckConfig.builder().build();
appleConfig = new AppleConfig(fakeBuckConfig);
swiftBuckConfig = new SwiftBuckConfig(fakeBuckConfig);
setUpWorkspaceAndProjects();
}
Aggregations