use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class MultiarchFileTest method descriptionWithMultiplePlatformArgsShouldGenerateMultiarchFile.
@SuppressWarnings({ "unchecked" })
@Test
public void descriptionWithMultiplePlatformArgsShouldGenerateMultiarchFile() throws Exception {
BuildTarget target = BuildTargetFactory.newInstance("//foo:thing#iphoneos-i386,iphoneos-x86_64");
BuildTarget sandboxTarget = BuildTargetFactory.newInstance("//foo:thing#iphoneos-i386,iphoneos-x86_64,sandbox");
BuildRuleResolver resolver = new BuildRuleResolver(TargetGraphFactory.newInstance(new AppleLibraryBuilder(sandboxTarget).build()), new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(resolver));
ProjectFilesystem filesystem = new FakeProjectFilesystem();
BuildRule multiarchRule = nodeBuilderFactory.getNodeBuilder(target).build(resolver, filesystem);
assertThat(multiarchRule, instanceOf(MultiarchFile.class));
ImmutableList<Step> steps = multiarchRule.getBuildSteps(FakeBuildContext.withSourcePathResolver(pathResolver), new FakeBuildableContext());
ShellStep step = Iterables.getLast(Iterables.filter(steps, ShellStep.class));
ExecutionContext executionContext = TestExecutionContext.newInstance();
ImmutableList<String> command = step.getShellCommand(executionContext);
assertThat(command, Matchers.contains(endsWith("lipo"), equalTo("-create"), equalTo("-output"), containsString("foo/thing#"), containsString("/thing#"), containsString("/thing#")));
}
use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class AppleLibraryIntegrationTest method testAppleLibraryBuildsFrameworkIOS.
@Test
public void testAppleLibraryBuildsFrameworkIOS() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
assumeTrue(AppleNativeIntegrationTestUtils.isApplePlatformAvailable(ApplePlatform.IPHONESIMULATOR));
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_library_builds_something", tmp);
workspace.setUp();
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
BuildTarget target = BuildTargetFactory.newInstance("//Libraries/TestLibrary:TestLibrary#framework,iphonesimulator-x86_64,no-debug");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertSuccess();
Path frameworkPath = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTarget.builder(target).addFlavors(AppleDescriptions.INCLUDE_FRAMEWORKS_FLAVOR).build(), "%s").resolve("TestLibrary.framework"));
assertThat(Files.exists(frameworkPath), is(true));
assertThat(Files.exists(frameworkPath.resolve("Info.plist")), is(true));
Path libraryPath = frameworkPath.resolve("TestLibrary");
assertThat(Files.exists(libraryPath), is(true));
assertThat(workspace.runCommand("file", libraryPath.toString()).getStdout().get(), containsString("dynamically linked shared library"));
}
use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class AppleLibraryIntegrationTest method frameworkContainsFrameworkDependencies.
@Test
public void frameworkContainsFrameworkDependencies() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
assumeTrue(AppleNativeIntegrationTestUtils.isApplePlatformAvailable(ApplePlatform.MACOSX));
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_library_with_library_dependencies", tmp);
workspace.setUp();
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
BuildTarget target = BuildTargetFactory.newInstance("//Libraries/TestLibrary:TestLibrary#framework,macosx-x86_64");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertSuccess();
Path frameworkPath = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTarget.builder(target).addFlavors(AppleDebugFormat.DWARF.getFlavor()).addFlavors(AppleDescriptions.INCLUDE_FRAMEWORKS_FLAVOR).build(), "%s").resolve("TestLibrary.framework"));
assertThat(Files.exists(frameworkPath), is(true));
Path frameworksPath = frameworkPath.resolve("Frameworks");
assertThat(Files.exists(frameworksPath), is(true));
Path depPath = frameworksPath.resolve("TestLibraryDep.framework/TestLibraryDep");
assertThat(Files.exists(depPath), is(true));
assertThat(workspace.runCommand("file", depPath.toString()).getStdout().get(), containsString("dynamically linked shared library"));
Path transitiveDepPath = frameworksPath.resolve("TestLibraryTransitiveDep.framework/TestLibraryTransitiveDep");
assertThat(Files.exists(transitiveDepPath), is(true));
assertThat(workspace.runCommand("file", transitiveDepPath.toString()).getStdout().get(), containsString("dynamically linked shared library"));
}
use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class AppleLibraryIntegrationTest method testBuildAppleLibraryThatHasSwift.
@Test
public void testBuildAppleLibraryThatHasSwift() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "empty_source_targets", tmp);
workspace.setUp();
BuildTarget target = workspace.newBuildTarget("//:none-swift#iphonesimulator-x86_64").withAppendedFlavors(CxxDescriptionEnhancer.SHARED_FLAVOR);
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertSuccess();
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
Path binaryOutput = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s/libnone-swift.dylib"));
assertThat(Files.exists(binaryOutput), is(true));
assertThat(workspace.runCommand("otool", "-L", binaryOutput.toString()).getStdout().get(), containsString("libswiftCore.dylib"));
}
use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class AppleLibraryIntegrationTest method testAppleLibraryBuildsSomething.
@Test
public void testAppleLibraryBuildsSomething() throws IOException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_library_builds_something", tmp);
workspace.setUp();
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
BuildTarget target = BuildTargetFactory.newInstance("//Libraries/TestLibrary:TestLibrary#static,default");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertSuccess();
assertTrue(Files.exists(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"))));
}
Aggregations