private static void addCompilationOptions(int compilerSdkVersion,
                                            List<? super String> options,
                                            CompileContext context, ModuleChunk chunk,
                                            @Nullable ProcessorConfigProfile profile, boolean procOnlySupported) {
    if (!options.contains(ENCODING_OPTION)) {
      final CompilerEncodingConfiguration config = context.getProjectDescriptor().getEncodingConfiguration();
      final String encoding = config.getPreferredModuleChunkEncoding(chunk);
      if (config.getAllModuleChunkEncodings(chunk).size() > 1) {
        String message = JpsBuildBundle.message("build.message.multiple.encodings.set.for.module.chunk", chunk.getName(), encoding, encoding != null ? 0 : 1);
        context.processMessage(new CompilerMessage(getBuilderName(), BuildMessage.Kind.INFO, message));
      }
      if (!StringUtil.isEmpty(encoding)) {
        options.add(ENCODING_OPTION);
        options.add(encoding);
      }
    }

    addCrossCompilationOptions(compilerSdkVersion, options, context, chunk);

    if (!options.contains(ENABLE_PREVIEW_OPTION)) {
      LanguageLevel level = JpsJavaExtensionService.getInstance().getLanguageLevel(chunk.representativeTarget().getModule());
      if (level != null && level.isPreview()) {
        options.add(ENABLE_PREVIEW_OPTION);
      }
    }

    if (addAnnotationProcessingOptions(options, profile)) {
      assert profile != null;

      if (procOnlySupported && profile.isProcOnly()) {
        options.add(PROC_ONLY_OPTION);
      }

      final File srcOutput = ProjectPaths.getAnnotationProcessorGeneratedSourcesOutputDir(
        chunk.getModules().iterator().next(), chunk.containsTests(), profile
      );
      if (srcOutput != null) {
        FileUtil.createDirectory(srcOutput);
        options.add("-s");
        options.add(srcOutput.getPath());
      }
    }
  }
private static void addCompilationOptions(int compilerSdkVersion,
                                            List<? super String> options,
                                            CompileContext context, ModuleChunk chunk,
                                            @Nullable ProcessorConfigProfile profile, boolean procOnlySupported)