void () { if (reportStateUnavailable()) { return; } long start = System.nanoTime(); Map<String, Map<String, BuildTargetState>> targetTypeHashMap = loadCurrentTargetState(); List<BuildTarget<?>> buildTargets; if (targetTypeHashMap.isEmpty()) { buildTargets = myBuildTargetIndex.getAllTargets(); } else { List<BuildTarget<?>> changedBuildTargets = new ArrayList<>(myChangedBuildTargets.values()); LOG.info("List of changed build targets: " + changedBuildTargets); buildTargets = changedBuildTargets; } @Unmodifiable @NotNull List<? extends Future<?>> result; if (buildTargets.isEmpty()) { result = Collections.emptyList(); } else { List<Future<?>> list = new ArrayList<>(buildTargets.size()); for (BuildTarget<?> t : buildTargets) { list.add(myParallelBuildExecutor.submit(() -> { String targetTypeId = t.getTargetType().getTypeId(); getBuildTargetHash(t, myContext).ifPresent(buildTargetHash -> { // now in a project, each build target has a single output root String relativePath = ""; for (File file : t.getOutputRoots(myContext)) { relativePath = myRelativizer.toRelative(file.getAbsolutePath()); break; } synchronized (targetTypeHashMap) { targetTypeHashMap.computeIfAbsent(targetTypeId, key -> new HashMap<>()) .put(t.getId(), new BuildTargetState(buildTargetHash.toString(), relativePath)); } }); })); } result = list; } // now in a project, each build target has a single output root for (Future<?> future : result) { try { future.get(); } catch (InterruptedException | ExecutionException e) { LOG.warn("Unable to get the result from future", e); } } clearRemovedBuildTargets(targetTypeHashMap); try { FileUtil.writeToFile(myTargetStateStorage, gson.toJson(targetTypeHashMap)); } catch (IOException e) { LOG.warn("Unable to save sources state", e); } LOG.info("Build target sources report took: " + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start) + " ms"); }