void (@NotNull DataNode<ProjectData> mainBuildProjectDataNode) { String gradleHome = myGradleUserHome == null ? null : myGradleUserHome.getPath(); Index index = prepareIndexes(mainBuildProjectDataNode); List<String> jvmOptions = new SmartList<>(); // the BuildEnvironment jvm arguments of the main build should be used for the 'buildSrc' import // to avoid spawning of the second gradle daemon BuildEnvironment mainBuildEnvironment = myResolverContext.getModels().getBuildEnvironment(); if (mainBuildEnvironment != null) { jvmOptions.addAll(mainBuildEnvironment.getJava().getJvmArguments()); } if (myMainBuildExecutionSettings != null) { jvmOptions.addAll(myMainBuildExecutionSettings.getJvmArguments()); } Stream<Build> builds = new ToolingModelsProviderImpl(myResolverContext.getModels()).builds(); builds.forEach(build -> { String buildPath = FileUtil.toSystemIndependentName(build.getBuildIdentifier().getRootDir().getPath()); GradleExecutionSettings buildSrcProjectSettings; if (gradleHome != null) { if (myMainBuildExecutionSettings != null) { buildSrcProjectSettings = new GradleExecutionSettings(gradleHome, myMainBuildExecutionSettings.getServiceDirectory(), DistributionType.LOCAL, myMainBuildExecutionSettings.isOfflineWork()); buildSrcProjectSettings.setIdeProjectPath(myMainBuildExecutionSettings.getIdeProjectPath()); buildSrcProjectSettings.setJavaHome(myMainBuildExecutionSettings.getJavaHome()); buildSrcProjectSettings.setResolveModulePerSourceSet(myMainBuildExecutionSettings.isResolveModulePerSourceSet()); buildSrcProjectSettings.setUseQualifiedModuleNames(myMainBuildExecutionSettings.isUseQualifiedModuleNames()); buildSrcProjectSettings.setRemoteProcessIdleTtlInMs(myMainBuildExecutionSettings.getRemoteProcessIdleTtlInMs()); buildSrcProjectSettings.setVerboseProcessing(myMainBuildExecutionSettings.isVerboseProcessing()); buildSrcProjectSettings.setWrapperPropertyFile(myMainBuildExecutionSettings.getWrapperPropertyFile()); buildSrcProjectSettings.setDownloadSources(myMainBuildExecutionSettings.isDownloadSources()); buildSrcProjectSettings.setParallelModelFetch(myMainBuildExecutionSettings.isParallelModelFetch()); buildSrcProjectSettings.setDelegatedBuild(myMainBuildExecutionSettings.isDelegatedBuild()); buildSrcProjectSettings.withArguments(myMainBuildExecutionSettings.getArguments()) .withEnvironmentVariables(myMainBuildExecutionSettings.getEnv()) .passParentEnvs(myMainBuildExecutionSettings.isPassParentEnvs()) .withVmOptions(jvmOptions); reuseTargetEnvironmentConfigurationProvider(buildSrcProjectSettings, myMainBuildExecutionSettings); } else { buildSrcProjectSettings = new GradleExecutionSettings(gradleHome, null, DistributionType.LOCAL, false); } includeRootBuildIncludedBuildsIfNeeded(buildSrcProjectSettings, index.compositeBuildData(), buildPath); } else { buildSrcProjectSettings = myMainBuildExecutionSettings; } final String buildSrcProjectPath = buildPath + "/buildSrc"; DefaultProjectResolverContext buildSrcResolverCtx = new DefaultProjectResolverContext(mySyncTaskId, buildSrcProjectPath, buildSrcProjectSettings, myListener, myResolverContext.getPolicy(), false); myResolverContext.copyUserDataTo(buildSrcResolverCtx); String buildName = index.buildNames().get(buildPath); String buildSrcGroup = getBuildSrcGroup(buildPath, buildName); buildSrcResolverCtx.setBuildSrcGroup(buildSrcGroup); handleBuildSrcProject(mainBuildProjectDataNode, buildName, index.buildClasspathNodesMap().getModifiable(Paths.get(buildPath)), index.includedModulesPaths(), buildSrcResolverCtx, myProjectResolver.getProjectDataFunction(buildSrcResolverCtx, myResolverChain, true)); }); }