private static List<GroovyDslScript> getDslScripts(final Project project) {
    return CachedValuesManager.getManager(project).getCachedValue(project, SCRIPTS_CACHE, () -> {
      if (GdslUtil.ourGdslStopped) {
        return CachedValueProvider.Result.create(Collections.emptyList(), ModificationTracker.NEVER_CHANGED);
      }

      // eagerly initialize some services used by background gdsl parsing threads
      // because service init requires a read action
      // and there could be a deadlock with a write action waiting already on EDT
      // if current thread is inside a non-cancellable read action
      //noinspection ResultOfMethodCallIgnored
      GdslScriptBase.getIdeaVersion();
      DslActivationStatus.getInstance();

      int count = 0;

      List<GroovyDslScript> result = new ArrayList<>();

      final LinkedBlockingQueue<Pair<VirtualFile, GroovyDslExecutor>> queue =
        new LinkedBlockingQueue<>();

      for (VirtualFile vfile : getGdslFiles(project)) {
        final long stamp = vfile.getModificationStamp();
        final GroovyDslExecutor cached = getCachedExecutor(vfile, stamp);
        if (cached == null) {
          scheduleParsing(queue, project, vfile, stamp, LoadTextUtil.loadText(vfile).toString());
          count++;
        }
        else {
          result.add(new GroovyDslScript(project, vfile, cached, vfile.getPath()));
        }
      }

      try {
        while (count > 0 && !GdslUtil.ourGdslStopped) {
          ProgressManager.checkCanceled();
          final Pair<VirtualFile, GroovyDslExecutor> pair = queue.poll(20, TimeUnit.MILLISECONDS);
          if (pair != null) {
            count--;
            if (pair.second != null) {
              result.add(new GroovyDslScript(project, pair.first, pair.second, pair.first.getPath()));
            }
          }
        }
      }
      catch (InterruptedException e) {
        LOG.error(e);
      }

      return CachedValueProvider.Result.create(result, PsiModificationTracker.MODIFICATION_COUNT, ProjectRootManager.getInstance(project));
    }, false);
  }
private static List<GroovyDslScript> getDslScripts(final Project project)