use of com.facebook.buck.apple.xcode.XCScheme in project buck by facebook.
the class WorkspaceAndProjectGeneratorTest method customRunnableSettings.
@Test
public void customRunnableSettings() throws IOException, InterruptedException {
BuildTarget fooLibTarget = BuildTarget.builder(rootCell.getRoot(), "//foo", "FooLib").build();
TargetNode<AppleLibraryDescription.Arg, ?> fooLib = AppleLibraryBuilder.createBuilder(fooLibTarget).build();
TargetNode<XcodeWorkspaceConfigDescription.Arg, ?> workspaceNode = XcodeWorkspaceConfigBuilder.createBuilder(BuildTarget.builder(rootCell.getRoot(), "//foo", "workspace").build()).setWorkspaceName(Optional.of("workspace")).setSrcTarget(Optional.of(fooLibTarget)).setExplicitRunnablePath(Optional.of("/some.app")).setLaunchStyle(Optional.of(XCScheme.LaunchAction.LaunchStyle.WAIT)).build();
TargetGraph targetGraph = TargetGraphFactory.newInstance(fooLib, workspaceNode);
WorkspaceAndProjectGenerator generator = new WorkspaceAndProjectGenerator(rootCell, targetGraph, workspaceNode.getConstructorArg(), workspaceNode.getBuildTarget(), ImmutableSet.of(ProjectGenerator.Option.INCLUDE_TESTS, ProjectGenerator.Option.INCLUDE_DEPENDENCIES_TESTS), false, /* combinedProject */
false, /* buildWithBuck */
ImmutableList.of(), Optional.empty(), true, /* 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());
XCScheme mainScheme = generator.getSchemeGenerators().get("workspace").getOutputScheme().get();
XCScheme.LaunchAction launchAction = mainScheme.getLaunchAction().get();
assertThat(launchAction.getRunnablePath().get(), Matchers.equalTo("/some.app"));
assertThat(launchAction.getLaunchStyle(), Matchers.equalTo(XCScheme.LaunchAction.LaunchStyle.WAIT));
}
use of com.facebook.buck.apple.xcode.XCScheme in project buck by facebook.
the class WorkspaceAndProjectGeneratorTest method enablingParallelizeBuild.
@Test
public void enablingParallelizeBuild() throws IOException, InterruptedException {
BuildTarget fooLibTarget = BuildTarget.builder(rootCell.getRoot(), "//foo", "FooLib").build();
TargetNode<AppleLibraryDescription.Arg, ?> fooLib = AppleLibraryBuilder.createBuilder(fooLibTarget).build();
TargetNode<XcodeWorkspaceConfigDescription.Arg, ?> workspaceNode = XcodeWorkspaceConfigBuilder.createBuilder(BuildTarget.builder(rootCell.getRoot(), "//foo", "workspace").build()).setWorkspaceName(Optional.of("workspace")).setSrcTarget(Optional.of(fooLibTarget)).build();
TargetGraph targetGraph = TargetGraphFactory.newInstance(fooLib, workspaceNode);
WorkspaceAndProjectGenerator generator = new WorkspaceAndProjectGenerator(rootCell, targetGraph, workspaceNode.getConstructorArg(), workspaceNode.getBuildTarget(), ImmutableSet.of(ProjectGenerator.Option.INCLUDE_TESTS, ProjectGenerator.Option.INCLUDE_DEPENDENCIES_TESTS), false, /* combinedProject */
false, /* buildWithBuck */
ImmutableList.of(), Optional.empty(), true, /* 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());
XCScheme mainScheme = generator.getSchemeGenerators().get("workspace").getOutputScheme().get();
XCScheme.BuildAction mainSchemeBuildAction = mainScheme.getBuildAction().get();
// I wish we could use Hamcrest contains() here, but we hit
// https://code.google.com/p/hamcrest/issues/detail?id=190 if we do that.
assertThat(mainSchemeBuildAction.getBuildActionEntries(), hasSize(1));
assertThat(mainSchemeBuildAction.getBuildActionEntries().get(0), withNameAndBuildingFor("FooLib", equalTo(XCScheme.BuildActionEntry.BuildFor.DEFAULT)));
assertThat(mainSchemeBuildAction.getParallelizeBuild(), is(true));
}
Aggregations