use of com.dd.plist.NSString in project buck by facebook.
the class XcodeprojSerializerTest method testEmptyProject.
@Test
public void testEmptyProject() {
PBXProject project = new PBXProject("TestProject");
XcodeprojSerializer xcodeprojSerializer = new XcodeprojSerializer(new GidGenerator(ImmutableSet.of()), project);
NSDictionary rootObject = xcodeprojSerializer.toPlist();
assertEquals(project.getGlobalID(), ((NSString) rootObject.get("rootObject")).getContent());
NSDictionary objects = ((NSDictionary) rootObject.get("objects"));
NSDictionary projectObject = (NSDictionary) objects.get(project.getGlobalID());
String[] requiredKeys = { "mainGroup", "targets", "buildConfigurationList", "compatibilityVersion", "attributes" };
for (String key : requiredKeys) {
assertTrue(projectObject.containsKey(key));
}
}
use of com.dd.plist.NSString in project buck by facebook.
the class PBXShellScriptBuildPhase method serializeInto.
@Override
public void serializeInto(XcodeprojSerializer s) {
super.serializeInto(s);
NSArray inputPathsArray = new NSArray(inputPaths.size());
for (int i = 0; i < inputPaths.size(); i++) {
inputPathsArray.setValue(i, new NSString(inputPaths.get(i)));
}
s.addField("inputPaths", inputPathsArray);
NSArray outputPathsArray = new NSArray(outputPaths.size());
for (int i = 0; i < outputPaths.size(); i++) {
outputPathsArray.setValue(i, new NSString(outputPaths.get(i)));
}
s.addField("outputPaths", outputPathsArray);
NSString shellPathString;
if (shellPath == null) {
shellPathString = DEFAULT_SHELL_PATH;
} else {
shellPathString = new NSString(shellPath);
}
s.addField("shellPath", shellPathString);
NSString shellScriptString;
if (shellScript == null) {
shellScriptString = DEFAULT_SHELL_SCRIPT;
} else {
shellScriptString = new NSString(shellScript);
}
s.addField("shellScript", shellScriptString);
}
use of com.dd.plist.NSString in project buck by facebook.
the class AppleBundleIntegrationTest method simpleApplicationBundleWithDryRunCodeSigning.
@Test
public void simpleApplicationBundleWithDryRunCodeSigning() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
assumeTrue(FakeAppleDeveloperEnvironment.supportsCodeSigning());
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_application_bundle_with_codesigning", tmp);
workspace.setUp();
workspace.addBuckConfigLocalOption("apple", "dry_run_code_signing", "true");
BuildTarget target = workspace.newBuildTarget("//:DemoAppWithFramework#iphoneos-arm64,no-debug");
workspace.runBuckCommand("build", target.getFullyQualifiedName()).assertSuccess();
Path appPath = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTarget.builder(target).addFlavors(AppleDescriptions.NO_INCLUDE_FRAMEWORKS_FLAVOR).build(), "%s").resolve(target.getShortName() + ".app"));
Path codeSignResultsPath = appPath.resolve("BUCK_code_sign_entitlements.plist");
assertTrue(Files.exists(codeSignResultsPath));
NSDictionary resultPlist = verifyAndParsePlist(appPath.resolve("BUCK_pp_dry_run.plist"));
assertEquals(new NSString("com.example.DemoApp"), resultPlist.get("bundle-id"));
assertEquals(new NSString("12345ABCDE"), resultPlist.get("team-identifier"));
assertEquals(new NSString("00000000-0000-0000-0000-000000000000"), resultPlist.get("provisioning-profile-uuid"));
// Codesigning main bundle
resultPlist = verifyAndParsePlist(appPath.resolve("BUCK_code_sign_args.plist"));
assertEquals(new NSNumber(true), resultPlist.get("use-entitlements"));
// Codesigning embedded framework bundle
resultPlist = verifyAndParsePlist(appPath.resolve("Frameworks/DemoFramework.framework/BUCK_code_sign_args.plist"));
assertEquals(new NSNumber(false), resultPlist.get("use-entitlements"));
}
use of com.dd.plist.NSString in project robovm by robovm.
the class AppLauncher method getAppPath.
private String getAppPath(LockdowndClient lockdowndClient, String appId) throws IOException {
LockdowndServiceDescriptor instService = lockdowndClient.startService(InstallationProxyClient.SERVICE_NAME);
try (InstallationProxyClient instClient = new InstallationProxyClient(device, instService)) {
NSArray apps = instClient.browse();
for (int i = 0; i < apps.count(); i++) {
NSDictionary appInfo = (NSDictionary) apps.objectAtIndex(i);
NSString bundleId = (NSString) appInfo.objectForKey("CFBundleIdentifier");
if (bundleId != null && appId.equals(bundleId.toString())) {
NSString path = (NSString) appInfo.objectForKey("Path");
NSDictionary entitlements = (NSDictionary) appInfo.objectForKey("Entitlements");
if (entitlements == null || entitlements.objectForKey("get-task-allow") == null || !entitlements.objectForKey("get-task-allow").equals(new NSNumber(true))) {
throw new RuntimeException("App with id '" + appId + "' does not " + "have the 'get-task-allow' entitlement and cannot be debugged");
}
if (path == null) {
throw new RuntimeException("Path for app with id '" + appId + "' not found");
}
return path.toString();
}
}
throw new RuntimeException("No app with id '" + appId + "' found on device");
}
}
use of com.dd.plist.NSString in project robovm by robovm.
the class AppLauncher method mountDeveloperImage.
private void mountDeveloperImage(LockdowndClient lockdowndClient) throws Exception {
// Find the DeveloperDiskImage.dmg path that best matches the current device. Here's what
// the paths look like:
// Platforms/iPhoneOS.platform/DeviceSupport/5.0/DeveloperDiskImage.dmg
// Platforms/iPhoneOS.platform/DeviceSupport/6.0/DeveloperDiskImage.dmg
// Platforms/iPhoneOS.platform/DeviceSupport/6.1/DeveloperDiskImage.dmg
// Platforms/iPhoneOS.platform/DeviceSupport/7.0/DeveloperDiskImage.dmg
// Platforms/iPhoneOS.platform/DeviceSupport/7.0 (11A465)/DeveloperDiskImage.dmg
// Platforms/iPhoneOS.platform/DeviceSupport/7.0.3 (11B508)/DeveloperDiskImage.dmg
// E.g. 7.0.2
String productVersion = lockdowndClient.getValue(null, "ProductVersion").toString();
// E.g. 11B508
String buildVersion = lockdowndClient.getValue(null, "BuildVersion").toString();
File deviceSupport = new File(getXcodePath(), "Platforms/iPhoneOS.platform/DeviceSupport");
log("Looking up developer disk image for iOS version %s (%s) in %s", productVersion, buildVersion, deviceSupport);
File devImage = findDeveloperImage(deviceSupport, productVersion, buildVersion);
File devImageSig = new File(devImage.getParentFile(), devImage.getName() + ".signature");
byte[] devImageSigBytes = Files.readAllBytes(devImageSig.toPath());
LockdowndServiceDescriptor mimService = lockdowndClient.startService(MobileImageMounterClient.SERVICE_NAME);
try (MobileImageMounterClient mimClient = new MobileImageMounterClient(device, mimService)) {
log("Copying developer disk image %s to device", devImage);
int majorVersion = Integer.parseInt(getProductVersionParts(productVersion)[0]);
if (majorVersion >= 7) {
// Use new upload method
mimClient.uploadImage(devImage, null, devImageSigBytes);
} else {
LockdowndServiceDescriptor afcService = lockdowndClient.startService(AfcClient.SERVICE_NAME);
try (AfcClient afcClient = new AfcClient(device, afcService)) {
afcClient.makeDirectory("/PublicStaging");
afcClient.fileCopy(devImage, "/PublicStaging/staging.dimage");
}
}
log("Mounting developer disk image");
NSDictionary result = mimClient.mountImage("/PublicStaging/staging.dimage", devImageSigBytes, null);
NSString status = (NSString) result.objectForKey("Status");
if (status == null || !"Complete".equals(status.toString())) {
throw new IOException("Failed to mount " + devImage.getAbsolutePath() + " on the device.");
}
}
}
Aggregations