use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class AndroidBinaryIntegrationTest method testNativeLibraryCrossCellMerging.
@Test
public void testNativeLibraryCrossCellMerging() throws IOException, InterruptedException {
// Set up a cross-cell workspace
ProjectWorkspace secondary = TestDataHelper.createProjectWorkspaceForScenario(new AndroidBinaryIntegrationTest(), "android_project/secondary", secondaryFolder);
secondary.setUp();
NdkCxxPlatform platform = AndroidNdkHelper.getNdkCxxPlatform(workspace, filesystem);
SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
Path tmpDir = tmpFolder.newFolder("merging_tmp");
SymbolGetter syms = new SymbolGetter(new DefaultProcessExecutor(new TestConsole()), tmpDir, platform.getObjdump(), pathResolver);
SymbolsAndDtNeeded info;
TestDataHelper.overrideBuckconfig(workspace, ImmutableMap.of("ndk", ImmutableMap.of("cpu_abis", "x86"), "repositories", ImmutableMap.of("secondary", secondary.getPath(".").normalize().toString())));
workspace.replaceFileContents(workspace.getPath("apps/sample/BUCK").normalize().toString(), "#'secondary//merge:G'", "'secondary//merge:G'");
Path apkPath = workspace.buildAndReturnOutput("//apps/sample:app_with_merged_cross_cell_libs");
ZipInspector zipInspector = new ZipInspector(apkPath);
zipInspector.assertFileDoesNotExist("lib/x86/lib1a.so");
zipInspector.assertFileDoesNotExist("lib/x86/lib1b.so");
zipInspector.assertFileDoesNotExist("lib/x86/lib1g.so");
zipInspector.assertFileDoesNotExist("lib/x86/lib1h.so");
info = syms.getSymbolsAndDtNeeded(apkPath, "lib/x86/lib1.so");
assertThat(info.symbols.global, Matchers.hasItem("A"));
assertThat(info.symbols.global, Matchers.hasItem("B"));
assertThat(info.symbols.global, Matchers.hasItem("G"));
assertThat(info.symbols.global, Matchers.hasItem("H"));
assertThat(info.symbols.global, Matchers.hasItem("glue_1"));
assertThat(info.symbols.global, not(Matchers.hasItem("glue_2")));
assertThat(info.dtNeeded, not(Matchers.hasItem("libnative_merge_B.so")));
assertThat(info.dtNeeded, not(Matchers.hasItem("libmerge_G.so")));
assertThat(info.dtNeeded, not(Matchers.hasItem("libmerge_H.so")));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class BuiltinApplePackageIntegrationTest method packageSupportsFatBinaries.
@Test
public void packageSupportsFatBinaries() throws IOException, InterruptedException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_application_bundle_no_debug", tmp);
workspace.setUp();
BuildTarget packageTarget = BuildTargetFactory.newInstance("//:DemoAppPackage#iphonesimulator-i386,iphonesimulator-x86_64");
workspace.runBuckCommand("build", packageTarget.getFullyQualifiedName()).assertSuccess();
Unzip.extractZipFile(workspace.getPath(BuildTargets.getGenPath(filesystem, packageTarget, "%s.ipa")), workspace.getDestPath(), Unzip.ExistingFileMode.OVERWRITE_AND_CLEAN_DIRECTORIES);
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
ProcessExecutorParams processExecutorParams = ProcessExecutorParams.builder().setCommand(ImmutableList.of("lipo", "-info", workspace.getDestPath().resolve("Payload/DemoApp.app/DemoApp").toString())).build();
// Specify that stdout is expected, or else output may be wrapped in Ansi escape chars.
Set<ProcessExecutor.Option> options = EnumSet.of(ProcessExecutor.Option.EXPECTING_STD_OUT, ProcessExecutor.Option.IS_SILENT);
ProcessExecutor.Result result = executor.launchAndExecute(processExecutorParams, options, /* stdin */
Optional.empty(), /* timeOutMs */
Optional.empty(), /* timeOutHandler */
Optional.empty());
assertEquals(result.getExitCode(), 0);
assertTrue(result.getStdout().isPresent());
String output = result.getStdout().get();
assertTrue(output.contains("i386"));
assertTrue(output.contains("x86_64"));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class AppleNativeIntegrationTestUtils method discoverSystemSdkPaths.
private static ImmutableMap<AppleSdk, AppleSdkPaths> discoverSystemSdkPaths(BuckConfig buckConfig) {
AppleConfig appleConfig = new AppleConfig(buckConfig);
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
return appleConfig.getAppleSdkPaths(executor);
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class AppleNativeIntegrationTestUtils method isSwiftAvailable.
public static boolean isSwiftAvailable(ApplePlatform platform) {
BuckConfig buckConfig = FakeBuckConfig.builder().build();
ImmutableMap<AppleSdk, AppleSdkPaths> sdkPaths = discoverSystemSdkPaths(buckConfig);
Optional<AppleSdk> anySdkOptional = anySdkForPlatform(platform, sdkPaths);
if (!anySdkOptional.isPresent()) {
return false;
}
AppleSdk anySdk = anySdkOptional.get();
AppleCxxPlatform appleCxxPlatform = AppleCxxPlatforms.build(new FakeProjectFilesystem(), anySdk, "fakeversion", "fakearch", sdkPaths.get(anySdk), buckConfig, new AppleConfig(buckConfig), Optional.of(new DefaultProcessExecutor(Console.createNullConsole())), Optional.empty());
return appleCxxPlatform.getSwiftPlatform().isPresent();
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileCopyStepTest method testFailsWithNoSuitableProfilesFound.
@Test
public void testFailsWithNoSuitableProfilesFound() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
thrown.expect(HumanReadableException.class);
thrown.expectMessage("No valid non-expired provisioning profiles match for *.com.example.TestApp");
Path emptyDir = TestDataHelper.getTestDataDirectory(this).resolve("provisioning_profiles_empty");
ProvisioningProfileCopyStep step = new ProvisioningProfileCopyStep(projectFilesystem, testdataDir.resolve("Info.plist"), ApplePlatform.IPHONEOS, Optional.empty(), Optional.empty(), ProvisioningProfileStore.fromSearchPath(new DefaultProcessExecutor(new TestConsole()), ProvisioningProfileStore.DEFAULT_READ_COMMAND, emptyDir), outputFile, xcentFile, codeSignIdentityStore, Optional.empty());
step.execute(executionContext);
}
Aggregations