use of com.facebook.buck.rules.TestCellBuilder in project buck by facebook.
the class AppleBuildRulesTest method testIosResourceIsNotXcodeTargetDescription.
@Test
public void testIosResourceIsNotXcodeTargetDescription() throws Exception {
Cell rootCell = (new TestCellBuilder()).build();
BuildTarget resourceTarget = BuildTarget.builder(rootCell.getRoot(), "//foo", "res").build();
TargetNode<?, ?> resourceNode = AppleResourceBuilder.createBuilder(resourceTarget).setFiles(ImmutableSet.of()).setDirs(ImmutableSet.of()).build();
assertFalse(AppleBuildRules.isXcodeTargetDescription(resourceNode.getDescription()));
}
use of com.facebook.buck.rules.TestCellBuilder in project buck by facebook.
the class ProjectGeneratorTest method setUp.
@Before
public void setUp() throws InterruptedException, IOException {
assumeTrue(Platform.detect() == Platform.MACOS || Platform.detect() == Platform.LINUX);
clock = new SettableFakeClock(0, 0);
fakeProjectFilesystem = new FakeProjectFilesystem(clock);
projectCell = (new TestCellBuilder()).setFilesystem(fakeProjectFilesystem).build();
projectFilesystem = projectCell.getFilesystem();
rootPath = projectFilesystem.getRootPath();
// Add files and directories used to test resources.
projectFilesystem.createParentDirs(Paths.get("foodir", "foo.png"));
projectFilesystem.writeContentsToPath("", Paths.get("foodir", "foo.png"));
projectFilesystem.writeContentsToPath("", Paths.get("bar.png"));
fakeProjectFilesystem.touch(Paths.get("Base.lproj", "Bar.storyboard"));
halideBuckConfig = HalideLibraryBuilder.createDefaultHalideConfig(fakeProjectFilesystem);
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("cxx", ImmutableMap.of("cflags", "-Wno-deprecated -Wno-conversion", "cxxflags", "-Wundeclared-selector -Wno-objc-designated-initializers"), "apple", ImmutableMap.of("force_dsym_mode_in_build_with_buck", "false"), "swift", ImmutableMap.of("version", "1.23"));
BuckConfig config = FakeBuckConfig.builder().setSections(sections).build();
cxxBuckConfig = new CxxBuckConfig(config);
appleConfig = new AppleConfig(config);
swiftBuckConfig = new SwiftBuckConfig(config);
}
use of com.facebook.buck.rules.TestCellBuilder in project buck by facebook.
the class CleanCommandTest method createCommandRunnerParams.
private CommandRunnerParams createCommandRunnerParams() throws InterruptedException, IOException {
projectFilesystem = new FakeProjectFilesystem();
Cell cell = new TestCellBuilder().setFilesystem(projectFilesystem).build();
Supplier<AndroidPlatformTarget> androidPlatformTargetSupplier = AndroidPlatformTarget.EXPLODING_ANDROID_PLATFORM_TARGET_SUPPLIER;
return CommandRunnerParams.builder().setConsole(new TestConsole()).setStdIn(new ByteArrayInputStream("".getBytes("UTF-8"))).setCell(cell).setAndroidPlatformTargetSupplier(androidPlatformTargetSupplier).setArtifactCacheFactory(new SingletonArtifactCacheFactory(new NoopArtifactCache())).setBuckEventBus(BuckEventBusFactory.newInstance()).setParser(createMock(Parser.class)).setPlatform(Platform.detect()).setEnvironment(ImmutableMap.copyOf(System.getenv())).setJavaPackageFinder(new FakeJavaPackageFinder()).setObjectMapper(ObjectMappers.newDefaultInstance()).setClock(new DefaultClock()).setProcessManager(Optional.empty()).setWebServer(Optional.empty()).setBuckConfig(FakeBuckConfig.builder().build()).setFileHashCache(new StackedFileHashCache(ImmutableList.of())).setExecutors(ImmutableMap.of()).setBuildEnvironmentDescription(CommandRunnerParamsForTesting.BUILD_ENVIRONMENT_DESCRIPTION).setVersionedTargetGraphCache(new VersionedTargetGraphCache()).setActionGraphCache(new ActionGraphCache(new BroadcastEventListener())).setKnownBuildRuleTypesFactory(new KnownBuildRuleTypesFactory(new FakeProcessExecutor(), new FakeAndroidDirectoryResolver())).build();
}
use of com.facebook.buck.rules.TestCellBuilder in project buck by facebook.
the class DaemonIntegrationTest method whenBuckConfigChangesParserInvalidated.
@Test
public void whenBuckConfigChangesParserInvalidated() throws IOException, InterruptedException {
ProjectFilesystem filesystem = new ProjectFilesystem(tmp.getRoot());
Object daemon = Main.getDaemon(new TestCellBuilder().setBuckConfig(FakeBuckConfig.builder().setSections(ImmutableMap.of("somesection", ImmutableMap.of("somename", "somevalue"))).build()).setFilesystem(filesystem).build(), ObjectMappers.newDefaultInstance());
assertEquals("Daemon should not be replaced when config equal.", daemon, Main.getDaemon(new TestCellBuilder().setBuckConfig(FakeBuckConfig.builder().setSections(ImmutableMap.of("somesection", ImmutableMap.of("somename", "somevalue"))).build()).setFilesystem(filesystem).build(), ObjectMappers.newDefaultInstance()));
assertNotEquals("Daemon should be replaced when config not equal.", daemon, Main.getDaemon(new TestCellBuilder().setBuckConfig(FakeBuckConfig.builder().setSections(ImmutableMap.of("somesection", ImmutableMap.of("somename", "someothervalue"))).build()).setFilesystem(filesystem).build(), ObjectMappers.newDefaultInstance()));
}
use of com.facebook.buck.rules.TestCellBuilder in project buck by facebook.
the class AuditInputCommandTest method setUp.
@Before
public void setUp() throws IOException, InterruptedException {
console = new TestConsole();
FakeProjectFilesystem projectFilesystem = new FakeProjectFilesystem();
projectFilesystem.touch(Paths.get("src/com/facebook/AndroidLibraryTwo.java"));
projectFilesystem.touch(Paths.get("src/com/facebook/TestAndroidLibrary.java"));
projectFilesystem.touch(Paths.get("src/com/facebook/TestJavaLibrary.java"));
Cell cell = new TestCellBuilder().setFilesystem(projectFilesystem).build();
ArtifactCache artifactCache = new NoopArtifactCache();
BuckEventBus eventBus = BuckEventBusFactory.newInstance();
ObjectMapper objectMapper = ObjectMappers.newDefaultInstance();
auditInputCommand = new AuditInputCommand();
params = CommandRunnerParamsForTesting.createCommandRunnerParamsForTesting(console, cell, new FakeAndroidDirectoryResolver(), artifactCache, eventBus, FakeBuckConfig.builder().build(), Platform.detect(), ImmutableMap.copyOf(System.getenv()), new FakeJavaPackageFinder(), objectMapper, Optional.empty());
}
Aggregations