use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class RageCommand method runWithoutHelp.
@Override
public int runWithoutHelp(CommandRunnerParams params) throws IOException, InterruptedException {
ProjectFilesystem filesystem = params.getCell().getFilesystem();
BuckConfig buckConfig = params.getBuckConfig();
RageConfig rageConfig = RageConfig.of(buckConfig);
ProcessExecutor processExecutor = new DefaultProcessExecutor(params.getConsole());
VersionControlCmdLineInterfaceFactory vcsFactory = new DefaultVersionControlCmdLineInterfaceFactory(params.getCell().getFilesystem().getRootPath(), new PrintStreamProcessExecutorFactory(), new VersionControlBuckConfig(buckConfig), buckConfig.getEnvironment());
Optional<VcsInfoCollector> vcsInfoCollector = VcsInfoCollector.create(vcsFactory.createCmdLineInterface());
ExtraInfoCollector extraInfoCollector = new DefaultExtraInfoCollector(rageConfig, filesystem, processExecutor);
Optional<WatchmanDiagReportCollector> watchmanDiagReportCollector = WatchmanDiagReportCollector.newInstanceIfWatchmanUsed(params.getCell(), filesystem, processExecutor, new ExecutableFinder(), params.getEnvironment());
AbstractReport report;
DefaultDefectReporter reporter = new DefaultDefectReporter(filesystem, params.getObjectMapper(), rageConfig, params.getBuckEventBus(), params.getClock());
if (params.getConsole().getAnsi().isAnsiTerminal() && !nonInteractive) {
report = new InteractiveReport(reporter, filesystem, params.getObjectMapper(), params.getConsole(), params.getStdIn(), params.getBuildEnvironmentDescription(), vcsInfoCollector, rageConfig, extraInfoCollector, watchmanDiagReportCollector);
} else {
report = new AutomatedReport(reporter, filesystem, params.getObjectMapper(), params.getConsole(), params.getBuildEnvironmentDescription(), gatherVcsInfo ? vcsInfoCollector : Optional.empty(), rageConfig, extraInfoCollector);
}
Optional<DefectSubmitResult> defectSubmitResult = report.collectAndSubmitResult();
report.presentDefectSubmitResult(defectSubmitResult, showJson);
return 0;
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class AndroidBinaryIntegrationTest method testNativeRelinker.
@Test
public void testNativeRelinker() throws IOException, InterruptedException {
NdkCxxPlatform platform = AndroidNdkHelper.getNdkCxxPlatform(workspace, filesystem);
SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
Path tmpDir = tmpFolder.newFolder("xdso");
SymbolGetter syms = new SymbolGetter(new DefaultProcessExecutor(new TestConsole()), tmpDir, platform.getObjdump(), pathResolver);
Symbols sym;
Path apkPath = workspace.buildAndReturnOutput("//apps/sample:app_xdso_dce");
sym = syms.getSymbols(apkPath, "lib/x86/libnative_xdsodce_top.so");
assertTrue(sym.global.contains("_Z10JNI_OnLoadii"));
assertTrue(sym.undefined.contains("_Z10midFromTopi"));
assertTrue(sym.undefined.contains("_Z10botFromTopi"));
assertFalse(sym.all.contains("_Z6unusedi"));
sym = syms.getSymbols(apkPath, "lib/x86/libnative_xdsodce_mid.so");
assertTrue(sym.global.contains("_Z10midFromTopi"));
assertTrue(sym.undefined.contains("_Z10botFromMidi"));
assertFalse(sym.all.contains("_Z6unusedi"));
sym = syms.getSymbols(apkPath, "lib/x86/libnative_xdsodce_bot.so");
assertTrue(sym.global.contains("_Z10botFromTopi"));
assertTrue(sym.global.contains("_Z10botFromMidi"));
assertFalse(sym.all.contains("_Z6unusedi"));
// Run some verification on the same apk with native_relinker disabled.
apkPath = workspace.buildAndReturnOutput("//apps/sample:app_no_xdso_dce");
sym = syms.getSymbols(apkPath, "lib/x86/libnative_xdsodce_top.so");
assertTrue(sym.all.contains("_Z6unusedi"));
sym = syms.getSymbols(apkPath, "lib/x86/libnative_xdsodce_mid.so");
assertTrue(sym.all.contains("_Z6unusedi"));
sym = syms.getSymbols(apkPath, "lib/x86/libnative_xdsodce_bot.so");
assertTrue(sym.all.contains("_Z6unusedi"));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class CodeSignIdentityStoreTest method testCodeSignIdentitiesCommandOverride.
@Test
public void testCodeSignIdentitiesCommandOverride() throws Exception {
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
Path testdataDir = TestDataHelper.getTestDataDirectory(this).resolve("code_sign_identity_store");
CodeSignIdentityStore store = CodeSignIdentityStore.fromSystem(executor, ImmutableList.of(testdataDir.resolve("fake_identities.sh").toString()));
ImmutableList<CodeSignIdentity> expected = ImmutableList.of(CodeSignIdentity.builder().setFingerprint(CodeSignIdentity.toFingerprint("0000000000000000000000000000000000000000")).setSubjectCommonName("iPhone Developer: Fake").build());
assertThat(store.getIdentities(), is(equalTo(expected)));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileCopyStepTest method testDoesNotFailInDryRunMode.
@Test
public void testDoesNotFailInDryRunMode() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
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.of(dryRunResultFile));
Future<Optional<ProvisioningProfileMetadata>> profileFuture = step.getSelectedProvisioningProfileFuture();
step.execute(executionContext);
assertTrue(profileFuture.isDone());
assertNotNull(profileFuture.get());
assertFalse(profileFuture.get().isPresent());
Optional<String> resultContents = projectFilesystem.readFileIfItExists(dryRunResultFile);
assertTrue(resultContents.isPresent());
NSDictionary resultPlist = (NSDictionary) PropertyListParser.parse(resultContents.get().getBytes(Charsets.UTF_8));
assertEquals(new NSString("com.example.TestApp"), resultPlist.get("bundle-id"));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileCopyStepTest method shouldSetProvisioningProfileFutureWhenStepIsRun.
@Test
public void shouldSetProvisioningProfileFutureWhenStepIsRun() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
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, testdataDir), outputFile, xcentFile, codeSignIdentityStore, Optional.empty());
Future<Optional<ProvisioningProfileMetadata>> profileFuture = step.getSelectedProvisioningProfileFuture();
step.execute(executionContext);
assertTrue(profileFuture.isDone());
assertNotNull(profileFuture.get());
}
Aggregations