public static void writeExternal(@NotNull ProcessorConfigProfile profile, @NotNull Element element) {
    element.setAttribute(NAME, profile.getName());
    if (profile.isEnabled()) {
      element.setAttribute(ENABLED, Boolean.toString(profile.isEnabled()));
    }
    if (profile.isProcOnly()) {
      element.setAttribute(PROC_ONLY, Boolean.toString(profile.isProcOnly()));
    }
    final String srcDirName = profile.getGeneratedSourcesDirectoryName(false);
    if (!StringUtil.equals(ProcessorConfigProfile.DEFAULT_PRODUCTION_DIR_NAME, srcDirName)) {
      addChild(element, "sourceOutputDir").setAttribute(NAME, FileUtilRt.toSystemIndependentName(srcDirName));
    }
    final String testSrcDirName = profile.getGeneratedSourcesDirectoryName(true);
    if (!StringUtil.equals(ProcessorConfigProfile.DEFAULT_TESTS_DIR_NAME, testSrcDirName)) {
      addChild(element, "sourceTestOutputDir").setAttribute(NAME, FileUtilRt.toSystemIndependentName(testSrcDirName));
    }

    if (profile.isOutputRelativeToContentRoot()) {
      addChild(element, "outputRelativeToContentRoot").setAttribute(VALUE, "true");
    }

    final Map<String, String> options = profile.getProcessorOptions();
    if (!options.isEmpty()) {
      final List<String> keys = new ArrayList<>(options.keySet());
      keys.sort(ALPHA_COMPARATOR);
      for (String key : keys) {
        addChild(element, OPTION).setAttribute(NAME, key).setAttribute(VALUE, options.get(key));
      }
    }

    final Set<String> processors = profile.getProcessors();
    if (!processors.isEmpty()) {
      final List<String> processorList = new ArrayList<>(processors);
      for (String proc : processorList) {
        addChild(element, "processor").setAttribute(NAME, proc);
      }
    }


    Element pathElement = null;
    if (!profile.isObtainProcessorsFromClasspath()) {
      pathElement = addChild(element, "processorPath");
      pathElement.setAttribute(USE_CLASSPATH, Boolean.toString(profile.isObtainProcessorsFromClasspath()));
      if (profile.isUseProcessorModulePath()) {
        pathElement.setAttribute(USE_PROC_MODULE_PATH, Boolean.toString(profile.isUseProcessorModulePath()));
      }
    }

    final String path = profile.getProcessorPath();
    if (!StringUtil.isEmpty(path)) {
      if (pathElement == null) {
        pathElement = addChild(element, "processorPath");
        if (profile.isUseProcessorModulePath()) {
          pathElement.setAttribute(USE_PROC_MODULE_PATH, Boolean.toString(profile.isUseProcessorModulePath()));
        }
      }
      final StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator, false);
      while (tokenizer.hasMoreTokens()) {
        final String token = tokenizer.nextToken();
        addChild(pathElement, ENTRY).setAttribute(NAME, FileUtilRt.toSystemIndependentName(token));
      }
    }

    final Set<String> moduleNames = profile.getModuleNames();
    if (!moduleNames.isEmpty()) {
      final List<String> names = new ArrayList<>(moduleNames);
      for (String name : names) {
        addChild(element, MODULE).setAttribute(NAME, name);
      }
    }
  }
public static void writeExternal(@NotNull ProcessorConfigProfile profile, @NotNull Element element)