use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileCopyStepTest method testFailsWithInvalidEntitlementsPlist.
@Test
public void testFailsWithInvalidEntitlementsPlist() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
thrown.expect(HumanReadableException.class);
thrown.expectMessage(startsWith("Malformed entitlement .plist: "));
ProvisioningProfileCopyStep step = new ProvisioningProfileCopyStep(projectFilesystem, testdataDir.resolve("Info.plist"), ApplePlatform.IPHONEOS, Optional.empty(), Optional.of(testdataDir.resolve("Invalid.plist")), ProvisioningProfileStore.fromSearchPath(new DefaultProcessExecutor(new TestConsole()), ProvisioningProfileStore.DEFAULT_READ_COMMAND, testdataDir), outputFile, xcentFile, codeSignIdentityStore, Optional.empty());
step.execute(executionContext);
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileCopyStepTest method testNoEntitlementsDoesNotMergeInvalidProfileKeys.
@Test
public void testNoEntitlementsDoesNotMergeInvalidProfileKeys() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProvisioningProfileCopyStep step = new ProvisioningProfileCopyStep(projectFilesystem, testdataDir.resolve("Info.plist"), ApplePlatform.IPHONEOS, Optional.of("00000000-0000-0000-0000-000000000000"), Optional.empty(), ProvisioningProfileStore.fromSearchPath(new DefaultProcessExecutor(new TestConsole()), ProvisioningProfileStore.DEFAULT_READ_COMMAND, testdataDir), outputFile, xcentFile, codeSignIdentityStore, Optional.empty());
step.execute(executionContext);
ProvisioningProfileMetadata selectedProfile = step.getSelectedProvisioningProfileFuture().get().get();
ImmutableMap<String, NSObject> profileEntitlements = selectedProfile.getEntitlements();
assertTrue(profileEntitlements.containsKey("com.apple.developer.icloud-container-development-container-identifiers"));
Optional<String> xcentContents = projectFilesystem.readFileIfItExists(xcentFile);
assertTrue(xcentContents.isPresent());
NSDictionary xcentPlist = (NSDictionary) PropertyListParser.parse(xcentContents.get().getBytes());
assertFalse(xcentPlist.containsKey("com.apple.developer.icloud-container-development-container-identifiers"));
assertEquals(xcentPlist.get("com.apple.developer.team-identifier"), profileEntitlements.get("com.apple.developer.team-identifier"));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileMetadataTest method testParseProvisioningProfileFile.
@Test
public void testParseProvisioningProfileFile() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
Path testdataDir = TestDataHelper.getTestDataDirectory(this).resolve("provisioning_profiles");
Path testFile = testdataDir.resolve("sample.mobileprovision");
ProvisioningProfileMetadata data = ProvisioningProfileMetadata.fromProvisioningProfilePath(executor, ProvisioningProfileStore.DEFAULT_READ_COMMAND, testFile);
assertThat(data.getExpirationDate(), is(equalTo(new NSDate("9999-03-05T01:33:40Z").getDate())));
assertThat(data.getAppID(), is(equalTo(new Pair<>("ABCDE12345", "com.example.TestApp"))));
assertThat(data.getUUID(), is(equalTo("00000000-0000-0000-0000-000000000000")));
assertThat(data.getProfilePath(), is(equalTo(testFile)));
assertThat(data.getDeveloperCertificateFingerprints(), equalTo(ImmutableSet.of(HashCode.fromString("be16fc419bfb6b59a86bc08755ba0f332ec574fb"))));
// Test old-style provisioning profile without "Platforms" field
data = ProvisioningProfileMetadata.fromProvisioningProfilePath(executor, ProvisioningProfileStore.DEFAULT_READ_COMMAND, testdataDir.resolve("sample_without_platforms.mobileprovision"));
assertThat(data.getDeveloperCertificateFingerprints(), equalTo(ImmutableSet.of(HashCode.fromString("be16fc419bfb6b59a86bc08755ba0f332ec574fb"))));
thrown.expect(IOException.class);
ProvisioningProfileMetadata.fromProvisioningProfilePath(executor, ProvisioningProfileStore.DEFAULT_READ_COMMAND, testdataDir.resolve("invalid.mobileprovision"));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileMetadataTest method testFilteredEntitlementsStripOut.
@Test
public void testFilteredEntitlementsStripOut() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
Path testdataDir = TestDataHelper.getTestDataDirectory(this).resolve("provisioning_profiles");
Path testFile = testdataDir.resolve("sample.mobileprovision");
ProvisioningProfileMetadata data = ProvisioningProfileMetadata.fromProvisioningProfilePath(executor, ProvisioningProfileStore.DEFAULT_READ_COMMAND, testFile);
assertTrue(data.getEntitlements().containsKey("com.apple.developer.icloud-container-development-container-identifiers"));
assertFalse(data.getMergeableEntitlements().containsKey("com.apple.developer.icloud-container-development-container-identifiers"));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class InstallCommandIntegrationTest method appleBundleInstallsAndRunsInIphoneSimulatorWithDwarfDebugging.
@Test
public void appleBundleInstallsAndRunsInIphoneSimulatorWithDwarfDebugging() throws IOException, InterruptedException {
assumeThat(Platform.detect(), is(Platform.MACOS));
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_app_bundle", tmp);
workspace.setUp();
workspace.enableDirCache();
// build locally
ProcessResult result = workspace.runBuckCommand("install", "--config", "apple.default_debug_info_format_for_binaries=DWARF", "--config", "apple.default_debug_info_format_for_libraries=DWARF", "--config", "apple.default_debug_info_format_for_tests=DWARF", "-r", "//:DemoApp");
assumeFalse(result.getStderr().contains("no appropriate simulator found"));
result.assertSuccess();
// find port to connect lldb to
// "lldb -p 12345"
Pattern p = Pattern.compile("lldb -p \\d{1,6}");
Matcher matcher = p.matcher(result.getStderr());
assertThat(matcher.find(), equalTo(true));
String[] lldbCommand = matcher.group().split(" ");
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
// run lldb session
ProcessExecutor.Result lldbResult = executor.launchAndExecute(ProcessExecutorParams.builder().addCommand(lldbCommand).build(), ImmutableSet.of(), Optional.of("b application:didFinishLaunchingWithOptions:\nb\nexit\nY\n"), Optional.empty(), Optional.empty());
assertThat(lldbResult.getExitCode(), equalTo(0));
// check that lldb resolved breakpoint locations
String lldbOutput = lldbResult.getStdout().orElse("");
assertThat(lldbOutput, containsString("Current breakpoints:"));
assertThat(lldbOutput, containsString("name = 'application:didFinishLaunchingWithOptions:', " + "locations = 1, resolved = 1, hit count = 0"));
// clean buck out
workspace.runBuckCommand("clean");
// build again - get everything from cache now
result = workspace.runBuckCommand("install", "--config", "apple.default_debug_info_format_for_binaries=DWARF", "--config", "apple.default_debug_info_format_for_libraries=DWARF", "--config", "apple.default_debug_info_format_for_tests=DWARF", "-r", "//:DemoApp");
result.assertSuccess();
matcher = p.matcher(result.getStderr());
assertThat(matcher.find(), equalTo(true));
String[] lldbCommand2 = matcher.group().split(" ");
// run lldb session again - now on top of files fetched from cache
lldbResult = executor.launchAndExecute(ProcessExecutorParams.builder().addCommand(lldbCommand2).build(), ImmutableSet.of(), Optional.of("b application:didFinishLaunchingWithOptions:\nb\nexit\nY\n"), Optional.empty(), Optional.empty());
assertThat(lldbResult.getExitCode(), equalTo(0));
// check that lldb resolved breakpoint locations with files from cache
lldbOutput = lldbResult.getStdout().orElse("");
assertThat(lldbOutput, containsString("Current breakpoints:"));
assertThat(lldbOutput, containsString("name = 'application:didFinishLaunchingWithOptions:', " + "locations = 1, resolved = 1, hit count = 0"));
}
Aggregations