List<TargetTypeBuildScope> (@NotNull final CompileScope baseScope, @NotNull final Project project, final boolean forceBuild) { final List<TargetTypeBuildScope> scopes = new ArrayList<>(); ReadAction.run(() -> { final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, baseScope, false); if (ArtifactCompileScope.getArtifacts(baseScope) == null) { Set<Module> modules = ArtifactUtil.getModulesIncludedInArtifacts(artifacts, project); CompileScopeUtil.addScopesForModules(modules, Collections.emptyList(), scopes, forceBuild); } if (!artifacts.isEmpty()) { boolean forceBuildForArtifacts = forceBuild || ArtifactCompileScope.isArtifactRebuildForced(baseScope); scopes.add(CompileScopeUtil.createScopeForArtifacts(artifacts, forceBuildForArtifacts)); } }); return scopes; }