Search in sources :

Example 21 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class AppleBundleIntegrationTest method infoPlistWithUnrecognizedVariableFails.

@Test
public void infoPlistWithUnrecognizedVariableFails() throws IOException {
    assumeTrue(Platform.detect() == Platform.MACOS);
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "application_bundle_with_invalid_substitutions", tmp);
    workspace.setUp();
    workspace.runBuckCommand("build", "//:DemoApp#iphonesimulator-x86_64,no-debug").assertFailure();
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) Test(org.junit.Test)

Example 22 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class AppleBinaryIntegrationTest method testAppleBinaryUsesDefaultsFromConfig.

@Test
public void testAppleBinaryUsesDefaultsFromConfig() throws Exception {
    assumeTrue(Platform.detect() == Platform.MACOS);
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_binary_with_config_default_platform", tmp);
    workspace.setUp();
    BuildTarget target = BuildTargetFactory.newInstance("//Apps/TestApp:TestApp").withAppendedFlavors(InternalFlavor.of("iphoneos-arm64"));
    workspace.runBuckCommand("build", target.getFullyQualifiedName()).assertSuccess();
    Path outputPath = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"));
    assertThat(Files.exists(outputPath), is(true));
    assertThat(Files.exists(Paths.get(outputPath.toString() + "-LinkMap.txt")), is(true));
    assertThat(workspace.runCommand("file", outputPath.toString()).getStdout().get(), containsString("executable"));
    assertThat(workspace.runCommand("otool", "-hv", outputPath.toString()).getStdout().get(), containsString("ARM64"));
}
Also used : Path(java.nio.file.Path) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildTarget(com.facebook.buck.model.BuildTarget) Test(org.junit.Test)

Example 23 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class AppleBinaryIntegrationTest method multiarchBinaryShouldCopyLinkMapOfComponents.

@Test
public void multiarchBinaryShouldCopyLinkMapOfComponents() throws Exception {
    assumeTrue(Platform.detect() == Platform.MACOS);
    BuildTarget singleArchI386Target = BuildTargetFactory.newInstance("//:DemoApp#iphonesimulator-i386");
    BuildTarget singleArchX8664Target = BuildTargetFactory.newInstance("//:DemoApp#iphonesimulator-x86_64");
    BuildTarget target = BuildTargetFactory.newInstance("//:DemoApp#iphonesimulator-i386,iphonesimulator-x86_64");
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "multiarch_binary_linkmap", tmp);
    workspace.setUp();
    workspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
    assertTrue("Has link map for i386 arch.", Files.exists(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s-LinkMap").resolve(singleArchI386Target.getShortNameAndFlavorPostfix() + "-LinkMap.txt"))));
    assertTrue("Has link map for x86_64 arch.", Files.exists(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s-LinkMap").resolve(singleArchX8664Target.getShortNameAndFlavorPostfix() + "-LinkMap.txt"))));
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildTarget(com.facebook.buck.model.BuildTarget) Test(org.junit.Test)

Example 24 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class AppleBinaryIntegrationTest method testAppleBinaryWithLibraryDependencyBuildsSomething.

@Test
public void testAppleBinaryWithLibraryDependencyBuildsSomething() throws Exception {
    assumeTrue(Platform.detect() == Platform.MACOS);
    assumeTrue(AppleNativeIntegrationTestUtils.isApplePlatformAvailable(ApplePlatform.MACOSX));
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_binary_with_library_dependency_builds_something", tmp);
    workspace.setUp();
    BuildTarget target = BuildTargetFactory.newInstance("//Apps/TestApp:TestApp").withAppendedFlavors(InternalFlavor.of("macosx-x86_64"));
    workspace.runBuckCommand("build", target.getFullyQualifiedName()).assertSuccess();
    Path outputPath = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"));
    assertThat(Files.exists(outputPath), is(true));
    assertThat(workspace.runCommand("file", outputPath.toString()).getStdout().get(), containsString("executable"));
}
Also used : Path(java.nio.file.Path) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildTarget(com.facebook.buck.model.BuildTarget) Test(org.junit.Test)

Example 25 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class AppleBinaryIntegrationTest method testAppleBinaryHeaderSymlinkTree.

@Test
public void testAppleBinaryHeaderSymlinkTree() throws IOException {
    assumeTrue(Platform.detect() == Platform.MACOS);
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_binary_header_symlink_tree", tmp);
    workspace.setUp();
    BuildTarget buildTarget = BuildTargetFactory.newInstance("//Apps/TestApp:TestApp#default," + CxxDescriptionEnhancer.HEADER_SYMLINK_TREE_FLAVOR);
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", buildTarget.getFullyQualifiedName());
    result.assertSuccess();
    Path projectRoot = tmp.getRoot().toRealPath();
    Path inputPath = projectRoot.resolve(buildTarget.getBasePath());
    Path outputPath = projectRoot.resolve(BuildTargets.getGenPath(filesystem, buildTarget, "%s"));
    assertIsSymbolicLink(outputPath.resolve("Header.h"), inputPath.resolve("Header.h"));
    assertIsSymbolicLink(outputPath.resolve("TestApp/Header.h"), inputPath.resolve("Header.h"));
}
Also used : Path(java.nio.file.Path) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildTarget(com.facebook.buck.model.BuildTarget) Test(org.junit.Test)

Aggregations

ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)747 Test (org.junit.Test)726 Path (java.nio.file.Path)219 BuildTarget (com.facebook.buck.model.BuildTarget)177 ProcessResult (com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult)127 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)89 Matchers.containsString (org.hamcrest.Matchers.containsString)50 BuckBuildLog (com.facebook.buck.testutil.integration.BuckBuildLog)47 ProcessExecutor (com.facebook.buck.util.ProcessExecutor)35 ZipInspector (com.facebook.buck.testutil.integration.ZipInspector)21 HumanReadableException (com.facebook.buck.util.HumanReadableException)14 OcamlRuleBuilder.createStaticLibraryBuildTarget (com.facebook.buck.ocaml.OcamlRuleBuilder.createStaticLibraryBuildTarget)13 TestConsole (com.facebook.buck.testutil.TestConsole)12 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)10 DefaultProcessExecutor (com.facebook.buck.util.DefaultProcessExecutor)10 Cell (com.facebook.buck.rules.Cell)9 TestContext (com.facebook.buck.testutil.integration.TestContext)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)9 MappedByteBuffer (java.nio.MappedByteBuffer)9 FileChannel (java.nio.channels.FileChannel)9