use of com.dd.plist.NSObject 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.dd.plist.NSObject in project buck by facebook.
the class ProvisioningProfileStoreTest method testEntitlementKeysAreMatched.
@Test
public void testEntitlementKeysAreMatched() throws Exception {
final NSString[] fakeKeychainAccessGroups = { new NSString("AAAAAAAAAA.*") };
final NSArray fakeKeychainAccessGroupsArray = new NSArray(fakeKeychainAccessGroups);
ImmutableMap<String, NSObject> fakeDevelopmentEntitlements = ImmutableMap.of("keychain-access-groups", fakeKeychainAccessGroupsArray, "aps-environment", new NSString("development"), "com.apple.security.application-groups", new NSArray(new NSString("foo"), new NSString("bar")));
ImmutableMap<String, NSObject> fakeProductionEntitlements = ImmutableMap.of("keychain-access-groups", fakeKeychainAccessGroupsArray, "aps-environment", new NSString("production"), "com.apple.security.application-groups", new NSArray(new NSString("foo"), new NSString("bar"), new NSString("baz")));
ProvisioningProfileMetadata expected = makeTestMetadata("AAAAAAAAAA.com.facebook.test", new Date(Long.MAX_VALUE), "11111111-1111-1111-1111-111111111111", fakeProductionEntitlements);
ProvisioningProfileStore profiles = ProvisioningProfileStore.fromProvisioningProfiles(ImmutableList.of(makeTestMetadata("AAAAAAAAAA.com.facebook.test", new Date(Long.MAX_VALUE), "00000000-0000-0000-0000-000000000000", fakeDevelopmentEntitlements), expected));
Optional<ProvisioningProfileMetadata> actual = profiles.getBestProvisioningProfile("com.facebook.test", ApplePlatform.IPHONEOS, Optional.of(ImmutableMap.of("keychain-access-groups", fakeKeychainAccessGroupsArray, "aps-environment", new NSString("production"), "com.apple.security.application-groups", new NSArray(new NSString("foo"), new NSString("bar")))), ProvisioningProfileStore.MATCH_ANY_IDENTITY);
assertThat(actual.get(), is(equalTo(expected)));
actual = profiles.getBestProvisioningProfile("com.facebook.test", ApplePlatform.IPHONEOS, Optional.of(ImmutableMap.of("keychain-access-groups", fakeKeychainAccessGroupsArray, "aps-environment", new NSString("production"), "com.apple.security.application-groups", new NSArray(new NSString("foo"), new NSString("xxx")))), ProvisioningProfileStore.MATCH_ANY_IDENTITY);
assertFalse(actual.isPresent());
// Test without keychain access groups.
actual = profiles.getBestProvisioningProfile("com.facebook.test", ApplePlatform.IPHONEOS, Optional.of(ImmutableMap.of("aps-environment", new NSString("production"), "com.apple.security.application-groups", new NSArray(new NSString("foo"), new NSString("bar")))), ProvisioningProfileStore.MATCH_ANY_IDENTITY);
assertThat(actual.get(), is(equalTo(expected)));
actual = profiles.getBestProvisioningProfile("com.facebook.test", ApplePlatform.IPHONEOS, Optional.of(ImmutableMap.of("aps-environment", new NSString("production"), "com.apple.security.application-groups", new NSArray(new NSString("foo"), new NSString("xxx")))), ProvisioningProfileStore.MATCH_ANY_IDENTITY);
assertFalse(actual.isPresent());
}
use of com.dd.plist.NSObject in project buck by facebook.
the class WorkspaceGeneratorTest method workspaceDisablesSchemeAutoCreation.
@Test
public void workspaceDisablesSchemeAutoCreation() throws Exception {
Path workspacePath = generator.writeWorkspace();
Optional<String> settings = projectFilesystem.readFileIfItExists(workspacePath.resolve("xcshareddata/WorkspaceSettings.xcsettings"));
assertThat(settings.isPresent(), equalTo(true));
NSObject object = PropertyListParser.parse(settings.get().getBytes(Charsets.UTF_8));
assertThat(object, instanceOf(NSDictionary.class));
NSObject autocreate = ((NSDictionary) object).get("IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded");
assertThat(autocreate, instanceOf(NSNumber.class));
assertThat((NSNumber) autocreate, equalTo(new NSNumber(false)));
}
use of com.dd.plist.NSObject in project robovm by robovm.
the class IOSTarget method createInfoPList.
protected void createInfoPList(File dir) throws IOException {
NSDictionary dict = new NSDictionary();
if (config.getIosInfoPList() != null && config.getIosInfoPList().getDictionary() != null) {
NSDictionary infoPListDict = config.getIosInfoPList().getDictionary();
for (String key : infoPListDict.allKeys()) {
dict.put(key, infoPListDict.objectForKey(key));
}
} else {
dict.put("CFBundleVersion", "1.0");
dict.put("CFBundleExecutable", config.getExecutableName());
dict.put("CFBundleName", config.getExecutableName());
dict.put("CFBundleIdentifier", getBundleId());
dict.put("CFBundlePackageType", "APPL");
dict.put("LSRequiresIPhoneOS", true);
NSObject supportedDeviceFamilies = sdk.getDefaultProperty("SUPPORTED_DEVICE_FAMILIES");
if (supportedDeviceFamilies != null) {
// SUPPORTED_DEVICE_FAMILIES is either a NSString of comma
// separated numbers
// or an NSArray with NSStrings. UIDeviceFamily values should be
// NSNumbers.
NSArray families = null;
if (supportedDeviceFamilies instanceof NSString) {
NSString defFamilies = (NSString) supportedDeviceFamilies;
String[] parts = defFamilies.toString().split(",");
families = new NSArray(parts.length);
for (int i = 0; i < families.count(); i++) {
families.setValue(i, new NSNumber(parts[i].trim()));
}
} else {
NSArray defFamilies = (NSArray) supportedDeviceFamilies;
families = new NSArray(defFamilies.count());
for (int i = 0; i < families.count(); i++) {
families.setValue(i, new NSNumber(defFamilies.objectAtIndex(i).toString()));
}
}
dict.put("UIDeviceFamily", families);
}
dict.put("UISupportedInterfaceOrientations", new NSArray(new NSString("UIInterfaceOrientationPortrait"), new NSString("UIInterfaceOrientationLandscapeLeft"), new NSString("UIInterfaceOrientationLandscapeRight"), new NSString("UIInterfaceOrientationPortraitUpsideDown")));
dict.put("UISupportedInterfaceOrientations~ipad", new NSArray(new NSString("UIInterfaceOrientationPortrait"), new NSString("UIInterfaceOrientationLandscapeLeft"), new NSString("UIInterfaceOrientationLandscapeRight"), new NSString("UIInterfaceOrientationPortraitUpsideDown")));
dict.put("UIRequiredDeviceCapabilities", new NSArray(new NSString("armv7")));
}
dict.put("DTPlatformName", sdk.getPlatformName());
dict.put("DTSDKName", sdk.getCanonicalName());
for (File f : FileUtils.listFiles(partialPListDir, new String[] { "plist" }, false)) {
try {
NSDictionary d = (NSDictionary) PropertyListParser.parse(f);
dict.putAll(d);
} catch (Exception e) {
throw new CompilerException(e);
}
}
if (dict.objectForKey("MinimumOSVersion") == null) {
// This is required
dict.put("MinimumOSVersion", "6.0");
}
customizeInfoPList(dict);
/*
* Make sure CFBundleShortVersionString and CFBundleVersion are at the
* top of the Info.plist file to avoid the "Could not hardlink copy"
* problem when launching on the simulator. com.dd.plist maintains the
* insertion order of keys so we rebuild the dictionary here and make
* sure those two keys are inserted first. See #771.
*/
NSDictionary newDict = new NSDictionary();
if (dict.objectForKey("CFBundleShortVersionString") != null) {
newDict.put("CFBundleShortVersionString", dict.objectForKey("CFBundleShortVersionString"));
dict.remove("CFBundleShortVersionString");
}
if (dict.objectForKey("CFBundleVersion") != null) {
newDict.put("CFBundleVersion", dict.objectForKey("CFBundleVersion"));
dict.remove("CFBundleVersion");
}
for (String key : dict.allKeys()) {
newDict.put(key, dict.objectForKey(key));
}
File tmpInfoPlist = new File(config.getTmpDir(), "Info.plist");
PropertyListParser.saveAsBinary(newDict, tmpInfoPlist);
config.getLogger().info("Installing Info.plist to %s", dir);
FileUtils.copyFile(tmpInfoPlist, new File(dir, tmpInfoPlist.getName()));
}
use of com.dd.plist.NSObject in project robovm by robovm.
the class InstallationProxyClientTest method testBrowse.
@Test
public void testBrowse() throws Exception {
NSArray array = client.browse();
NSDictionary safari = null;
for (int i = 0; i < array.count(); i++) {
NSDictionary dict = (NSDictionary) array.objectAtIndex(i);
NSObject v = dict.objectForKey("CFBundleIdentifier");
if (v != null && "com.apple.mobilesafari".equals(v.toString())) {
safari = dict;
}
}
assertNotNull(safari);
}
Aggregations