Search in sources :

Example 1 with Logger

use of org.robovm.compiler.log.Logger 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);
}
Also used : Executor(org.robovm.compiler.util.Executor) ArrayList(java.util.ArrayList) NSObject(com.dd.plist.NSObject) NSString(com.dd.plist.NSString) Logger(org.robovm.compiler.log.Logger) File(java.io.File)

Example 2 with Logger

use of org.robovm.compiler.log.Logger in project robovm by robovm.

the class MarshalerLookupTest method initializeSoot.

@BeforeClass
public static void initializeSoot() throws IOException {
    soot.G.reset();
    Options.v().set_output_format(Options.output_format_jimple);
    Options.v().set_include_all(true);
    Options.v().set_print_tags_in_output(true);
    Options.v().set_allow_phantom_refs(true);
    Options.v().set_soot_classpath(System.getProperty("sun.boot.class.path") + ":" + System.getProperty("java.class.path"));
    Scene.v().loadNecessaryClasses();
    Config.Builder configBuilder = new Config.Builder();
    for (String p : System.getProperty("sun.boot.class.path").split(File.pathSeparator)) {
        configBuilder.addBootClasspathEntry(new File(p));
    }
    for (String p : System.getProperty("java.class.path").split(File.pathSeparator)) {
        configBuilder.addClasspathEntry(new File(p));
    }
    configBuilder.skipInstall(true);
    configBuilder.skipLinking(true);
    configBuilder.home(new MockHome(new File(System.getProperty("java.io.tmpdir"))));
    configBuilder.logger(new Logger() {

        public void warn(String format, Object... args) {
            System.out.format("WARN: " + format, args);
            System.out.println();
        }

        public void info(String format, Object... args) {
            System.out.format("INFO: " + format, args);
            System.out.println();
        }

        public void error(String format, Object... args) {
            System.out.format("ERROR: " + format, args);
            System.out.println();
        }

        public void debug(String format, Object... args) {
            System.out.format("DEBUG: " + format, args);
            System.out.println();
        }
    });
    config = configBuilder.build();
}
Also used : Config(org.robovm.compiler.config.Config) Logger(org.robovm.compiler.log.Logger) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 3 with Logger

use of org.robovm.compiler.log.Logger 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();
    }
}
Also used : Executor(org.robovm.compiler.util.Executor) LoggerProxy(org.robovm.compiler.log.LoggerProxy) NSObject(com.dd.plist.NSObject) NSString(com.dd.plist.NSString) Logger(org.robovm.compiler.log.Logger) File(java.io.File)

Aggregations

File (java.io.File)3 Logger (org.robovm.compiler.log.Logger)3 NSObject (com.dd.plist.NSObject)2 NSString (com.dd.plist.NSString)2 Executor (org.robovm.compiler.util.Executor)2 ArrayList (java.util.ArrayList)1 BeforeClass (org.junit.BeforeClass)1 Config (org.robovm.compiler.config.Config)1 LoggerProxy (org.robovm.compiler.log.LoggerProxy)1