use of com.dd.plist.NSArray in project robovm by robovm.
the class IOSTarget method customizeInfoPList.
protected void customizeInfoPList(NSDictionary dict) {
if (isSimulatorArch(arch)) {
dict.put("CFBundleSupportedPlatforms", new NSArray(new NSString("iPhoneSimulator")));
} else {
dict.put("CFBundleSupportedPlatforms", new NSArray(new NSString("iPhoneOS")));
dict.put("DTPlatformVersion", sdk.getPlatformVersion());
dict.put("DTPlatformBuild", sdk.getPlatformBuild());
dict.put("DTSDKBuild", sdk.getBuild());
// them from the installed Xcode.
try {
File versionPListFile = new File(new File(ToolchainUtil.findXcodePath()).getParentFile(), "version.plist");
NSDictionary versionPList = (NSDictionary) PropertyListParser.parse(versionPListFile);
File xcodeInfoPListFile = new File(new File(ToolchainUtil.findXcodePath()).getParentFile(), "Info.plist");
NSDictionary xcodeInfoPList = (NSDictionary) PropertyListParser.parse(xcodeInfoPListFile);
NSString dtXcodeBuild = (NSString) versionPList.objectForKey("ProductBuildVersion");
if (dtXcodeBuild == null) {
throw new NoSuchElementException("No ProductBuildVersion in " + versionPListFile.getAbsolutePath());
}
NSString dtXcode = (NSString) xcodeInfoPList.objectForKey("DTXcode");
if (dtXcode == null) {
throw new NoSuchElementException("No DTXcode in " + xcodeInfoPListFile.getAbsolutePath());
}
putIfAbsent(dict, "DTXcode", dtXcode.toString());
putIfAbsent(dict, "DTXcodeBuild", dtXcodeBuild.toString());
} catch (Exception e) {
config.getLogger().warn("Failed to read DTXcodeBuild/DTXcode from current Xcode install. Will use fake values. (%s: %s)", e.getClass().getName(), e.getMessage());
}
// Fake Xcode 6.1.1 values if the above fails.
putIfAbsent(dict, "DTXcode", "0611");
putIfAbsent(dict, "DTXcodeBuild", "6A2008a");
}
}
use of com.dd.plist.NSArray 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.NSArray in project robovm by robovm.
the class InstallationProxyClient method browse.
/**
* Lists installed applications of the specified type.
*
* @param type the type of applications to list. Either
* {@link ApplicationType#User} or {@link ApplicationType#System}
* applications. Pass <code>null</code> to list all.
* @return an {@link NSArray} of {@link NSDictionary}s holding information
* about the installed applications.
*/
public NSArray browse(Options.ApplicationType type) throws IOException {
PlistRefOut plistOut = new PlistRefOut();
PlistRef clientOpts = new Options().applicationType(type).toPlistRef();
try {
checkResult(LibIMobileDevice.instproxy_browse(getRef(), clientOpts, plistOut));
PlistRef plist = plistOut.getValue();
return (NSArray) PlistUtil.toJavaPlist(plist);
} finally {
plistOut.delete();
LibIMobileDevice.plist_free(clientOpts);
}
}
use of com.dd.plist.NSArray in project gradle by gradle.
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.NSArray in project gradle by gradle.
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));
}
currentObject.put(name, array);
}
Aggregations