use of com.dd.plist.NSNumber 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.NSNumber 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.NSNumber in project robovm by robovm.
the class RamDiskTools method setupRamDisk.
/**
* Checks if a RAM disk is available and prunes it if necessary.
*/
public void setupRamDisk(Config config, File cacheDir, File tmpDir) {
this.newCacheDir = cacheDir;
this.newTmpDir = tmpDir;
if (OS.getDefaultOS() != OS.macosx) {
return;
}
File volume = new File(ROBOVM_RAM_DISK_PATH);
if (!volume.exists()) {
try {
FileStore store = Files.getFileStore(new File(System.getProperty("user.home")).toPath());
String plist = new Executor(Logger.NULL_LOGGER, "diskutil").args("info", "-plist", store.name()).execCapture();
NSDictionary dict = (NSDictionary) PropertyListParser.parse(plist.getBytes("UTF-8"));
NSObject value = dict.objectForKey("SolidState");
if (value == null || (value instanceof NSNumber && !((NSNumber) value).boolValue())) {
// @formatter:off
config.getLogger().warn("RoboVM has detected that you are running on a slow HDD. Please consider mounting a RAM disk.\n" + "To create a 2GB RAM disk, run this in your terminal:\n" + "SIZE=2048 ; diskutil erasevolume HFS+ 'RoboVM RAM Disk' `hdiutil attach -nomount ram://$((SIZE * 2048))`\n" + "See http://docs.robovm.com/ for more info");
// @formatter:on
}
} catch (Throwable t) {
// nothing to do here, can't decide if we are on a SSD or HDD
t.printStackTrace();
}
return;
}
try {
FileStore store = Files.getFileStore(volume.toPath());
if (store.getUsableSpace() < MIN_FREE_SPACE) {
cleanRamDisk(store, volume, config);
if (store.getUsableSpace() < MIN_FREE_SPACE) {
config.getLogger().info("Couldn't free enough space on RAM disk, using hard drive");
return;
}
}
File newCacheDir = new File(volume, "cache");
if (!newCacheDir.exists() && !newCacheDir.mkdirs()) {
config.getLogger().info("Couldn't create cache directory on RAM disk, using hard drive");
return;
}
File newTmpDir = new File(volume, "tmp");
if (!newTmpDir.exists() && !newTmpDir.mkdirs()) {
config.getLogger().info("Couldn't create tmp directory on RAM disk, using hard drive");
return;
}
newTmpDir = new File(newTmpDir, tmpDir.getAbsolutePath());
config.getLogger().info("Using RAM disk at %s for cache and tmp directory", ROBOVM_RAM_DISK_PATH);
this.newCacheDir = newCacheDir;
this.newTmpDir = newTmpDir;
} catch (Throwable t) {
config.getLogger().error("Couldn't setup RAM disk, using hard drive, %s", t.getMessage());
this.newCacheDir = cacheDir;
this.newTmpDir = tmpDir;
}
}
Aggregations