use of org.robovm.compiler.util.Executor in project robovm by robovm.
the class IOSTarget method createIOSSimLauncher.
private Launcher createIOSSimLauncher(LaunchParameters launchParameters) throws IOException {
File dir = getAppDir();
String iosSimPath = new File(config.getHome().getBinDir(), "ios-sim").getAbsolutePath();
List<Object> args = new ArrayList<Object>();
args.add("launch");
args.add(dir);
args.add("--timeout");
args.add("90");
args.add("--unbuffered");
if (((IOSSimulatorLaunchParameters) launchParameters).getDeviceType() != null) {
DeviceType deviceType = ((IOSSimulatorLaunchParameters) launchParameters).getDeviceType();
args.add("--devicetypeid");
args.add(deviceType.getDeviceTypeId());
}
if (launchParameters.getStdoutFifo() != null) {
args.add("--stdout");
args.add(launchParameters.getStdoutFifo());
}
if (launchParameters.getStderrFifo() != null) {
args.add("--stderr");
args.add(launchParameters.getStderrFifo());
}
if (launchParameters.getEnvironment() != null) {
for (Entry<String, String> entry : launchParameters.getEnvironment().entrySet()) {
args.add("--setenv");
args.add(entry.getKey() + "=" + entry.getValue());
}
}
if (!launchParameters.getArguments().isEmpty()) {
args.add("--args");
args.addAll(launchParameters.getArguments());
}
File xcodePath = new File(ToolchainUtil.findXcodePath());
Map<String, String> env = Collections.singletonMap("DEVELOPER_DIR", xcodePath.getAbsolutePath());
// See issue https://github.com/robovm/robovm/issues/1150, we need
// to swallow the error message by ios-sim on Xcode 7. We need
// to remove this
Logger proxyLogger = new Logger() {
boolean skipWarningsAndErrors = false;
@Override
public void debug(String format, Object... args) {
config.getLogger().debug(format, args);
}
@Override
public void info(String format, Object... args) {
config.getLogger().info(format, args);
}
@Override
public void warn(String format, Object... args) {
// we get another warning.
if (format.toString().contains("DVTPlugInManager.m:257")) {
config.getLogger().info(format, args);
return;
}
// logging of warnings and errors again
if (skipWarningsAndErrors) {
skipWarningsAndErrors = false;
config.getLogger().info(format, args);
} else {
config.getLogger().warn(format, args);
}
}
@Override
public void error(String format, Object... args) {
if (format.contains("Requested but did not find extension point with identifier Xcode.DVTFoundation.DevicePlatformMapping")) {
skipWarningsAndErrors = true;
}
if (skipWarningsAndErrors) {
config.getLogger().info(format, args);
} else {
config.getLogger().error(format, args);
}
}
};
return new Executor(proxyLogger, iosSimPath).args(args).wd(launchParameters.getWorkingDirectory()).inheritEnv(false).env(env);
}
use of org.robovm.compiler.util.Executor in project robovm by robovm.
the class IOSTarget method ldid.
private void ldid(File entitlementsPList, File appDir) throws IOException {
File executableFile = new File(appDir, getExecutable());
config.getLogger().info("Pseudo-signing %s", executableFile.getAbsolutePath());
List<Object> args = new ArrayList<Object>();
if (entitlementsPList != null) {
args.add("-S" + entitlementsPList.getAbsolutePath());
} else {
args.add("-S");
}
args.add(executableFile);
new Executor(config.getLogger(), new File(config.getHome().getBinDir(), "ldid")).args(args).exec();
}
use of org.robovm.compiler.util.Executor in project robovm by robovm.
the class IOSTarget method codesign.
private void codesign(SigningIdentity identity, File entitlementsPList, boolean preserveMetadata, boolean verbose, boolean allocate, File target) throws IOException {
List<Object> args = new ArrayList<Object>();
args.add("-f");
args.add("-s");
args.add(identity.getFingerprint());
if (entitlementsPList != null) {
args.add("--entitlements");
args.add(entitlementsPList);
}
if (preserveMetadata) {
args.add("--preserve-metadata=identifier,entitlements,resource-rules");
}
if (verbose) {
args.add("--verbose");
}
args.add(target);
Executor executor = new Executor(config.getLogger(), "codesign");
if (allocate) {
executor.addEnv("CODESIGN_ALLOCATE", ToolchainUtil.findXcodeCommand("codesign_allocate", "iphoneos"));
}
executor.args(args);
executor.exec();
}
use of org.robovm.compiler.util.Executor in project robovm by robovm.
the class IOSTarget method packageApplication.
private void packageApplication(File appDir) throws IOException {
File ipaFile = new File(config.getInstallDir(), getExecutable() + ".ipa");
config.getLogger().info("Packaging IPA %s from %s", ipaFile.getName(), appDir.getName());
File tmpDir = new File(config.getInstallDir(), "ipabuild");
FileUtils.deleteDirectory(tmpDir);
tmpDir.mkdirs();
File payloadDir = new File(tmpDir, "Payload");
payloadDir.mkdir();
config.getLogger().info("Copying %s to %s", appDir.getName(), payloadDir);
new Executor(config.getLogger(), "cp").args("-Rp", appDir, payloadDir).exec();
File frameworksDir = new File(appDir, "Frameworks");
if (frameworksDir.exists()) {
String[] swiftLibs = frameworksDir.list(new AndFileFilter(new PrefixFileFilter("libswift"), new SuffixFileFilter(".dylib")));
if (swiftLibs.length > 0) {
File swiftSupportDir = new File(tmpDir, "SwiftSupport");
swiftSupportDir.mkdir();
copySwiftLibs(Arrays.asList(swiftLibs), swiftSupportDir);
}
}
config.getLogger().info("Zipping %s to %s", tmpDir, ipaFile);
new Executor(Logger.NULL_LOGGER, "zip").wd(tmpDir).args("--symlinks", "--recurse-paths", ipaFile, ".").exec();
config.getLogger().info("Deleting temp dir %s", tmpDir);
FileUtils.deleteDirectory(tmpDir);
}
use of org.robovm.compiler.util.Executor in project robovm by robovm.
the class IOSTarget method doLaunch.
@Override
protected Process doLaunch(LaunchParameters launchParameters) throws IOException {
prepareLaunch(getAppDir());
Process process = super.doLaunch(launchParameters);
if (launchParameters instanceof IOSSimulatorLaunchParameters) {
File script = File.createTempFile("BISTF", ".scpt");
FileUtils.copyURLToFile(getClass().getResource("/BringIOSSimulatorToFront.scpt"), script);
new Executor(config.getHome().isDev() ? config.getLogger() : Logger.NULL_LOGGER, "osascript").args(script).execAsync();
}
return process;
}
Aggregations