use of com.facebook.buck.model.BuildTarget in project buck by facebook.
the class AppleBinaryIntegrationTest method testFlavoredAppleBundleBuildsWithDwarfDebugFormatAndBinaryIsUnstripped.
@Test
public void testFlavoredAppleBundleBuildsWithDwarfDebugFormatAndBinaryIsUnstripped() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_application_bundle_dwarf_and_dsym", tmp);
workspace.setUp();
BuildTarget target = BuildTargetFactory.newInstance("//:DemoApp#dwarf");
workspace.runBuckCommand("build", target.getFullyQualifiedName()).assertSuccess();
BuildTarget appTarget = target.withFlavors(AppleDebugFormat.DWARF.getFlavor(), AppleDescriptions.NO_INCLUDE_FRAMEWORKS_FLAVOR);
Path output = workspace.getPath(BuildTargets.getGenPath(filesystem, appTarget, "%s").resolve(target.getShortName() + ".app").resolve(target.getShortName()));
assertThat(Files.exists(output), equalTo(true));
ProcessExecutor.Result hasSymbol = workspace.runCommand("nm", output.toString());
String stdout = hasSymbol.getStdout().orElse("");
assertThat(stdout, containsString("t -[AppDelegate window]"));
assertThat(stdout, containsString("U _UIApplicationMain"));
}
use of com.facebook.buck.model.BuildTarget in project buck by facebook.
the class AppleBinaryIntegrationTest method testAppleBinaryUsesDefaultsFromArgs.
@Test
public void testAppleBinaryUsesDefaultsFromArgs() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_binary_with_platform", tmp);
workspace.setUp();
BuildTarget target = BuildTargetFactory.newInstance("//Apps/TestApp:TestApp").withAppendedFlavors(InternalFlavor.of("iphoneos-arm64"));
workspace.runBuckCommand("build", target.getFullyQualifiedName()).assertSuccess();
Path outputPath = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"));
assertThat(Files.exists(outputPath), is(true));
assertThat(Files.exists(Paths.get(outputPath.toString() + "-LinkMap.txt")), is(true));
assertThat(workspace.runCommand("file", outputPath.toString()).getStdout().get(), containsString("executable"));
assertThat(workspace.runCommand("otool", "-hv", outputPath.toString()).getStdout().get(), containsString("ARM64"));
}
use of com.facebook.buck.model.BuildTarget in project buck by facebook.
the class AppleBinaryIntegrationTest method testAppleBinaryBuildsBinaryWithoutLinkerMap.
@Test
public void testAppleBinaryBuildsBinaryWithoutLinkerMap() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_binary_builds_something", tmp);
workspace.setUp();
BuildTarget target = BuildTargetFactory.newInstance("//Apps/TestApp:TestApp").withFlavors(LinkerMapMode.NO_LINKER_MAP.getFlavor());
workspace.runBuckCommand("build", target.getFullyQualifiedName()).assertSuccess();
Path outputPath = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"));
assertThat(Files.exists(outputPath), is(true));
assertThat(Files.exists(Paths.get(outputPath.toString() + "-LinkMap.txt")), is(false));
assertThat(workspace.runCommand("file", outputPath.toString()).getStdout().get(), containsString("executable"));
}
use of com.facebook.buck.model.BuildTarget in project buck by facebook.
the class NdkCxxPlatformIntegrationTest method testWorkingDirectoryAndNdkHeaderPathsAreSanitized.
@Test
public void testWorkingDirectoryAndNdkHeaderPathsAreSanitized() throws IOException {
ProjectWorkspace workspace = setupWorkspace("ndk_debug_paths");
workspace.writeContentsToPath("[ndk]\n" + " cpu_abis = arm, armv7, arm64, x86, x86_64\n" + " gcc_version = 4.9\n" + " app_platform = android-21\n", ".buckconfig");
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
BuildTarget target = BuildTargetFactory.newInstance(String.format("//:lib#android-%s,static", arch));
workspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
Path lib = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s/lib" + target.getShortName() + ".a"));
String contents = MorePaths.asByteSource(lib).asCharSource(Charsets.ISO_8859_1).read();
// Verify that the working directory is sanitized.
assertFalse(contents.contains(tmp.getRoot().toString()));
// Verify that we don't have any references to the build toolchain in the debug info.
for (NdkCxxPlatforms.Host host : NdkCxxPlatforms.Host.values()) {
assertFalse(contents.contains(host.toString()));
}
// Verify that the NDK path is sanitized.
assertFalse(contents.contains(getNdkRoot().toString()));
}
use of com.facebook.buck.model.BuildTarget in project buck by facebook.
the class NdkLibraryDescriptionTest method transitiveCxxLibraryDepsBecomeFirstOrderDepsOfNdkBuildRule.
@Test
public void transitiveCxxLibraryDepsBecomeFirstOrderDepsOfNdkBuildRule() throws Exception {
BuildRuleResolver resolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(resolver));
FakeBuildRule transitiveInput = resolver.addToIndex(new FakeBuildRule("//:transitive_input", pathResolver));
transitiveInput.setOutputFile("out");
FakeNativeLinkable transitiveDep = resolver.addToIndex(new FakeNativeLinkable("//:transitive_dep", pathResolver, transitiveInput.getSourcePathToOutput()));
FakeBuildRule firstOrderInput = resolver.addToIndex(new FakeBuildRule("//:first_order_input", pathResolver));
firstOrderInput.setOutputFile("out");
FakeNativeLinkable firstOrderDep = resolver.addToIndex(new FakeNativeLinkable("//:first_order_dep", pathResolver, firstOrderInput.getSourcePathToOutput(), transitiveDep));
BuildTarget target = BuildTargetFactory.newInstance("//:rule");
BuildRule ndkLibrary = new NdkLibraryBuilder(target).addDep(firstOrderDep.getBuildTarget()).build(resolver);
assertThat(ndkLibrary.getDeps(), Matchers.allOf(Matchers.<BuildRule>hasItem(firstOrderInput), Matchers.<BuildRule>hasItem(transitiveInput)));
}
Aggregations