Search in sources :

Example 71 with ProjectWorkspace

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

the class PrebuiltAppleFrameworkIntegrationTest method testPrebuiltAppleFrameworkCopiedToBundle.

@Test
public void testPrebuiltAppleFrameworkCopiedToBundle() throws IOException, InterruptedException {
    assumeTrue(Platform.detect() == Platform.MACOS);
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "prebuilt_apple_framework_links", tmp);
    workspace.setUp();
    ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
    BuildTarget target = BuildTargetFactory.newInstance("//app:TestAppBundle#dwarf-and-dsym,include-frameworks");
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
    result.assertSuccess();
    Path includedFramework = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s")).resolve("TestAppBundle.app").resolve("Frameworks").resolve("BuckTest.framework");
    assertTrue(Files.isDirectory(includedFramework));
}
Also used : Path(java.nio.file.Path) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildTarget(com.facebook.buck.model.BuildTarget) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) Test(org.junit.Test)

Example 72 with ProjectWorkspace

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

the class CustomAutodepsIntegrationTest method useCustomAutodepsForPythonRules.

/**
   * Tests a case where a set of {@code python_library()} and {@code python_binary()} rules specify
   * {@code autodeps=True} to load their {@code deps} from a {@code BUCK.autodeps} file that is
   * generated by something other than {@code buck autodeps}. This ensures that external users can
   * perform their own experiments with auto-generating dependencies.
   */
@Test
public void useCustomAutodepsForPythonRules() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "custom_autodeps", tmpFolder);
    workspace.setUp();
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("run", "//:app");
    result.assertSuccess();
    assertEquals("If the dependencies were loaded correctly, main.py should load code from lib1.py.", "Hello!", result.getStdout().trim());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) Test(org.junit.Test)

Example 73 with ProjectWorkspace

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

the class ProjectIntegrationTest method testGeneratingWorkspaceForXcodeWithoutSettingIde.

@Test
public void testGeneratingWorkspaceForXcodeWithoutSettingIde() throws IOException {
    // .buckconfig has no ide set, so buck should correctly guess that
    // apple_stuff requires Xcode workspace
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "generating_workspace_for_xcode_without_setting_ide", temporaryFolder);
    workspace.setUp();
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("project", "//App:TestAppBinary");
    result.assertSuccess();
    String workspacePathString = temporaryFolder.getRoot().toString();
    workspacePathString += "/App/TestAppBinary.xcworkspace";
    Path workspacePath = temporaryFolder.getRoot().resolve(workspacePathString);
    assertThat(Files.exists(workspacePath), Matchers.equalTo(true));
}
Also used : Path(java.nio.file.Path) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) Test(org.junit.Test)

Example 74 with ProjectWorkspace

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

the class ProjectIntegrationTest method generatingAllWorkspacesWillNotIncludeAllProjectsInEachOfThem.

@Test
public void generatingAllWorkspacesWillNotIncludeAllProjectsInEachOfThem() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "generating_all_workspaces_will_not_include_all_projects_in_each_of_them", temporaryFolder);
    workspace.setUp();
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("project");
    result.assertSuccess();
    workspace.verify();
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) Test(org.junit.Test)

Example 75 with ProjectWorkspace

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

the class ProjectIntegrationTest method testGeneratesWorkspaceFromLibrary.

@Test
public void testGeneratesWorkspaceFromLibrary() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "project_implicit_workspace_generation", temporaryFolder);
    workspace.setUp();
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("project", "//lib:lib");
    result.assertSuccess();
    Files.exists(workspace.resolve("lib/lib.xcworkspace/contents.xcworkspacedata"));
    Files.exists(workspace.resolve("lib/lib.xcodeproj/project.pbxproj"));
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) 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