Search in sources :

Example 36 with BuckBuildLog

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

the class PrecompiledHeaderIntegrationTest method changingPrefixHeaderCausesRecompile.

@Test
public void changingPrefixHeaderCausesRecompile() throws Exception {
    assumeTrue(Platform.detect() != Platform.WINDOWS);
    workspace.runBuckBuild("//:some_binary#default").assertSuccess();
    workspace.resetBuildLogFile();
    workspace.writeContentsToPath("#pragma once\n" + "#include <stdio.h>\n" + "#include \"referenced_by_prefix_header.h\"\n" + "#include <referenced_by_prefix_header_from_dependency.h>\n" + "#define FOO 100\n", "prefix_header.h");
    workspace.runBuckBuild("//:some_binary#default").assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally(findPchTarget().toString());
    buildLog.assertTargetBuiltLocally("//:some_library#default,static");
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Example 37 with BuckBuildLog

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

the class AndroidReactNativeLibraryIntegrationTest method testEditingUnusedJSFileHitsInCache.

@Test
public void testEditingUnusedJSFileHitsInCache() throws IOException {
    workspace.enableDirCache();
    workspace.runBuckBuild("-c", "build.depfiles=cache", "//apps/sample:app").assertSuccess();
    workspace.runBuckCommand("clean");
    workspace.replaceFileContents("js/app/unused.js", "anotherFunction", "someOtherFunction");
    workspace.runBuckBuild("-c", "build.depfiles=cache", "//apps/sample:app").assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    assertThat(buildLog.getLogEntry("//js:app#bundle,dev").getSuccessType(), Matchers.equalTo(Optional.of(BuildRuleSuccessType.FETCHED_FROM_CACHE_MANIFEST_BASED)));
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Example 38 with BuckBuildLog

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

the class AndroidReactNativeLibraryIntegrationTest method testEditingImageRebuildsAndroidResource.

@Test
public void testEditingImageRebuildsAndroidResource() throws IOException {
    workspace.runBuckBuild("//apps/sample:app").assertSuccess();
    workspace.copyFile("js/app/image@1.5x.png", "js/app/image@2x.png");
    workspace.resetBuildLogFile();
    workspace.runBuckBuild("//apps/sample:app").assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally("//js:app#dev,android_res");
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Example 39 with BuckBuildLog

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

the class OCamlIntegrationTest method testLexAndYaccBuild.

@Test
public void testLexAndYaccBuild() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "ocaml", tmp);
    workspace.setUp();
    BuildTarget target = BuildTargetFactory.newInstance(workspace.getDestPath(), "//calc:calc");
    BuildTarget binary = createOcamlLinkTarget(target);
    ImmutableSet<BuildTarget> targets = ImmutableSet.of(target, binary);
    workspace.runBuckCommand("build", target.toString()).assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    assertEquals(targets, buildLog.getAllTargets());
    buildLog.assertTargetBuiltLocally(target.toString());
    buildLog.assertTargetBuiltLocally(binary.toString());
    workspace.resetBuildLogFile();
    workspace.runBuckCommand("build", target.toString()).assertSuccess();
    buildLog = workspace.getBuildLog();
    assertEquals(ImmutableSet.of(binary, target), buildLog.getAllTargets());
    buildLog.assertTargetHadMatchingRuleKey(binary.toString());
    buildLog.assertTargetHadMatchingRuleKey(target.toString());
    workspace.resetBuildLogFile();
    workspace.replaceFileContents("calc/lexer.mll", "The type token", "the type token");
    workspace.runBuckCommand("build", target.toString()).assertSuccess();
    buildLog = workspace.getBuildLog();
    assertEquals(targets, buildLog.getAllTargets());
    buildLog.assertTargetBuiltLocally(target.toString());
    buildLog.assertTargetBuiltLocally(binary.toString());
    workspace.resetBuildLogFile();
    workspace.replaceFileContents("calc/parser.mly", "the entry point", "The entry point");
    workspace.runBuckCommand("build", target.toString()).assertSuccess();
    buildLog = workspace.getBuildLog();
    assertEquals(targets, buildLog.getAllTargets());
    buildLog.assertTargetBuiltLocally(target.toString());
    buildLog.assertTargetBuiltLocally(binary.toString());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) OcamlRuleBuilder.createStaticLibraryBuildTarget(com.facebook.buck.ocaml.OcamlRuleBuilder.createStaticLibraryBuildTarget) BuildTarget(com.facebook.buck.model.BuildTarget) BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Example 40 with BuckBuildLog

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

the class OCamlIntegrationTest method testCompilerFlagsDependency.

@Test
public void testCompilerFlagsDependency() throws IOException, InterruptedException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "compiler_flag_macros", tmp);
    workspace.setUp();
    String ocamlVersion = this.getOcamlVersion(workspace);
    assumeTrue("Installed ocaml is too old for this test", "4.02.0".compareTo(ocamlVersion) <= 0);
    BuildTarget binary = BuildTargetFactory.newInstance(workspace.getDestPath(), "//:main");
    BuildTarget lib = BuildTargetFactory.newInstance(workspace.getDestPath(), "//:lib");
    BuildTarget helper = BuildTargetFactory.newInstance(workspace.getDestPath(), "//:test");
    ImmutableSet<BuildTarget> targets = ImmutableSet.of(binary, lib, helper);
    // Build the binary.
    workspace.runBuckCommand("build", binary.toString()).assertSuccess();
    // Make sure the helper target is built as well.
    BuckBuildLog buildLog = workspace.getBuildLog();
    assertTrue(buildLog.getAllTargets().containsAll(targets));
    buildLog.assertTargetBuiltLocally(binary.toString());
    // Make sure the ppx flag worked
    String out = workspace.runBuckCommand("run", binary.toString()).getStdout();
    assertEquals("42!\n", out);
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) OcamlRuleBuilder.createStaticLibraryBuildTarget(com.facebook.buck.ocaml.OcamlRuleBuilder.createStaticLibraryBuildTarget) BuildTarget(com.facebook.buck.model.BuildTarget) BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Aggregations

BuckBuildLog (com.facebook.buck.testutil.integration.BuckBuildLog)88 Test (org.junit.Test)88 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)53 BuildTarget (com.facebook.buck.model.BuildTarget)32 OcamlRuleBuilder.createStaticLibraryBuildTarget (com.facebook.buck.ocaml.OcamlRuleBuilder.createStaticLibraryBuildTarget)10 ProcessExecutor (com.facebook.buck.util.ProcessExecutor)9 Path (java.nio.file.Path)8 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)7 ExecutableFinder (com.facebook.buck.io.ExecutableFinder)2 Sha1HashCode (com.facebook.buck.util.sha1.Sha1HashCode)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)2 NSString (com.dd.plist.NSString)1 AssumeAndroidPlatform (com.facebook.buck.android.AssumeAndroidPlatform)1 ArtifactCache (com.facebook.buck.artifact_cache.ArtifactCache)1 FakeBuckConfig (com.facebook.buck.cli.FakeBuckConfig)1 CxxBuckConfig (com.facebook.buck.cxx.CxxBuckConfig)1 CxxFlavorSanitizer.sanitize (com.facebook.buck.cxx.CxxFlavorSanitizer.sanitize)1 CxxPlatform (com.facebook.buck.cxx.CxxPlatform)1