use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class AndroidResourceFilterIntegrationTest method testModifyingImageRebuildsResourcesFilter.
@Test
public void testModifyingImageRebuildsResourcesFilter() throws IOException {
String target = "//apps/sample:app_mdpi";
ProjectWorkspace.ProcessResult result = workspace.runBuckBuild(target);
result.assertSuccess();
Path apkFile = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(target), "%s.apk"));
String iconPath = isBuildToolsNew ? "res/drawable-mdpi-v4/app_icon.png" : "res/drawable-mdpi/app_icon.png";
long firstImageCrc = new ZipInspector(apkFile).getCrc(iconPath);
workspace.copyFile("res/com/sample/base/res/drawable-hdpi/app_icon.png", "res/com/sample/base/res/drawable-mdpi/app_icon.png");
workspace.resetBuildLogFile();
result = workspace.runBuckBuild(target);
result.assertSuccess();
BuckBuildLog buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally(target);
apkFile = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(target), "%s.apk"));
long secondImageCrc = new ZipInspector(apkFile).getCrc(iconPath);
assertNotEquals(firstImageCrc, secondImageCrc);
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class AndroidResourceLibraryDepIntegrationTest method testModifyingLibraryDependencyDoesNotCauseRebuilt.
@Test
public void testModifyingLibraryDependencyDoesNotCauseRebuilt() throws IOException {
AssumeAndroidPlatform.assumeSdkIsAvailable();
String appTarget = "//apps/sample:app_res_lib_dep";
String resTarget = "//res/com/sample/base:base_with_lib_dep";
String libTarget = "//java/com/sample/small:small";
// Do the initial resource build.
ProjectWorkspace.ProcessResult first = workspace.runBuckCommand("build", appTarget);
first.assertSuccess();
// Verify that the resource and library dependency were successfully built.
BuckBuildLog firstBuildLog = workspace.getBuildLog();
firstBuildLog.assertTargetBuiltLocally(appTarget);
firstBuildLog.assertTargetBuiltLocally(resTarget);
firstBuildLog.assertTargetBuiltLocally(libTarget);
// Update the java library dependency, which will force it to be rebuilt.
workspace.replaceFileContents("java/com/sample/small/Sample.java", "savedInstanceState", "savedInstanceState2");
workspace.resetBuildLogFile();
// Re-run the build, which should just rebuild the java library.
ProjectWorkspace.ProcessResult second = workspace.runBuckCommand("build", appTarget);
second.assertSuccess();
// Now verify that just the library and top-level binary got rebuilt.
BuckBuildLog secondBuildLog = workspace.getBuildLog();
secondBuildLog.assertTargetBuiltLocally(appTarget);
secondBuildLog.assertTargetHadMatchingRuleKey(resTarget);
secondBuildLog.assertTargetBuiltLocally(libTarget);
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class FetchCommandIntegrationTest method shouldBuildNothingIfThereAreNoFetchableRules.
@Test
public void shouldBuildNothingIfThereAreNoFetchableRules() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "fetch_nothing", temp);
workspace.setUp();
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("fetch", "//:example");
result.assertSuccess();
BuckBuildLog log = workspace.getBuildLog();
ImmutableSet<BuildTarget> allTargets = log.getAllTargets();
assertFalse(allTargets.contains(BuildTargetFactory.newInstance(workspace.getDestPath(), "//:example")));
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class FetchCommandIntegrationTest method shouldOnlyExecuteDownloadableTargets.
@Test
public void shouldOnlyExecuteDownloadableTargets() throws IOException, URISyntaxException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "fetch_concrete", temp);
workspace.setUp();
// We don't know the URL of the file beforehand. Fix that.
addRemoteFileTarget(workspace);
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("fetch", "//:needs-download");
result.assertSuccess();
BuckBuildLog log = workspace.getBuildLog();
ImmutableSet<BuildTarget> allTargets = log.getAllTargets();
assertTrue(allTargets.contains(BuildTargetFactory.newInstance(workspace.getDestPath(), "//:remote")));
assertFalse(allTargets.contains(BuildTargetFactory.newInstance(workspace.getDestPath(), "//:needs-download")));
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class CxxPrecompiledHeaderRuleTest method changingHeaderIncludedByPCHPrefixHeaderCausesRecompile.
@Test
public void changingHeaderIncludedByPCHPrefixHeaderCausesRecompile() throws Exception {
assumeTrue(platformOkForPCHTests());
BuckBuildLog buildLog;
workspace.writeContentsToPath("#define TESTVALUE 50\n", "recompile_after_include_changed/included_by_pch.h");
workspace.runBuckBuild("//recompile_after_include_changed:main#default").assertSuccess();
buildLog = workspace.getBuildLog();
assertThat(buildLog, reportedTargetSuccessType(findPchTarget(), BuildRuleSuccessType.BUILT_LOCALLY));
assertThat(buildLog, reportedTargetSuccessType(workspace.newBuildTarget("//recompile_after_include_changed:main#binary,default"), BuildRuleSuccessType.BUILT_LOCALLY));
assertEquals(workspace.runCommand(workspace.resolve(BuildTargets.getGenPath(filesystem, workspace.newBuildTarget("//recompile_after_include_changed:main#default"), "%s")).toString()).getExitCode(), 50);
workspace.resetBuildLogFile();
workspace.writeContentsToPath("#define TESTVALUE 51\n", "recompile_after_include_changed/included_by_pch.h");
workspace.runBuckBuild("//recompile_after_include_changed:main#default").assertSuccess();
buildLog = workspace.getBuildLog();
assertThat(buildLog, reportedTargetSuccessType(findPchTarget(), BuildRuleSuccessType.BUILT_LOCALLY));
assertThat(buildLog, reportedTargetSuccessType(workspace.newBuildTarget("//recompile_after_include_changed:main#binary,default"), BuildRuleSuccessType.BUILT_LOCALLY));
assertEquals(workspace.runCommand(workspace.resolve(BuildTargets.getGenPath(filesystem, workspace.newBuildTarget("//recompile_after_include_changed:main#default"), "%s")).toString()).getExitCode(), 51);
}
Aggregations