use of org.robovm.compiler.util.Executor in project robovm by robovm.
the class IOSTarget method generateDsym.
private void generateDsym(final File dir, final String executable, boolean copyToIndexedDir) throws IOException {
final File dsymDir = new File(dir.getParentFile(), dir.getName() + ".dSYM");
final File exePath = new File(dir, executable);
FileUtils.deleteDirectory(dsymDir);
Logger logger = new LoggerProxy(config.getLogger()) {
@Override
public void warn(String format, Object... args) {
if (!(format.startsWith("warning:") && format.contains("could not find object file symbol for symbol"))) {
// Suppress this kind of warnings for now. See robovm/robovm#1126.
super.warn(format, args);
}
}
};
final Process process = new Executor(logger, "xcrun").args("dsymutil", "-o", dsymDir, exePath).execAsync();
if (copyToIndexedDir) {
new Thread() {
public void run() {
try {
process.waitFor();
} catch (InterruptedException e) {
return;
}
copyToIndexedDir(dir, executable, dsymDir, exePath);
}
}.start();
}
}
use of org.robovm.compiler.util.Executor 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