private static void appendInitScriptArgument(
    @Nullable Project project,
    @NotNull List<String> taskNames,
    @Nullable String jvmParametersSetup,
    @NotNull GradleExecutionSettings effectiveSettings,
    @Nullable GradleVersion gradleVersion
  ) {
    final List<String> initScripts = new ArrayList<>();
    List<GradleProjectResolverExtension> extensions = GradleProjectResolverUtil.createProjectResolvers(null).toList();
    for (GradleProjectResolverExtension resolverExtension : extensions) {
      final String resolverClassName = resolverExtension.getClass().getName();

      Map<String, String> enhancementParameters = new HashMap<>();
      enhancementParameters.put(GradleProjectResolverExtension.JVM_PARAMETERS_SETUP_KEY, jvmParametersSetup);

      var isRunAsTest = effectiveSettings.isRunAsTest();
      enhancementParameters.put(GradleProjectResolverExtension.IS_RUN_AS_TEST_KEY, String.valueOf(isRunAsTest));
      var isBuiltInTestEventsUsed = effectiveSettings.isBuiltInTestEventsUsed();
      enhancementParameters.put(GradleProjectResolverExtension.IS_BUILT_IN_TEST_EVENTS_USED_KEY, String.valueOf(isBuiltInTestEventsUsed));

      Integer debugDispatchPort = effectiveSettings.getUserData(DEBUGGER_DISPATCH_PORT_KEY);
      if (debugDispatchPort != null) {
        enhancementParameters.put(GradleProjectResolverExtension.DEBUG_DISPATCH_PORT_KEY, String.valueOf(debugDispatchPort));
        String debugOptions = effectiveSettings.getUserData(DEBUGGER_PARAMETERS_KEY);
        enhancementParameters.put(GradleProjectResolverExtension.DEBUG_OPTIONS_KEY, debugOptions);
      }
      String debugDispatchAddr = effectiveSettings.getUserData(DEBUGGER_DISPATCH_ADDR_KEY);
      if (debugDispatchAddr != null) {
        enhancementParameters.put(GradleProjectResolverExtension.DEBUG_DISPATCH_ADDR_KEY, debugDispatchAddr);
      }

      if (gradleVersion != null) {
        enhancementParameters.put(GradleProjectResolverExtension.GRADLE_VERSION, gradleVersion.getVersion());
      }

      resolverExtension.enhanceTaskProcessing(project, taskNames, script -> {
        if (StringUtil.isNotEmpty(script)) {
          addAllNotNull(
            initScripts,
            "//-- Generated by " + resolverClassName,
            script,
            "//");
        }
      }, enhancementParameters);
    }

    if (!initScripts.isEmpty()) {
      writeAndAppendScript(effectiveSettings, StringUtil.join(initScripts, System.lineSeparator()), "ijresolvers");
    }

    final String initScript = effectiveSettings.getUserData(INIT_SCRIPT_KEY);
    if (StringUtil.isNotEmpty(initScript)) {
      writeAndAppendScript(effectiveSettings, initScript, notNullize(effectiveSettings.getUserData(INIT_SCRIPT_PREFIX_KEY), "ijmiscinit"));
    }

    final Collection<VersionSpecificInitScript> scripts = effectiveSettings.getUserData(VERSION_SPECIFIC_SCRIPTS_KEY);
    if (gradleVersion != null && scripts != null && !scripts.isEmpty()) {
        scripts.stream()
          .filter(script -> script.isApplicableTo(gradleVersion))
          .filter(script -> StringUtil.isNotEmpty(script.getScript()))
          .forEach(script -> writeAndAppendScript(effectiveSettings, script.getScript(), notNullize(script.getFilePrefix(), "ijverspecinit")));
    }

    if (effectiveSettings.getArguments().contains(GradleConstants.INIT_SCRIPT_CMD_OPTION)) {
      GradleInitScriptUtil.attachTargetPathMapperInitScript(effectiveSettings);
    }
  }
private static void appendInitScriptArgument(
    @Nullable Project project,
    @NotNull List<String> taskNames,
    @Nullable String jvmParametersSetup,
    @NotNull GradleExecutionSettings effectiveSettings,
    @Nullable GradleVersion gradleVersion
  )