void (@NotNull List<String> taskNames, @NotNull Consumer<String> initScriptConsumer, @NotNull Map<String, String> parameters) { String dispatchPort = parameters.get(GradleProjectResolverExtension.DEBUG_DISPATCH_PORT_KEY); if (dispatchPort == null) { return; } String debugOptions = parameters.get(GradleProjectResolverExtension.DEBUG_OPTIONS_KEY); if (debugOptions == null) { debugOptions = ""; } List<String> lines = new ArrayList<>(); String esRtJarPath = FileUtil.toCanonicalPath(PathManager.getJarPathForClass(ExternalSystemSourceType.class)); lines.add("initscript { dependencies { classpath files(mapPath(\"" + esRtJarPath + "\")) } }"); // bring external-system-rt.jar for (DebuggerBackendExtension extension : DebuggerBackendExtension.EP_NAME.getExtensionList()) { lines.addAll(extension.initializationCode(dispatchPort, debugOptions)); } final String script = join(lines, System.lineSeparator()); initScriptConsumer.consume(script); }