use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class DefaultJavaLibraryIntegrationTest method testAnnotationProcessorDepChangeThatDoesNotModifyAbiCausesRebuild.
@Test
public void testAnnotationProcessorDepChangeThatDoesNotModifyAbiCausesRebuild() throws IOException {
workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "annotation_processors", tmp);
workspace.setUp();
// Run `buck build` to create the dep file
BuildTarget mainTarget = BuildTargetFactory.newInstance("//:main");
// Warm the used classes file
ProcessResult buildResult = workspace.runBuckCommand("build", mainTarget.getFullyQualifiedName());
buildResult.assertSuccess("Successful build should exit with 0.");
workspace.getBuildLog().assertTargetBuiltLocally("//:main");
workspace.getBuildLog().assertTargetBuiltLocally("//:annotation_processor");
workspace.getBuildLog().assertTargetBuiltLocally("//:util");
// Edit a dependency of the annotation processor in a way that doesn't change the ABI
workspace.replaceFileContents("Util.java", "false", "true");
// Run `buck build` again.
ProcessResult buildResult2 = workspace.runBuckCommand("build", "//:main");
buildResult2.assertSuccess("Successful build should exit with 0.");
// If all goes well, we'll see //:annotation_processor's dep file on disk and not rebuild it,
// but still rebuild //:main because the code of the annotation processor has changed
workspace.getBuildLog().assertTargetBuiltLocally("//:util");
workspace.getBuildLog().assertTargetBuiltLocally("//:main");
workspace.getBuildLog().assertTargetHadMatchingInputRuleKey("//:annotation_processor_lib");
workspace.getBuildLog().assertTargetBuiltLocally("//:annotation_processor");
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class ProjectIntegrationTest method testBuckProjectSliceWithTestsDryRunShowsNoTests.
@Test
public void testBuckProjectSliceWithTestsDryRunShowsNoTests() throws IOException {
ProcessResult result = runBuckProjectWithoutVerification("project_slice_with_tests", "--deprecated-ij-generation", "--dry-run", "--without-tests", "//modules/dep1:dep1", "-v", "5");
ImmutableSortedSet<String> expectedResult = ImmutableSortedSet.of("//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);
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class ProjectIntegrationTest method testBuckProjectWithAndroidBinary.
@Test
public void testBuckProjectWithAndroidBinary() throws IOException {
ProcessResult result = runBuckProjectAndVerify("project_with_android_binary", "--deprecated-ij-generation", "-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());
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class ProjectIntegrationTest method testBuckProjectSlice.
/**
* Verify that if we build a project by specifying a target, the resulting project only contains
* the transitive deps of that target. In this example, that means everything except
* //modules/tip and //tests/tests.
*/
@Test
public void testBuckProjectSlice() throws IOException {
ProcessResult result = runBuckProjectAndVerify("project_slice", "--deprecated-ij-generation", "--without-tests", "//modules/dep1:dep1", "//:root", "-v", "5");
assertEquals("`buck project` should report the files it modified.", Joiner.on('\n').join("MODIFIED FILES:", ".idea/compiler.xml", ".idea/libraries/buck_out_gen_libs___guava___guava_jar.xml", ".idea/libraries/buck_out_gen_libs___jsr305___jsr305_jar.xml", ".idea/libraries/buck_out_gen_libs___junit___junit_jar.xml", ".idea/misc.xml", ".idea/modules.xml", ".idea/runConfigurations/Debug_Buck_test.xml", "module_.iml", "modules/dep1/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)"));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class ProjectIntegrationTest method testBuckProjectSliceWithAndroidBinary.
@Test
public void testBuckProjectSliceWithAndroidBinary() throws IOException {
ProcessResult result = runBuckProjectAndVerify("project_with_android_binary", "--deprecated-ij-generation", "-v", "5", "//apps/sample:app");
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());
}
Aggregations