Exemplo n.º 1
0
 private void platformLinkerFlags(ProjectWorkspace workspace, String target) throws IOException {
   workspace.runBuckBuild("//:binary_matches_default_exactly_" + target).assertSuccess();
   workspace.runBuckBuild("//:binary_matches_default_" + target).assertSuccess();
   ProjectWorkspace.ProcessResult result = workspace.runBuckBuild("//:binary_no_match_" + target);
   result.assertFailure();
   assertThat(result.getStderr(), Matchers.containsString("reference"));
   workspace.runBuckBuild("//:binary_with_library_matches_default_" + target).assertSuccess();
   workspace
       .runBuckBuild("//:binary_with_prebuilt_library_matches_default_" + target)
       .assertSuccess();
 }
Exemplo n.º 2
0
 @Test
 public void platformPreprocessorFlags() throws IOException {
   ProjectWorkspace workspace =
       TestDataHelper.createProjectWorkspaceForScenario(this, "platform_preprocessor_flags", tmp);
   workspace.setUp();
   workspace.runBuckBuild("//:binary_matches_default_exactly").assertSuccess();
   workspace.runBuckBuild("//:binary_matches_default").assertSuccess();
   ProjectWorkspace.ProcessResult result = workspace.runBuckBuild("//:binary_no_match");
   result.assertFailure();
   assertThat(result.getStderr(), Matchers.containsString("#error"));
   workspace.runBuckBuild("//:binary_with_library_matches_default").assertSuccess();
 }
Exemplo n.º 3
0
  @Test
  public void buildABinaryIfACxxBinaryTransitivelyDepOnlyDeclaresHeaders() throws IOException {
    ProjectWorkspace workspace =
        TestDataHelper.createProjectWorkspaceForScenario(this, "cxx_binary_headers_only", tmp);
    workspace.setUp();

    ProjectWorkspace.ProcessResult result = workspace.runBuckBuild("//:transitive");
    System.out.println(result.getStdout());
    System.err.println(result.getStderr());

    result.assertSuccess();
  }
Exemplo n.º 4
0
 @Test
 public void platformSources() throws IOException {
   ProjectWorkspace workspace =
       TestDataHelper.createProjectWorkspaceForScenario(this, "platform_sources", tmp);
   workspace.setUp();
   workspace.writeContentsToPath("[cxx]\n  cxxflags = -Wall -Werror", ".buckconfig");
   workspace.runBuckBuild("//:binary_matches_default_exactly").assertSuccess();
   workspace.runBuckBuild("//:binary_matches_default").assertSuccess();
   ProjectWorkspace.ProcessResult result = workspace.runBuckBuild("//:binary_no_match");
   result.assertFailure();
   assertThat(result.getStderr(), Matchers.containsString("answer()"));
   workspace.runBuckBuild("//:binary_with_library_matches_default").assertSuccess();
 }
  @Test
  public void shouldPrintNeededSymbolsFromBuild() throws IOException {
    ProjectWorkspace workspace =
        TestDataHelper.createProjectWorkspaceForScenario(this, "symbol_finder", temporaryFolder);
    workspace.setUp();

    ProjectWorkspace.ProcessResult processResult = workspace.runBuckBuild("//java/com/example/b:b");
    processResult.assertFailure("Build with missing dependencies should fail.");

    String expectedDependencyOutput =
        String.format(
            "%s (:b) is missing deps:\n" + "    ':moreb',\n" + "    '//java/com/example/a:a',\n",
            Paths.get("java/com/example/b/BUCK"));

    assertThat(
        "Output should describe the missing dependency.",
        processResult.getStderr(),
        containsString(expectedDependencyOutput));
  }
Exemplo n.º 6
0
  @Test
  public void resolveHeadersBehindSymlinkTreesInError() throws IOException {
    ProjectWorkspace workspace =
        TestDataHelper.createProjectWorkspaceForScenario(this, "resolved", tmp);
    workspace.setUp();

    workspace.writeContentsToPath("#invalid_pragma", "lib2.h");

    BuildTarget target = BuildTargetFactory.newInstance("//:bin");
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.toString());
    result.assertFailure();

    // Verify that the preprocessed source contains no references to the symlink tree used to
    // setup the headers.
    String error = result.getStderr();
    assertThat(error, Matchers.not(Matchers.containsString(BuckConstant.SCRATCH_DIR)));
    assertThat(error, Matchers.not(Matchers.containsString(BuckConstant.GEN_DIR)));
    assertThat(error, Matchers.containsString("In file included from lib1.h:1"));
    assertThat(error, Matchers.containsString("from bin.h:1"));
    assertThat(error, Matchers.containsString("from bin.cpp:1:"));
    assertThat(error, Matchers.containsString("lib2.h:1:2: error: invalid preprocessing"));
  }