use of com.facebook.buck.io.AlwaysFoundExecutableFinder in project buck by facebook.
the class WorkspaceAndProjectGeneratorTest method workspaceAndProjectsWithoutDependenciesTests.
@Test
public void workspaceAndProjectsWithoutDependenciesTests() throws IOException, InterruptedException {
WorkspaceAndProjectGenerator generator = new WorkspaceAndProjectGenerator(rootCell, targetGraph, workspaceNode.getConstructorArg(), workspaceNode.getBuildTarget(), ImmutableSet.of(ProjectGenerator.Option.INCLUDE_TESTS), false, /* combinedProject */
false, /* buildWithBuck */
ImmutableList.of(), Optional.empty(), false, /* parallelizeBuild */
new AlwaysFoundExecutableFinder(), ImmutableMap.of(), PLATFORMS, DEFAULT_PLATFORM, "BUCK", getBuildRuleResolverForNodeFunction(targetGraph), getFakeBuckEventBus(), halideBuckConfig, cxxBuckConfig, appleConfig, swiftBuckConfig);
Map<Path, ProjectGenerator> projectGenerators = new HashMap<>();
generator.generateWorkspaceAndDependentProjects(projectGenerators, MoreExecutors.newDirectExecutorService());
Optional<XCScheme> scheme = Iterables.getOnlyElement(generator.getSchemeGenerators().values()).getOutputScheme();
assertThat(scheme.isPresent(), is(true));
assertThat("Test for project FooBin should have been generated", scheme.get().getBuildAction().get().getBuildActionEntries(), hasItem(withNameAndBuildingFor("bin-xctest", equalTo(XCScheme.BuildActionEntry.BuildFor.TEST_ONLY))));
assertThat("Test for project FooLib should not be generated at all", scheme.get().getBuildAction().get().getBuildActionEntries(), not(hasItem(withNameAndBuildingFor("lib-xctest", equalTo(XCScheme.BuildActionEntry.BuildFor.TEST_ONLY)))));
}
use of com.facebook.buck.io.AlwaysFoundExecutableFinder in project buck by facebook.
the class PythonTestDescriptionTest method pexExecutorRuleIsAddedToParseTimeDeps.
@Test
public void pexExecutorRuleIsAddedToParseTimeDeps() throws Exception {
ShBinaryBuilder pexExecutorBuilder = new ShBinaryBuilder(BuildTargetFactory.newInstance("//:pex_executor")).setMain(new FakeSourcePath("run.sh"));
PythonTestBuilder builder = new PythonTestBuilder(BuildTargetFactory.newInstance("//:bin"), new PythonBuckConfig(FakeBuckConfig.builder().setSections(ImmutableMap.of("python", ImmutableMap.of("path_to_pex_executer", pexExecutorBuilder.getTarget().toString()))).build(), new AlwaysFoundExecutableFinder()), PythonTestUtils.PYTHON_PLATFORMS, CxxPlatformUtils.DEFAULT_PLATFORM, CxxPlatformUtils.DEFAULT_PLATFORMS);
builder.setPackageStyle(PythonBuckConfig.PackageStyle.STANDALONE);
assertThat(builder.build().getExtraDeps(), Matchers.hasItem(pexExecutorBuilder.getTarget()));
}
use of com.facebook.buck.io.AlwaysFoundExecutableFinder in project buck by facebook.
the class PythonBinaryDescriptionTest method pexBuilderAddedToParseTimeDeps.
@Test
public void pexBuilderAddedToParseTimeDeps() {
final BuildTarget pexBuilder = BuildTargetFactory.newInstance("//:pex_builder");
PythonBuckConfig config = new PythonBuckConfig(FakeBuckConfig.builder().build(), new AlwaysFoundExecutableFinder()) {
@Override
public Optional<BuildTarget> getPexExecutorTarget() {
return Optional.of(pexBuilder);
}
};
PythonBinaryBuilder inplaceBinary = new PythonBinaryBuilder(BuildTargetFactory.newInstance("//:bin"), config, PythonTestUtils.PYTHON_PLATFORMS, CxxPlatformUtils.DEFAULT_PLATFORM, CxxPlatformUtils.DEFAULT_PLATFORMS).setPackageStyle(PythonBuckConfig.PackageStyle.INPLACE);
assertThat(inplaceBinary.findImplicitDeps(), Matchers.not(Matchers.hasItem(pexBuilder)));
PythonBinaryBuilder standaloneBinary = new PythonBinaryBuilder(BuildTargetFactory.newInstance("//:bin"), config, PythonTestUtils.PYTHON_PLATFORMS, CxxPlatformUtils.DEFAULT_PLATFORM, CxxPlatformUtils.DEFAULT_PLATFORMS).setPackageStyle(PythonBuckConfig.PackageStyle.STANDALONE);
assertThat(standaloneBinary.findImplicitDeps(), Matchers.hasItem(pexBuilder));
}
use of com.facebook.buck.io.AlwaysFoundExecutableFinder in project buck by facebook.
the class PythonBinaryDescriptionTest method preloadLibraries.
@Test
public void preloadLibraries() throws Exception {
for (final NativeLinkStrategy strategy : NativeLinkStrategy.values()) {
CxxLibraryBuilder cxxLibraryBuilder = new CxxLibraryBuilder(BuildTargetFactory.newInstance("//:dep")).setSrcs(ImmutableSortedSet.of(SourceWithFlags.of(new FakeSourcePath("test.c"))));
PythonBuckConfig config = new PythonBuckConfig(FakeBuckConfig.builder().build(), new AlwaysFoundExecutableFinder()) {
@Override
public NativeLinkStrategy getNativeLinkStrategy() {
return strategy;
}
};
PythonBinaryBuilder binaryBuilder = new PythonBinaryBuilder(BuildTargetFactory.newInstance("//:bin"), config, PythonTestUtils.PYTHON_PLATFORMS, CxxPlatformUtils.DEFAULT_PLATFORM, CxxPlatformUtils.DEFAULT_PLATFORMS);
binaryBuilder.setMainModule("main");
binaryBuilder.setPreloadDeps(ImmutableSortedSet.of(cxxLibraryBuilder.getTarget()));
BuildRuleResolver resolver = new BuildRuleResolver(TargetGraphFactory.newInstance(cxxLibraryBuilder.build(), binaryBuilder.build()), new DefaultTargetNodeToBuildRuleTransformer());
cxxLibraryBuilder.build(resolver);
PythonBinary binary = binaryBuilder.build(resolver);
assertThat("Using " + strategy, binary.getPreloadLibraries(), Matchers.hasItems("libdep.so"));
assertThat("Using " + strategy, binary.getComponents().getNativeLibraries().keySet(), Matchers.hasItems(Paths.get("libdep.so")));
}
}
use of com.facebook.buck.io.AlwaysFoundExecutableFinder in project buck by facebook.
the class PythonBuckConfigTest method testDefaultPythonLibrary.
@Test
public void testDefaultPythonLibrary() throws InterruptedException {
BuildTarget library = BuildTargetFactory.newInstance("//:library");
PythonBuckConfig config = new PythonBuckConfig(FakeBuckConfig.builder().setSections(ImmutableMap.of("python", ImmutableMap.of("library", library.toString()))).build(), new AlwaysFoundExecutableFinder());
assertThat(config.getDefaultPythonPlatform(new FakeProcessExecutor(Functions.constant(new FakeProcess(0, "CPython 2 7", "")), new TestConsole())).getCxxLibrary(), Matchers.equalTo(Optional.of(library)));
}
Aggregations