use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class DefaultJavaLibraryIntegrationTest method testClassUsageFileOutputProperly.
@Test
public void testClassUsageFileOutputProperly() throws IOException {
workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "class_usage_file", tmp);
workspace.setUp();
// Run `buck build`.
BuildTarget bizTarget = BuildTargetFactory.newInstance("//:biz");
ProcessResult buildResult = workspace.runBuckCommand("build", bizTarget.getFullyQualifiedName());
buildResult.assertSuccess("Successful build should exit with 0.");
Path bizClassUsageFilePath = BuildTargets.getGenPath(filesystem, bizTarget, "lib__%s__output/used-classes.json");
final List<String> lines = Files.readAllLines(workspace.getPath(bizClassUsageFilePath), UTF_8);
assertEquals("Expected just one line of JSON", 1, lines.size());
final String utilJarPath = MorePaths.pathWithPlatformSeparators("buck-out/gen/lib__util__output/util.jar");
final String utilClassPath = MorePaths.pathWithPlatformSeparators("com/example/Util.class");
ObjectMapper objectMapper = ObjectMappers.newDefaultInstance();
JsonNode jsonNode = objectMapper.readTree(lines.get(0));
assertThat(jsonNode, new HasJsonField(objectMapper, utilJarPath, Matchers.equalTo(objectMapper.valueToTree(new String[] { utilClassPath }))));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class AndroidBinaryFlavorsIntegrationTest method testPackageStringAssetsFlavorOutput.
@Test
public void testPackageStringAssetsFlavorOutput() throws IOException {
String target = "//apps/sample:app_comp_str#package_string_assets";
ProjectFilesystem filesystem = new FakeProjectFilesystem();
ProcessResult result = workspace.runBuckCommand("targets", "--show-output", target);
Path path = BuildTargets.getScratchPath(filesystem, BuildTargetFactory.newInstance(target), PackageStringAssets.STRING_ASSETS_DIR_FORMAT);
result.assertSuccess();
assertThat(result.getStdout().trim().split(" ")[1], equalTo(path.toString()));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class AndroidBinaryFlavorsIntegrationTest method testPackageStringsOnlyFlavorOutput.
@Test
public void testPackageStringsOnlyFlavorOutput() throws IOException {
String target = "//apps/sample:app_str#package_string_assets";
ProjectFilesystem filesystem = new FakeProjectFilesystem();
ProcessResult result = workspace.runBuckCommand("targets", "--show-output", target);
Path path = BuildTargets.getScratchPath(filesystem, BuildTargetFactory.newInstance(target), PackageStringAssets.STRING_ASSETS_DIR_FORMAT);
result.assertSuccess();
assertThat(result.getStdout().trim().split(" ")[1], equalTo(path.toString()));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class AndroidLibraryIntegrationTest method testAndroidKotlinBinaryDoesNotUseTransitiveResources.
@Test
public void testAndroidKotlinBinaryDoesNotUseTransitiveResources() throws IOException {
AssumeAndroidPlatform.assumeSdkIsAvailable();
KotlinTestAssumptions.assumeCompilerAvailable();
ProcessResult result = workspace.runBuckBuild("//kotlin/com/sample/lib:lib_using_transitive_empty_res");
result.assertFailure();
assertTrue(result.getStderr().contains("unresolved reference: R"));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class AndroidLibraryIntegrationTest method testAndroidScalaLibraryDoesNotUseTransitiveResources.
@Test(timeout = (3 * 60 * 1000))
public void testAndroidScalaLibraryDoesNotUseTransitiveResources() throws IOException {
AssumeAndroidPlatform.assumeSdkIsAvailable();
ProcessResult result = workspace.runBuckBuild("//scala/com/sample/lib:lib_using_transitive_empty_res");
result.assertFailure();
assertTrue(result.getStderr().contains("not found: value R"));
}
Aggregations