use of com.dd.plist.NSArray in project buck by facebook.
the class PlistProcessStepTest method testHandlesNonDictionaryPlists.
@Test
public void testHandlesNonDictionaryPlists() throws Exception {
FakeProjectFilesystem projectFilesystem = new FakeProjectFilesystem();
PlistProcessStep plistProcessStep = new PlistProcessStep(projectFilesystem, INPUT_PATH, Optional.empty(), OUTPUT_PATH, ImmutableMap.of(), ImmutableMap.of("Key1", new NSString("OverrideValue")), PlistProcessStep.OutputFormat.XML);
NSArray array = new NSArray(new NSString("Value1"), new NSString("Value2"));
projectFilesystem.writeContentsToPath(array.toXMLPropertyList(), INPUT_PATH);
ExecutionContext executionContext = TestExecutionContext.newInstance();
int errorCode = plistProcessStep.execute(executionContext).getExitCode();
assertThat(errorCode, equalTo(0));
assertThat(projectFilesystem.readFileIfItExists(OUTPUT_PATH), equalTo(Optional.of(array.toXMLPropertyList())));
}
use of com.dd.plist.NSArray 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.NSArray in project buck by facebook.
the class AbstractProvisioningProfileMetadata method prefixFromEntitlements.
/**
* Takes an ImmutableMap representing an entitlements file, returns the application prefix
* if it can be inferred from keys in the entitlement. Otherwise, it returns empty.
*/
public static Optional<String> prefixFromEntitlements(ImmutableMap<String, NSObject> entitlements) {
try {
NSArray keychainAccessGroups = ((NSArray) entitlements.get("keychain-access-groups"));
Preconditions.checkNotNull(keychainAccessGroups);
String appID = keychainAccessGroups.objectAtIndex(0).toString();
return Optional.of(splitAppID(appID).getFirst());
} catch (RuntimeException e) {
return Optional.empty();
}
}
use of com.dd.plist.NSArray in project buck by facebook.
the class XcodeprojSerializer method addField.
public void addField(String name, List<? extends PBXObject> objectList) {
NSArray array = new NSArray(objectList.size());
for (int i = 0; i < objectList.size(); i++) {
String gid = serializeObject(objectList.get(i));
array.setValue(i, new NSString(gid));
}
Preconditions.checkNotNull(currentObject).put(name, array);
}
use of com.dd.plist.NSArray in project bazel by bazelbuild.
the class XcodeprojGeneration method frameworkSearchPaths.
/**
* Returns the {@code FRAMEWORK_SEARCH_PATHS} array for a target's build config given the list of
* {@code .framework} directory paths.
*/
private static NSArray frameworkSearchPaths(Iterable<String> frameworks) {
ImmutableSet.Builder<NSString> result = new ImmutableSet.Builder<>();
for (String framework : frameworks) {
result.add(new NSString("$(WORKSPACE_ROOT)/" + Paths.get(framework).getParent()));
}
// This is needed by XcTest targets (and others, just in case) for SenTestingKit.framework.
result.add(new NSString("$(SDKROOT)/Developer/Library/Frameworks"));
// This is needed by non-XcTest targets that use XcTest.framework, for instance for test
// utility libraries packaged as an objc_library.
result.add(new NSString("$(PLATFORM_DIR)/Developer/Library/Frameworks"));
return (NSArray) NSObject.wrap(result.build().asList());
}
Aggregations