public void run() { DefaultModuleRegistry registry = new DefaultModuleRegistry(); Set<File> bootstrapClasspath = new LinkedHashSet<File>(); bootstrapClasspath.addAll(registry.getModule("gradle-launcher").getImplementationClasspath()); if (registry.getGradleHome() == null) { // Running from the classpath - chuck in everything we can find bootstrapClasspath.addAll(registry.getFullClasspath()); } if (bootstrapClasspath.isEmpty()) { throw new IllegalStateException( "Unable to construct a bootstrap classpath when starting the daemon"); } List<String> daemonArgs = new ArrayList<String>(); daemonArgs.add(Jvm.current().getJavaExecutable().getAbsolutePath()); daemonArgs.add("-Xmx1024m"); daemonArgs.add("-XX:MaxPermSize=256m"); daemonArgs.add("-XX:MaxPermSize=256m"); // Useful for debugging purposes - simply uncomment and connect to debug // daemonArgs.add("-Xdebug"); // daemonArgs.add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"); daemonArgs.add("-cp"); daemonArgs.add(GUtil.join(bootstrapClasspath, File.pathSeparator)); daemonArgs.add(GradleDaemon.class.getName()); daemonArgs.add(String.format("-%s", DefaultCommandLineConverter.GRADLE_USER_HOME)); daemonArgs.add(userHomeDir.getAbsolutePath()); DaemonIdleTimeout idleTimeout = new DaemonIdleTimeout(System.getenv("GRADLE_OPTS"), this.idleTimeout); daemonArgs.add(idleTimeout.toSysArg()); LOGGER.info( "starting daemon process: workingDir = {}, daemonArgs: {}", userHomeDir, daemonArgs); startProcess(daemonArgs, userHomeDir); }
public ExecAction getExecHandle() { try { options.write(optionsFile); } catch (IOException e) { throw new GradleException("Faild to store javadoc options.", e); } ExecAction execAction = new DefaultExecAction(); execAction.workingDir(execDirectory); execAction.executable(GUtil.elvis(executable, Jvm.current().getJavadocExecutable())); execAction.args("@" + optionsFile.getAbsolutePath()); options.contributeCommandLineOptions(execAction); return execAction; }
public CurrentProcess() { this(Jvm.current().getJavaHome(), inferJvmOptions()); }