Search in sources :

Example 71 with ProcessResult

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

the class ProjectIntegrationTest method testBuckProjectSliceWithProjectInDifferentBuckFile.

/**
   * Verify we can build a project by specifying a target, even if it depends on a target whose
   * project is not in the same buck file as the targets it's for.
   */
@Test
public void testBuckProjectSliceWithProjectInDifferentBuckFile() throws IOException {
    ProcessResult result = runBuckProjectAndVerify("project_slice_with_project_in_different_buck_file", "--deprecated-ij-generation", "//:root", "-v", "5");
    assertEquals("`buck project` should report the files it modified.", Joiner.on('\n').join("MODIFIED FILES:", ".idea/compiler.xml", ".idea/misc.xml", ".idea/modules.xml", ".idea/runConfigurations/Debug_Buck_test.xml", "module_.iml", "modules/module_modules_dep1.iml") + '\n', result.getStdout());
    assertThat("`buck project` should contain warning to synchronize IntelliJ.", result.getStderr(), containsString("  ::  Please resynchronize IntelliJ via File->Synchronize " + "or Cmd-Opt-Y (Mac) or Ctrl-Alt-Y (PC/Linux)"));
}
Also used : ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 72 with ProcessResult

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

the class ProjectIntegrationTest method testBuckProjectSliceDryRun.

@Test
public void testBuckProjectSliceDryRun() throws IOException {
    ProcessResult result = runBuckProjectWithoutVerification("project_slice", "--deprecated-ij-generation", "--dry-run", "--without-tests", "//modules/dep1:dep1", "//:root", "-v", "5");
    ImmutableSortedSet<String> expectedResult = ImmutableSortedSet.of("//:project_config", "//:root", "//libs:guava", "//libs:jsr305", "//libs:junit", "//modules/dep1:dep1", "//modules/dep1:project_config", "//modules/dep1:test");
    ImmutableSortedSet<String> actualResult = ImmutableSortedSet.copyOf(Splitter.on('\n').omitEmptyStrings().split(result.getStdout()));
    assertEquals("`buck project --dry-run` should print the list of targets that would be included.", expectedResult, actualResult);
}
Also used : ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 73 with ProcessResult

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

the class ProjectIntegrationTest method testBuckProjectSliceWithTestsDependenciesInDifferentBuckFile.

/**
   * Verify that if we build a project by specifying a target, the tests dependencies are
   * referenced even if they are defined in a buck file that would not have been parsed otherwise.
   */
@Test
public void testBuckProjectSliceWithTestsDependenciesInDifferentBuckFile() throws IOException {
    ProcessResult result = runBuckProjectAndVerify("project_slice_with_tests_dependencies_in_different_buck_file", "--deprecated-ij-generation", "//modules/dep1:dep1", "-v", "5");
    assertEquals("`buck project` should report the files it modified.", Joiner.on('\n').join("MODIFIED FILES:", ".idea/compiler.xml", ".idea/misc.xml", ".idea/modules.xml", ".idea/runConfigurations/Debug_Buck_test.xml", "modules/dep1/module_modules_dep1.iml", "modules/dep2/module_modules_dep2.iml", "tests/module_tests.iml") + '\n', result.getStdout());
    assertThat("`buck project` should contain warning to synchronize IntelliJ.", result.getStderr(), containsString("  ::  Please resynchronize IntelliJ via File->Synchronize " + "or Cmd-Opt-Y (Mac) or Ctrl-Alt-Y (PC/Linux)"));
}
Also used : ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 74 with ProcessResult

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

the class ProjectIntegrationTest method testBuckProjectSliceWithAndroidBinaryWithRDotJavaAutogenerationDisabled.

@Test
public void testBuckProjectSliceWithAndroidBinaryWithRDotJavaAutogenerationDisabled() throws IOException {
    ProcessResult result = runBuckProjectAndVerify("project_with_android_binary_autogeneration_disabled", "--deprecated-ij-generation", "--disable-r-java-idea-generator", "//apps/sample:app", "-v", "5");
    assertEquals("`buck project` should report the files it modified.", Joiner.on('\n').join("MODIFIED FILES:", ".idea/compiler.xml", ".idea/misc.xml", ".idea/modules.xml", ".idea/runConfigurations/Debug_Buck_test.xml", "apps/sample/module_apps_sample.iml", "java/com/sample/lib/module_java_com_sample_lib.iml", "res/com/sample/asset_only/module_res_com_sample_asset_only.iml", "res/com/sample/base/module_res_com_sample_base.iml", "res/com/sample/title/module_res_com_sample_title.iml", "res/com/sample/top/module_res_com_sample_top.iml") + '\n', result.getStdout());
}
Also used : ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 75 with ProcessResult

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

the class ProjectIntegrationTest method testBuckProjectSliceWithTestsProjectInDifferentBuckFile.

/**
   * Verify that if we build a project by specifying a target, the tests' projects rules are
   * referenced even if they are defined in a different buck file from the tests.
   */
@Test
public void testBuckProjectSliceWithTestsProjectInDifferentBuckFile() throws IOException {
    ProcessResult result = runBuckProjectAndVerify("project_slice_with_tests_project_in_different_buck_file", "--deprecated-ij-generation", "//modules/dep1:dep1", "-v", "5");
    assertEquals("`buck project` should report the files it modified.", Joiner.on('\n').join("MODIFIED FILES:", ".idea/compiler.xml", ".idea/misc.xml", ".idea/modules.xml", ".idea/runConfigurations/Debug_Buck_test.xml", "modules/dep1/module_modules_dep1.iml", "tests/module_tests_test1.iml") + '\n', result.getStdout());
    assertThat("`buck project` should contain warning to synchronize IntelliJ.", result.getStderr(), containsString("  ::  Please resynchronize IntelliJ via File->Synchronize " + "or Cmd-Opt-Y (Mac) or Ctrl-Alt-Y (PC/Linux)"));
}
Also used : ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Aggregations

ProcessResult (com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult)175 Test (org.junit.Test)174 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)127 Path (java.nio.file.Path)21 Matchers.containsString (org.hamcrest.Matchers.containsString)20 BuildTarget (com.facebook.buck.model.BuildTarget)17 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 TestContext (com.facebook.buck.testutil.integration.TestContext)4 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)3 ZipInspector (com.facebook.buck.testutil.integration.ZipInspector)3 ZipFile (java.util.zip.ZipFile)3 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)2 DelegatingInputStream (com.facebook.buck.testutil.integration.DelegatingInputStream)2 CapturingPrintStream (com.facebook.buck.util.CapturingPrintStream)2 File (java.io.File)2 Charset (java.nio.charset.Charset)2 FileTime (java.nio.file.attribute.FileTime)2 ArtifactCache (com.facebook.buck.artifact_cache.ArtifactCache)1