@NotNull
 public static JpsErlangCompilerOptionsExtension getOrCreateExtension(
     @NotNull JpsProject project) {
   JpsErlangCompilerOptionsExtension extension = project.getContainer().getChild(ROLE);
   if (extension == null) {
     extension =
         project
             .getContainer()
             .setChild(ROLE, new JpsErlangCompilerOptionsExtension(new ErlangCompilerOptions()));
   }
   return extension;
 }
 private void loadProjectLibraries(Element libraryTableElement) {
   final ArrayList<JpsLibrary> libraries = new ArrayList<JpsLibrary>();
   JpsLibraryTableLoader.loadLibraries(libraryTableElement, libraries);
   for (JpsLibrary library : libraries) {
     myProject.addLibrary(library);
   }
 }
 private void loadModules(Element root) {
   Element componentRoot = findComponent(root, "ProjectModuleManager");
   if (componentRoot == null) return;
   final Element modules = componentRoot.getChild("modules");
   for (Element moduleElement : JDOMUtil.getChildren(modules, "module")) {
     final String path = moduleElement.getAttributeValue("filepath");
     JpsModule module = loadModule(path);
     myProject.addModule(module);
   }
 }
 private void processJavaModuleTargets(
     @NotNull JpsProject jpsProject, @NotNull Processor<ModuleBuildTarget> processor) {
   for (JpsModule module : jpsProject.getModules()) {
     for (JavaModuleBuildTargetType buildTargetType : JavaModuleBuildTargetType.ALL_TYPES) {
       final ModuleBuildTarget moduleBuildTarget = new ModuleBuildTarget(module, buildTargetType);
       if (!processor.process(moduleBuildTarget)) {
         return;
       }
     }
   }
 }
  protected <T extends JpsElement> JpsModule addModule(
      String moduleName,
      String[] srcPaths,
      @Nullable String outputPath,
      @Nullable String testOutputPath,
      JpsSdk<T> sdk) {
    JpsModule module = myProject.addModule(moduleName, JpsJavaModuleType.INSTANCE);
    final JpsSdkType<T> sdkType = sdk.getSdkType();
    final JpsSdkReferencesTable sdkTable = module.getSdkReferencesTable();
    sdkTable.setSdkReference(sdkType, sdk.createReference());

    if (sdkType instanceof JpsJavaSdkTypeWrapper) {
      final JpsSdkReference<T> wrapperRef = sdk.createReference();
      sdkTable.setSdkReference(
          JpsJavaSdkType.INSTANCE,
          JpsJavaExtensionService.getInstance()
              .createWrappedJavaSdkReference((JpsJavaSdkTypeWrapper) sdkType, wrapperRef));
    }
    module.getDependenciesList().addSdkDependency(sdkType);
    if (srcPaths.length > 0 || outputPath != null) {
      for (String srcPath : srcPaths) {
        module.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(srcPath));
        module.addSourceRoot(JpsPathUtil.pathToUrl(srcPath), JavaSourceRootType.SOURCE);
      }
      JpsJavaModuleExtension extension =
          JpsJavaExtensionService.getInstance().getOrCreateModuleExtension(module);
      if (outputPath != null) {
        extension.setOutputUrl(JpsPathUtil.pathToUrl(outputPath));
        if (!StringUtil.isEmpty(testOutputPath)) {
          extension.setTestOutputUrl(JpsPathUtil.pathToUrl(testOutputPath));
        } else {
          extension.setTestOutputUrl(extension.getOutputUrl());
        }
      } else {
        extension.setInheritOutput(true);
      }
    }
    return module;
  }