private static boolean hasWorkToDo(BuildFSState state, @Nullable ProjectDescriptor pd) {
    if (pd == null) {
      return true; // assuming the worst case
    }
    final BuildTargetIndex targetIndex = pd.getBuildTargetIndex();
    for (JpsModule module : pd.getProject().getModules()) {
      for (ModuleBasedTarget<?> target : targetIndex.getModuleBasedTargets(module, BuildTargetRegistry.ModuleTargetSelector.ALL)) {
        if (!pd.getBuildTargetIndex().isDummy(target) && state.hasWorkToDo(target)) {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Has work to do in " + target);
          }
          return true;
        }
      }
    }
    return false;
  }
private static boolean hasWorkToDo(BuildFSState state, @Nullable ProjectDescriptor pd)