@Override
  public void writeConfiguration(@NotNull ProjectDescriptor pd, @NotNull PrintWriter out) {
    final JpsModule module = getModule();
    final PathRelativizerService relativizer = pd.dataManager.getRelativizer();

    final StringBuilder logBuilder = LOG.isDebugEnabled() ? new StringBuilder() : null;

    int fingerprint = getDependenciesFingerprint(logBuilder, relativizer);

    for (JavaSourceRootDescriptor root : pd.getBuildRootIndex().getTargetRoots(this, null)) {
      final File file = root.getRootFile();
      String path = relativizer.toRelative(file.getPath());
      if (logBuilder != null) {
        logBuilder.append(path).append("\n");
      }
      fingerprint += pathHashCode(path);
    }

    final LanguageLevel level = JpsJavaExtensionService.getInstance().getLanguageLevel(module);
    if (level != null) {
      if (logBuilder != null) {
        logBuilder.append(level.name()).append("\n");
      }
      fingerprint += level.name().hashCode();
    }

    final JpsJavaCompilerConfiguration config = JpsJavaExtensionService.getInstance().getCompilerConfiguration(module.getProject());
    final String bytecodeTarget = config.getByteCodeTargetLevel(module.getName());
    if (bytecodeTarget != null) {
      if (logBuilder != null) {
        logBuilder.append(bytecodeTarget).append("\n");
      }
      fingerprint += bytecodeTarget.hashCode();
    }

    final CompilerEncodingConfiguration encodingConfig = pd.getEncodingConfiguration();
    final String encoding = encodingConfig.getPreferredModuleEncoding(module);
    if (encoding != null) {
      if (logBuilder != null) {
        logBuilder.append(encoding).append("\n");
      }
      fingerprint += encoding.hashCode();
    }

    final String hash = Integer.toHexString(fingerprint);
    out.write(hash);
    if (logBuilder != null) {
      File configurationTextFile = new File(pd.getTargetsState().getDataPaths().getTargetDataRoot(this), "config.dat.debug.txt");
      @NonNls String oldText;
      try {
        oldText = FileUtil.loadFile(configurationTextFile);
      }
      catch (IOException e) {
        oldText = null;
      }
      String newText = logBuilder.toString();
      if (!newText.equals(oldText)) {
        if (oldText != null) {
          LOG.debug("Configuration differs from the last recorded one for " + getPresentableName() + ".\nRecorded configuration:\n" + oldText +
                    "\nCurrent configuration (hash=" + hash + "):\n" + newText);
        }
        try {
          FileUtil.writeToFile(configurationTextFile, newText);
        }
        catch (IOException e) {
          LOG.debug(e);
        }
      }
    }
  }
@Override
  public void writeConfiguration(@NotNull ProjectDescriptor pd, @NotNull PrintWriter out)