public DaemonRegistry getDaemonRegistry() { DaemonParameters parameters = new DaemonParameters(new BuildLayoutParameters()); parameters.setBaseDir(getDaemonBaseDir()); return new DaemonClientServices( LoggingServiceRegistry.newEmbeddableLogging(), parameters, new ByteArrayInputStream(new byte[0])) .get(DaemonRegistry.class); }
private Parameters initParams(ProviderOperationParameters operationParameters) { BuildLayoutParameters layout = new BuildLayoutParameters(); if (operationParameters.getGradleUserHomeDir() != null) { layout.setGradleUserHomeDir(operationParameters.getGradleUserHomeDir()); } layout.setSearchUpwards( operationParameters.isSearchUpwards() != null ? operationParameters.isSearchUpwards() : true); layout.setProjectDir(operationParameters.getProjectDir()); Map<String, String> properties = new HashMap<String, String>(); new LayoutToPropertiesConverter().convert(layout, properties); DaemonParameters daemonParams = new DaemonParameters(layout); new PropertiesToDaemonParametersConverter().convert(properties, daemonParams); if (operationParameters.getDaemonBaseDir(null) != null) { daemonParams.setBaseDir(operationParameters.getDaemonBaseDir(null)); } // override the params with the explicit settings provided by the tooling api List<String> defaultJvmArgs = daemonParams.getAllJvmArgs(); daemonParams.setJvmArgs(operationParameters.getJvmArguments(defaultJvmArgs)); File defaultJavaHome = daemonParams.getEffectiveJavaHome(); daemonParams.setJavaHome(operationParameters.getJavaHome(defaultJavaHome)); if (operationParameters.getDaemonMaxIdleTimeValue() != null && operationParameters.getDaemonMaxIdleTimeUnits() != null) { int idleTimeout = (int) operationParameters .getDaemonMaxIdleTimeUnits() .toMillis(operationParameters.getDaemonMaxIdleTimeValue()); daemonParams.setIdleTimeout(idleTimeout); } return new Parameters(daemonParams, properties); }