PK          V
    ;   com/intellij/openapi/fileTypes/WildcardFileNameMatcher.java// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.fileTypes;

import com.intellij.openapi.util.text.Strings;
import com.intellij.util.PatternUtil;
import org.jetbrains.annotations.NotNull;

import java.util.regex.Pattern;

public class WildcardFileNameMatcher implements FileNameMatcher {
  private final String myPattern;
  private final MaskMatcher myMatcher;

  private interface MaskMatcher {
    boolean matches(@NotNull CharSequence filename);
  }

  private static final class RegexpMatcher implements MaskMatcher {
    private final Pattern pattern;

    RegexpMatcher(@NotNull String pattern) {
      this.pattern = PatternUtil.fromMask(pattern);
    }

    @Override
    public boolean matches(final @NotNull CharSequence filename) {
      return pattern.matcher(filename).matches();
    }
  }

  private static final class SuffixMatcher implements MaskMatcher {
    private final String mySuffix;

    SuffixMatcher(@NotNull String suffix) {
      mySuffix = suffix;
    }

    @Override
    public boolean matches(final @NotNull CharSequence filename) {
      return Strings.endsWith(filename, mySuffix);
    }
  }

  private static final class PrefixMatcher implements MaskMatcher {
    private final String myPrefix;

    private PrefixMatcher(@NotNull String prefix) {
      myPrefix = prefix;
    }

    @Override
    public boolean matches(final @NotNull CharSequence filename) {
      return Strings.startsWith(filename, 0, myPrefix);
    }
  }

  private static final class InfixMatcher implements MaskMatcher {
    private final String myInfix;

    InfixMatcher(@NotNull String infix) {
      myInfix = infix;
    }

    @Override
    public boolean matches(final @NotNull CharSequence filename) {
      return Strings.contains(filename, myInfix);
    }
  }

  /**
   * Use {@link org.jetbrains.jps.model.fileTypes.FileNameMatcherFactory#createMatcher(String)} instead of direct call to constructor
   */
  public WildcardFileNameMatcher(@NotNull String pattern) {
    myPattern = pattern;
    myMatcher = createMatcher(pattern);
  }

  private static @NotNull MaskMatcher createMatcher(final @NotNull String pattern) {
    int len = pattern.length();
    if (len > 1 && pattern.indexOf('?') < 0) {
      if (pattern.charAt(0) == '*' && pattern.indexOf('*', 1) < 0) {
        return new SuffixMatcher(pattern.substring(1));
      }
      if (pattern.indexOf('*') == len - 1) {
        return new PrefixMatcher(pattern.substring(0, len - 1));
      }
      if (len > 2 && pattern.charAt(0) == '*' && pattern.indexOf('*', 1) == len - 1) {
        return new InfixMatcher(pattern.substring(1, len - 1));
      }
    }
    return new RegexpMatcher(pattern);
  }

  @Override
  public boolean acceptsCharSequence(@NotNull CharSequence fileName) {
    return myMatcher.matches(fileName);
  }

  @Override
  public @NotNull String getPresentableString() {
    return myPattern;
  }


  @Override
  public boolean equals(final Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    final WildcardFileNameMatcher that = (WildcardFileNameMatcher)o;

    return myPattern.equals(that.myPattern);
  }

  @Override
  public int hashCode() {
    return myPattern.hashCode();
  }

  public @NotNull String getPattern() {
    return myPattern;
  }

  @Override
  public String toString() {
    return myPattern;
  }
}
PK          :l  l  .   org/jetbrains/jps/plugin/JpsPluginManager.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.plugin;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.service.JpsServiceManager;

import java.util.Collection;

/**
 * This class is supposed to be used in the implementation of {@link JpsServiceManager} only. Other code must use {@link JpsServiceManager}
 * instead.
 */
@ApiStatus.Internal
public abstract class JpsPluginManager {
  public static @NotNull JpsPluginManager getInstance() {
    return JpsServiceManager.getInstance().getService(JpsPluginManager.class);
  }

  public abstract @NotNull <T> Collection<T> loadExtensions(@NotNull Class<T> extensionClass);

  public abstract boolean isFullyLoaded();

  public abstract int getModificationStamp();
}
PK         ؀Oن  ;:  ;   com/intellij/openapi/fileTypes/impl/FileTypeAssocTable.javaZ[wܶ~ׯ@C)kJqV7[ֱNږ%7M +,]gkw F\rW&~`0 ]jݽ@>;|#ӲFuS"\(cv.S&M@<#@wlAxIrtW8?CTЌ5Iwcf)-)
)e)qE)-Ͳ"uJgUqCį~ÙwxFbcFY-!Lף s+
	 P2˱ϖߥUKqY2%:w}sdsI)Ot^*4ÂDj	AuK\T[1Rx@Y]j 5nmANnЗ*N0&N.1&2#t|hyScF\`D$&٩G˗_i~SyW&+Q^\jBr3"4(@wPQ!S4kԦva\O'薱e`kAdO..6udR;d4, {౼:&+<5=H BKMwP~)o8S`QCX1a,UϨNV0VM3la%'D|W/+Lҁ1Mx\a,L\QdV	X]y>x5wɔJ谵lNjXbg6i֊7/T; 3O\$	F0%Z`"}z̀'bK%X
K n	FaF=J!MGI_qQ{:z`zG@t,<i\Z4{v=Zr*X{ˏ̊atPxL|pnUߓ!Kzni$AI;L*%ڂV)|VsRͤB[kX4/aYQV3iW7LΧQ)_ߕq <<JiG: _z^
+oRɂyO/V3j2'uoI+'gCn|5~dgЙ<.wwb^qqOJVa>J98@_0ߪYa!+)ͨXXBr$fł??I5!j[G5$H-jN5=|QNE*Xŵ}3N46ê^=CCm9Sf&N%{iA;H v7U
"&W fjXoyaGa[^&w'h}rע:.ơpTBKt)'fճӁV{MUAh<؂lY飥Z79g?dvRHie}*"i[Q;Xȵ3Vb{|o[j|ʺtXe. mm*i`DRiOk&a8>_;8xQx>^͕QHVgHF3Ï].Cw=  8-mʤ
ZB5wPyC1i֥
`a^תҧ̖AJȘR&Urjϕ2XPW&5JSeo{? U) Ӊ;dj7!_KM'	
/S_/S"_(m	^&yP*h+bNLht4l@?h&Ӻe\I*5韶FP/2o=[*.~ͱu#MX)ws]Z9t8/,޴f6Y[q"93Z	Xv.uWh3
CPbsvK3mPwP0=PXL3JEgQLr:GSLaCfL=8`Ny!h1I Ȥ*!vXhd~_2Qpia{P>z[wU+q0Hc9c9RյLf+uRrݒWׄ\:viuدYsSt%~d_n*V#fInׯ=X5WsNá{n3*G@hogzwV@VرՀ,In֐
ĿcNOZ7mҪOnbFreҭw+0uN|n%fqil@Tw]f/P3yjA89麶F'bCSxyUw u r!qe-_Pa(I#v5nq9t7dSrDhZ٣2 A$ [$y,R.Xȗ|YÍ0훧cV=Aqm6<TxKY'&{ha)Ozso\S_pQƗ
MIg>,g(BTL{RWig
 /:V;m-{%L ͞Yi[ׇDR'qm;+Iku0qj.(6EfK],{J`+<6(
`sy_I'yqHEHql;ƻ{gq\%i)ח4ΝkiӘOwuoGv-w}W=\bGq
c'yu짇]gUY,w >]jb/ChӨ9M~ȎV٪6g)^n4=>$>nC{]Aov64!ӕB
TVdzuVqjGO4Fä	hsdy盂PK          sg	  g	  :   com/intellij/openapi/fileTypes/impl/IgnoredPatternSet.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileTypes.impl;

import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.fileTypes.FileNameMatcherFactory;

import java.util.*;

@ApiStatus.Internal
public final class IgnoredPatternSet {
  private final Set<String> masks;
  private final FileTypeAssocTable<Boolean> ignorePatterns = new FileTypeAssocTable<>();

  public IgnoredPatternSet() {
    masks = new LinkedHashSet<>();
  }

  public IgnoredPatternSet(@NotNull List<String> masks) {
    FileNameMatcherFactory fileNameMatcherFactory = null;
    this.masks = new LinkedHashSet<>(masks.size());
    for (String ignoredFile : masks) {
      if (ignorePatterns.findAssociatedFileType(ignoredFile) == null) {
        this.masks.add(ignoredFile);
        if (fileNameMatcherFactory == null) {
          fileNameMatcherFactory = FileNameMatcherFactory.getInstance();
        }
        ignorePatterns.addAssociation(fileNameMatcherFactory.createMatcher(ignoredFile), Boolean.TRUE);
      }
    }
  }

  @ApiStatus.Internal
  public @NotNull Set<String> getIgnoreMasks() {
    return Collections.unmodifiableSet(masks);
  }

  public void setIgnoreMasks(@NotNull String list) {
    clearPatterns();

    StringTokenizer tokenizer = new StringTokenizer(list, ";");
    while (tokenizer.hasMoreTokens()) {
      addIgnoreMask(tokenizer.nextToken());
    }
  }

  @ApiStatus.Internal
  public void addIgnoreMask(@NotNull String ignoredFile) {
    if (ignorePatterns.findAssociatedFileType(ignoredFile) == null) {
      masks.add(ignoredFile);
      ignorePatterns.addAssociation(FileNameMatcherFactory.getInstance().createMatcher(ignoredFile), Boolean.TRUE);
    }
  }

  public boolean isIgnored(@NotNull CharSequence fileName) {
    if (ignorePatterns.findAssociatedFileType(fileName) == Boolean.TRUE) {
      return true;
    }

    //Quite a hack, but still we need to have some name, which
    //won't be caught by VFS for sure.
    return StringUtilRt.endsWith(fileName, FileUtil.ASYNC_DELETE_EXTENSION);
  }

  @ApiStatus.Internal
  public void clearPatterns() {
    masks.clear();
    ignorePatterns.removeAllAssociations(Boolean.TRUE);
  }
}
PK          [zZ  Z  7   org/jetbrains/jps/model/ex/JpsElementContainerImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.ex;

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.*;

import java.util.Map;
import java.util.function.Supplier;

@ApiStatus.Internal
public final class JpsElementContainerImpl extends JpsElementContainerEx implements JpsElementContainer {
  private final Object myDataLock = new Object();
  private final Map<JpsElementChildRole<?>, JpsElement> myElements = new Object2ObjectOpenHashMap<>(1);
  private final @NotNull JpsCompositeElementBase<?> myParent;

  public JpsElementContainerImpl(@NotNull JpsCompositeElementBase<?> parent) {
    myParent = parent;
  }

  public JpsElementContainerImpl(@NotNull JpsElementContainerEx original, @NotNull JpsCompositeElementBase<?> parent) {
    myParent = parent;
    synchronized (original.getDataLock()) {
      for (Map.Entry<JpsElementChildRole<?>, JpsElement> entry : original.getElementsMap().entrySet()) {
        final JpsElementChildRole role = entry.getKey();
        final JpsElement copy = entry.getValue().getBulkModificationSupport().createCopy();
        JpsElementBase.setParent(copy, myParent);
        myElements.put(role, copy);
      }
    }
  }

  @Override
  public <T extends JpsElement> T getChild(@NotNull JpsElementChildRole<T> role) {
    synchronized (myDataLock) {
      //noinspection unchecked
      return (T)myElements.get(role);
    }
  }

  @Override
  public @NotNull <T extends JpsElement, P, K extends JpsElementChildRole<T> & JpsElementParameterizedCreator<T, P>> T setChild(@NotNull K role, @NotNull P param) {
    final T child = role.create(param);
    return setChild(role, child);
  }

  @Override
  public @NotNull <T extends JpsElement, K extends JpsElementChildRole<T> & JpsElementCreator<T>> T setChild(@NotNull K role) {
    final T child = role.create();
    return setChild(role, child);
  }

  @Override
  public @NotNull <T extends JpsElement, K extends JpsElementChildRole<T> & JpsElementCreator<T>> T getOrSetChild(@NotNull K role) {
    synchronized (myDataLock) {
      final T cached = (T)myElements.get(role);
      if (cached != null) {
        return cached;
      }
      return putChild(role, role.create());
    }
  }

  @Override
  public <T extends JpsElement, P, K extends JpsElementChildRole<T> & JpsElementParameterizedCreator<T, P>> T getOrSetChild(@NotNull K role, @NotNull Supplier<P> param) {
    synchronized (myDataLock) {
      final T cached = (T)myElements.get(role);
      if (cached != null) {
        return cached;
      }
      return putChild(role, role.create(param.get()));
    }
  }

  @Override
  public <T extends JpsElement> T setChild(JpsElementChildRole<T> role, T child) {
    synchronized (myDataLock) {
      return putChild(role, child);
    }
  }

  private @NotNull <T extends JpsElement> T putChild(JpsElementChildRole<T> role, T child) {
    JpsElementBase.setParent(child, myParent);
    myElements.put(role, child);
    return child;
  }

  @Override
  public <T extends JpsElement> void removeChild(@NotNull JpsElementChildRole<T> role) {
    //noinspection unchecked
    final T removed;
    synchronized (myDataLock) {
      removed = (T)myElements.remove(role);
    }
    if (removed == null) return;
    JpsElementBase.setParent(removed, null);
  }

  @Override
  protected Object getDataLock() {
    return myDataLock;
  }

  @Override
  protected Map<JpsElementChildRole<?>, JpsElement> getElementsMap() {
    return myElements;
  }
}
PK          1    5   org/jetbrains/jps/model/impl/JpsDummyElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.ex.JpsElementBase;

final class JpsDummyElementImpl extends JpsElementBase<JpsDummyElementImpl> implements JpsDummyElement {
  @Override
  public @NotNull JpsDummyElementImpl createCopy() {
    return new JpsDummyElementImpl();
  }
}
PK          *Y٘M  M  :   org/jetbrains/jps/model/impl/JpsElementCollectionImpl.java// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import com.intellij.util.containers.FilteringIterator;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsElementBase;

import java.util.*;

@ApiStatus.Internal
public class JpsElementCollectionImpl<E extends JpsElement> extends JpsElementBase<JpsElementCollectionImpl<E>> implements JpsElementCollection<E> {
  private final List<E> myElements;
  private final Map<E, E> myCopyToOriginal;
  private final JpsElementChildRole<E> myChildRole;

  JpsElementCollectionImpl(JpsElementChildRole<E> role) {
    myChildRole = role;
    myElements = new ArrayList<>();
    myCopyToOriginal = null;
  }

  protected JpsElementCollectionImpl(JpsElementCollectionImpl<E> original) {
    myChildRole = original.myChildRole;
    myElements = new ArrayList<>(original.myElements.size());
    myCopyToOriginal = new HashMap<>(original.myElements.size());
    for (E e : original.myElements) {
      //noinspection unchecked
      final E copy = (E)e.getBulkModificationSupport().createCopy();
      setParent(copy, this);
      myElements.add(copy);
      myCopyToOriginal.put(copy, e);
    }
  }

  @Override
  public List<E> getElements() {
    return myElements;
  }

  @Override
  public <X extends JpsTypedElement<P>, P extends JpsElement> Iterable<X> getElementsOfType(final @NotNull JpsElementType<P> type) {
    return new JpsElementIterable<>(type);
  }

  @Override
  public @NotNull E addChild(@NotNull JpsElementCreator<E> creator) {
    return addChild(creator.create());
  }

  @Override
  public <X extends E> X addChild(X element) {
    myElements.add(element);
    setParent(element, this);
    return element;
  }

  @Override
  public void removeChild(@NotNull E element) {
    final boolean removed = myElements.remove(element);
    if (removed) {
      setParent(element, null);
    }
  }

  @Override
  public void removeAllChildren() {
    List<E> elements = new ArrayList<>(myElements);
    for (E element : elements) {
      removeChild(element);
    }
  }

  @Override
  public @NotNull JpsElementCollectionImpl<E> createCopy() {
    return new JpsElementCollectionImpl<>(this);
  }

  private final class JpsElementIterable<X extends JpsTypedElement<P>, P extends JpsElement> implements Iterable<X> {
    private final JpsElementType<? extends JpsElement> myType;

    JpsElementIterable(JpsElementType<P> type) {
      myType = type;
    }

    @Override
    public Iterator<X> iterator() {
      //noinspection unchecked
      Iterator<JpsTypedElement<?>> iterator = (Iterator<JpsTypedElement<?>>)myElements.iterator();
      return new FilteringIterator<>(iterator, e -> e.getType().equals(myType));
    }
  }
}
PK          r    7   org/jetbrains/jps/model/impl/JpsElementFactoryImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsReferenceCustomFactory;
import org.jetbrains.jps.model.library.JpsLibraryReference;
import org.jetbrains.jps.model.library.JpsLibraryType;
import org.jetbrains.jps.model.library.JpsTypedLibrary;
import org.jetbrains.jps.model.library.impl.JpsLibraryImpl;
import org.jetbrains.jps.model.library.impl.JpsLibraryReferenceImpl;
import org.jetbrains.jps.model.library.impl.JpsSdkReferenceImpl;
import org.jetbrains.jps.model.library.impl.sdk.JpsSdkImpl;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.library.sdk.JpsSdkReference;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;
import org.jetbrains.jps.model.module.*;
import org.jetbrains.jps.model.module.impl.JpsModuleImpl;
import org.jetbrains.jps.model.module.impl.JpsModuleReferenceImpl;
import org.jetbrains.jps.model.module.impl.JpsModuleSourceRootImpl;
import org.jetbrains.jps.service.JpsServiceManager;

@ApiStatus.Internal
public final class JpsElementFactoryImpl extends JpsElementFactory {
  private volatile Boolean hasCustomReferenceFactory;
  
  @Override
  public JpsModel createModel() {
    return new JpsModelImpl();
  }

  @Override
  public <P extends JpsElement> JpsModule createModule(@NotNull String name, @NotNull JpsModuleType<P> type, @NotNull P properties) {
    return new JpsModuleImpl<>(type, name, properties);
  }


  @Override
  public <P extends JpsElement> JpsTypedLibrary<P> createLibrary(@NotNull String name,
                                                                   @NotNull JpsLibraryType<P> type,
                                                                   @NotNull P properties) {
    return new JpsLibraryImpl<>(name, type, properties);
  }

  @Override
  public <P extends JpsElement> JpsTypedLibrary<JpsSdk<P>> createSdk(@NotNull String name, @Nullable String homePath,
                                                                     @Nullable String versionString, @NotNull JpsSdkType<P> type,
                                                                     @NotNull P properties) {
    return createLibrary(name, type, new JpsSdkImpl<>(homePath, versionString, type, properties));
  }

  @Override
  public @NotNull <P extends JpsElement> JpsModuleSourceRoot createModuleSourceRoot(@NotNull String url,
                                                                                    @NotNull JpsModuleSourceRootType<P> type,
                                                                                    @NotNull P properties) {
    return new JpsModuleSourceRootImpl<>(url, type, properties);
  }

  @Override
  public @NotNull JpsModuleReference createModuleReference(@NotNull String moduleName) {
    if (hasCustomReferenceFactory()) {
      for (JpsReferenceCustomFactory extension : JpsServiceManager.getInstance().getExtensions(JpsReferenceCustomFactory.class)) {
        if (extension.isEnabled()) {
          return extension.createModuleReference(moduleName);
        }
      }
    }
    return new JpsModuleReferenceImpl(moduleName);
  }

  @Override
  public @NotNull JpsLibraryReference createLibraryReference(@NotNull String libraryName,
                                                             @NotNull JpsElementReference<? extends JpsCompositeElement> parentReference) {
    if (hasCustomReferenceFactory()) {
      for (JpsReferenceCustomFactory extension : JpsServiceManager.getInstance().getExtensions(JpsReferenceCustomFactory.class)) {
        if (extension.isEnabled()) {
          return extension.createLibraryReference(libraryName, parentReference);
        }
      }
    }
    return new JpsLibraryReferenceImpl(libraryName, parentReference);
  }

  @Override
  public @NotNull <P extends JpsElement> JpsSdkReference<P> createSdkReference(@NotNull String sdkName, @NotNull JpsSdkType<P> sdkType) {
    return new JpsSdkReferenceImpl<>(sdkName, sdkType, createGlobalReference());
  }

  private boolean hasCustomReferenceFactory() {
    if (hasCustomReferenceFactory == null) {
      boolean hasEnabledFactory = false;
      for (JpsReferenceCustomFactory extension : JpsServiceManager.getInstance().getExtensions(JpsReferenceCustomFactory.class)) {
        if (extension.isEnabled()) {
          hasEnabledFactory = true;
          break;
        }
      }
      hasCustomReferenceFactory = hasEnabledFactory;
    }
    return hasCustomReferenceFactory;
  }
  
  @Override
  public @NotNull JpsElementReference<JpsProject> createProjectReference() {
    return new JpsProjectElementReference();
  }

  @Override
  public @NotNull JpsElementReference<JpsGlobal> createGlobalReference() {
    return new JpsGlobalElementReference();
  }

  @Override
  public @NotNull JpsDummyElement createDummyElement() {
    return new JpsDummyElementImpl();
  }

  @Override
  public @NotNull <D> JpsSimpleElement<D> createSimpleElement(@NotNull D data) {
    return new JpsSimpleElementImpl<>(data);
  }
}
PK          N:~	  ~	  E   org/jetbrains/jps/model/impl/JpsEncodingConfigurationServiceImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;

import java.util.Map;

@ApiStatus.Internal
public final class JpsEncodingConfigurationServiceImpl extends JpsEncodingConfigurationService {
  private static final JpsElementChildRoleBase<JpsSimpleElement<String>> ENCODING_ROLE = JpsElementChildRoleBase.create("encoding");

  @Override
  public @Nullable String getGlobalEncoding(@NotNull JpsGlobal global) {
    JpsSimpleElement<String> encoding = global.getContainer().getChild(ENCODING_ROLE);
    return encoding != null ? encoding.getData() : null;
  }

  @Override
  public void setGlobalEncoding(@NotNull JpsGlobal global, @Nullable String encoding) {
    if (encoding != null) {
      global.getContainer().setChild(ENCODING_ROLE, JpsElementFactory.getInstance().createSimpleElement(encoding));
    }
    else {
      global.getContainer().removeChild(ENCODING_ROLE);
    }
  }

  @Override
  public @Nullable String getProjectEncoding(@NotNull JpsModel model) {
    JpsEncodingProjectConfiguration configuration = getEncodingConfiguration(model.getProject());
    if (configuration != null) {
      String projectEncoding = configuration.getProjectEncoding();
      if (projectEncoding != null) {
        return projectEncoding;
      }
    }
    return getGlobalEncoding(model.getGlobal());
  }

  @Override
  public @Nullable JpsEncodingProjectConfiguration getEncodingConfiguration(@NotNull JpsProject project) {
    return project.getContainer().getChild(JpsEncodingProjectConfigurationImpl.ROLE);
  }

  @Override
  public @NotNull JpsEncodingProjectConfiguration setEncodingConfiguration(@NotNull JpsProject project,
                                                                           @Nullable String projectEncoding,
                                                                           @NotNull Map<String, String> urlToEncoding) {
    JpsEncodingProjectConfigurationImpl configuration = new JpsEncodingProjectConfigurationImpl(urlToEncoding, projectEncoding);
    return project.getContainer().setChild(JpsEncodingProjectConfigurationImpl.ROLE, configuration);
  }
}
PK          0x    E   org/jetbrains/jps/model/impl/JpsEncodingProjectConfigurationImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfoRt;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.Strings;
import com.intellij.util.text.XmlCharsetDetector;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.JpsEncodingConfigurationService;
import org.jetbrains.jps.model.JpsEncodingProjectConfiguration;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.util.JpsPathUtil;

import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

@ApiStatus.Internal
public final class JpsEncodingProjectConfigurationImpl extends JpsElementBase<JpsEncodingProjectConfigurationImpl>
  implements JpsEncodingProjectConfiguration {
  private static final Logger LOG = Logger.getInstance(JpsEncodingProjectConfigurationImpl.class);
  public static final JpsElementChildRole<JpsEncodingProjectConfiguration> ROLE = JpsElementChildRoleBase.create("encoding configuration");
  private static final String XML_NAME_SUFFIX = ".xml";
  private final Map<String, String> myUrlToEncoding = new HashMap<>();
  private final String myProjectEncoding;

  public JpsEncodingProjectConfigurationImpl(Map<String, String> urlToEncoding, String projectEncoding) {
    myUrlToEncoding.putAll(urlToEncoding);
    myProjectEncoding = projectEncoding;
  }

  @Override
  public @Nullable String getEncoding(@NotNull File file) {
    if (isXmlFile(file)) {
      try {
        String encoding = XmlCharsetDetector.extractXmlEncodingFromProlog(FileUtil.loadFileBytes(file));
        if (encoding != null) {
          return encoding;
        }
      }
      catch (IOException e) {
        LOG.info("Cannot detect encoding for xml file " + file.getAbsolutePath(), e);
      }
    }

    if (!myUrlToEncoding.isEmpty()) {

      File current = file;
      while (current != null) {
        String encoding = myUrlToEncoding.get(JpsPathUtil.pathToUrl(FileUtilRt.toSystemIndependentName(current.getPath())));

        if (encoding != null) {
          return encoding;
        }

        current = FileUtilRt.getParentFile(current);
      }
    }

    if (myProjectEncoding != null) {
      return myProjectEncoding;
    }

    final JpsModel model = getModel();
    assert model != null;
    return JpsEncodingConfigurationService.getInstance().getGlobalEncoding(model.getGlobal());
  }

  private static boolean isXmlFile(File file) {
    String fileName = file.getName();
    return SystemInfoRt.isFileSystemCaseSensitive
           ? fileName.endsWith(XML_NAME_SUFFIX)
           : Strings.endsWithIgnoreCase(fileName, XML_NAME_SUFFIX);
  }

  @Override
  public @NotNull Map<String, String> getUrlToEncoding() {
    return Collections.unmodifiableMap(myUrlToEncoding);
  }

  @Override
  public @Nullable String getProjectEncoding() {
    return myProjectEncoding;
  }

  @Override
  public @NotNull JpsEncodingProjectConfigurationImpl createCopy() {
    return new JpsEncodingProjectConfigurationImpl(myUrlToEncoding, myProjectEncoding);
  }
}
PK          L[  [  9   org/jetbrains/jps/model/impl/JpsExElementFactoryImpl.java/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementContainerEx;
import org.jetbrains.jps.model.ex.JpsElementContainerImpl;
import org.jetbrains.jps.model.ex.JpsExElementFactory;

@ApiStatus.Internal
public final class JpsExElementFactoryImpl extends JpsExElementFactory {
  @Override
  public JpsElementContainerEx createContainer(@NotNull JpsCompositeElementBase<?> parent) {
    return new JpsElementContainerImpl(parent);
  }

  @Override
  public JpsElementContainerEx createContainerCopy(@NotNull JpsElementContainerEx original,
                                                            @NotNull JpsCompositeElementBase<?> parent) {
    return new JpsElementContainerImpl(original, parent);
  }

  @Override
  public <E extends JpsElement> JpsElementCollection<E> createCollection(JpsElementChildRole<E> role) {
    return new JpsElementCollectionImpl<>(role);
  }

  @Override
  public <E extends JpsNamedElement> JpsNamedElementCollection<E> createNamedElementCollection(JpsElementChildRole<E> role) {
    return new JpsNamedElementCollectionImpl<>(role);
  }
}
PK          _6    7   org/jetbrains/jps/model/impl/JpsExcludePatternImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsExcludePattern;
import org.jetbrains.jps.model.ex.JpsElementBase;

@ApiStatus.Internal
public final class JpsExcludePatternImpl extends JpsElementBase<JpsExcludePatternImpl> implements JpsExcludePattern {
  private final String myBaseDirUrl;
  private final String myPattern;

  public JpsExcludePatternImpl(@NotNull String baseDirUrl, @NotNull String pattern) {
    myBaseDirUrl = baseDirUrl;
    myPattern = pattern;
  }

  @Override
  public @NotNull String getBaseDirUrl() {
    return myBaseDirUrl;
  }

  @Override
  public @NotNull String getPattern() {
    return myPattern;
  }

  @Override
  public @NotNull JpsExcludePatternImpl createCopy() {
    return new JpsExcludePatternImpl(myBaseDirUrl, myPattern);
  }
}
PK          oΠq    ?   org/jetbrains/jps/model/impl/JpsFileTypesConfigurationImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.JpsFileTypesConfiguration;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;

final class JpsFileTypesConfigurationImpl extends JpsElementBase<JpsFileTypesConfigurationImpl> implements JpsFileTypesConfiguration {
  public static final JpsElementChildRole<JpsFileTypesConfiguration> ROLE = JpsElementChildRoleBase.create("file types");
  private String myIgnoredPatternString;

  JpsFileTypesConfigurationImpl() {
    this("CVS;.DS_Store;.svn;.pyc;.pyo;*.pyc;*.pyo;.git;*.hprof;_svn;.hg;*.lib;*~;__pycache__;.bundle;vssver.scc;vssver2.scc;*.rbc;");
  }

  private JpsFileTypesConfigurationImpl(String ignoredPatternString) {
    myIgnoredPatternString = ignoredPatternString;
  }

  @Override
  public @NotNull JpsFileTypesConfigurationImpl createCopy() {
    return new JpsFileTypesConfigurationImpl(myIgnoredPatternString);
  }

  @Override
  public String getIgnoredPatternString() {
    return myIgnoredPatternString;
  }

  @Override
  public void setIgnoredPatternString(@NotNull String ignoredPatternString) {
    if (!myIgnoredPatternString.equals(ignoredPatternString)) {
      myIgnoredPatternString = ignoredPatternString;
    }
  }
}
PK          M  M  /   org/jetbrains/jps/model/impl/JpsGlobalBase.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementReference;
import org.jetbrains.jps.model.JpsFileTypesConfiguration;
import org.jetbrains.jps.model.JpsGlobal;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.serialization.JpsPathMapper;

@ApiStatus.Internal
public abstract class JpsGlobalBase extends JpsRootElementBase<JpsGlobalBase> implements JpsGlobal {
  private JpsPathMapper myPathMapper = JpsPathMapper.IDENTITY;

  protected JpsGlobalBase(@NotNull JpsModel model) { 
    super(model);
    myContainer.setChild(JpsFileTypesConfigurationImpl.ROLE, new JpsFileTypesConfigurationImpl());
  }

  @Override
  public @NotNull JpsFileTypesConfiguration getFileTypesConfiguration() {
    return myContainer.getChild(JpsFileTypesConfigurationImpl.ROLE);
  }

  @Override
  public @NotNull JpsPathMapper getPathMapper() {
    return myPathMapper;
  }

  @Override
  public void setPathMapper(@NotNull JpsPathMapper pathMapper) {
    myPathMapper = pathMapper;
  }

  @Override
  public @NotNull JpsElementReference<JpsGlobal> createReference() {
    return new JpsGlobalElementReference();
  }
}
PK          "cZ  Z  ;   org/jetbrains/jps/model/impl/JpsGlobalElementReference.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsGlobal;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.ex.JpsElementReferenceBase;

@ApiStatus.Internal
public final class JpsGlobalElementReference extends JpsElementReferenceBase<JpsGlobalElementReference, JpsGlobal> {
  @Override
  public JpsGlobal resolve() {
    final JpsModel model = getModel();
    return model != null ? model.getGlobal() : null;
  }

  @Override
  public @NotNull JpsGlobalElementReference createCopy() {
    return new JpsGlobalElementReference();
  }

  @Override
  public String toString() {
    return "global ref";
  }
}
PK          WCB	  	  /   org/jetbrains/jps/model/impl/JpsGlobalImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryCollection;
import org.jetbrains.jps.model.library.JpsLibraryType;
import org.jetbrains.jps.model.library.JpsTypedLibrary;
import org.jetbrains.jps.model.library.impl.JpsLibraryCollectionImpl;
import org.jetbrains.jps.model.library.impl.JpsLibraryRole;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;

final class JpsGlobalImpl extends JpsGlobalBase {
  private final JpsLibraryCollectionImpl myLibraryCollection;

  JpsGlobalImpl(@NotNull JpsModel model) {
    super(model);
    myLibraryCollection = new JpsLibraryCollectionImpl(myContainer.setChild(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE));
  }

  @Override
  public @NotNull
  <P extends JpsElement, LibraryType extends JpsLibraryType<P> & JpsElementTypeWithDefaultProperties<P>>
  JpsLibrary addLibrary(@NotNull LibraryType libraryType, final @NotNull String name) {
    return myLibraryCollection.addLibrary(name, libraryType);
  }

  @Override
  public <P extends JpsElement> JpsTypedLibrary<JpsSdk<P>> addSdk(@NotNull String name, @Nullable String homePath,
                                                                  @Nullable String versionString, @NotNull JpsSdkType<P> type,
                                                                  @NotNull P properties) {
    JpsTypedLibrary<JpsSdk<P>> sdk = JpsElementFactory.getInstance().createSdk(name, homePath, versionString, type, properties);
    myLibraryCollection.addLibrary(sdk);
    return sdk;
  }

  @Override
  public <P extends JpsElement, SdkType extends JpsSdkType<P> & JpsElementTypeWithDefaultProperties<P>> JpsTypedLibrary<JpsSdk<P>>
  addSdk(@NotNull String name, @Nullable String homePath, @Nullable String versionString, @NotNull SdkType type) {
    return addSdk(name, homePath, versionString, type, type.createDefaultProperties());
  }

  @Override
  public @NotNull JpsLibraryCollection getLibraryCollection() {
    return myLibraryCollection;
  }
}
PK          0SȄ    .   org/jetbrains/jps/model/impl/JpsModelImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementReference;
import org.jetbrains.jps.model.JpsModel;

@ApiStatus.Internal
public final class JpsModelImpl implements JpsModel {
  private final JpsProjectImpl myProject;
  private final JpsGlobalImpl myGlobal;

  public JpsModelImpl() {
    myProject = new JpsProjectImpl(this);
    myGlobal = new JpsGlobalImpl(this);
  }

  @Override
  public @NotNull JpsProjectImpl getProject() {
    return myProject;
  }

  @Override
  public @NotNull JpsGlobalImpl getGlobal() {
    return myGlobal;
  }

  @Override
  public void registerExternalReference(@NotNull JpsElementReference<?> reference) {
    myProject.addExternalReference(reference);
  }
}
PK          0j    ?   org/jetbrains/jps/model/impl/JpsNamedElementCollectionImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.JpsElementCreator;
import org.jetbrains.jps.model.JpsNamedElement;
import org.jetbrains.jps.model.JpsNamedElementCollection;

import java.util.HashMap;
import java.util.Map;

final class JpsNamedElementCollectionImpl<E extends JpsNamedElement> extends JpsElementCollectionImpl<E> implements
                                                                                                         JpsNamedElementCollection<E> {
  private final Map<String, E> myElementByName = new HashMap<>();
  
  JpsNamedElementCollectionImpl(JpsElementChildRole<E> role) {
    super(role);
  }

  JpsNamedElementCollectionImpl(JpsNamedElementCollectionImpl<E> original) {
    super(original);
    for (E element : getElements()) {
      myElementByName.put(element.getName(), element);
    }
  }

  @Override
  public @Nullable E findChild(@NotNull String name) {
    return myElementByName.get(name);
  }

  @Override
  public @NotNull E addChild(@NotNull JpsElementCreator<E> creator) {
    E child = super.addChild(creator);
    myElementByName.put(child.getName(), child);
    return child;
  }

  @Override
  public <X extends E> X addChild(X element) {
    X child = super.addChild(element);
    myElementByName.put(child.getName(), child);
    return child;
  }

  @Override
  public void removeChild(@NotNull E element) {
    super.removeChild(element);
    myElementByName.remove(element.getName());
  }

  @Override
  public void removeAllChildren() {
    super.removeAllChildren();
    myElementByName.clear();
  }

  @Override
  public @NotNull JpsElementCollectionImpl<E> createCopy() {
    return new JpsNamedElementCollectionImpl<>(this);
  }
}
PK          ;'  '  >   org/jetbrains/jps/model/impl/JpsNamedElementReferenceBase.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;

import java.util.List;

public abstract class JpsNamedElementReferenceBase<S extends JpsNamedElement, T extends JpsNamedElement, Self extends JpsNamedElementReferenceBase<S, T, Self>>
  extends JpsCompositeElementBase<Self> implements JpsElementReference<T> {
  private static final JpsElementChildRole<JpsElementReference<? extends JpsCompositeElement>> PARENT_REFERENCE_ROLE = JpsElementChildRoleBase
    .create("parent");
  protected final @NotNull String myElementName;

  protected JpsNamedElementReferenceBase(@NotNull String elementName, @NotNull JpsElementReference<? extends JpsCompositeElement> parentReference) {
    myElementName = elementName;
    myContainer.setChild(PARENT_REFERENCE_ROLE, parentReference);
  }

  /**
   * @deprecated creating copies isn't supported in for all elements in JPS anymore; if you need to create a copy for your element,
   * write the corresponding code in your class directly.
   */
  @Deprecated
  protected JpsNamedElementReferenceBase(JpsNamedElementReferenceBase<S, T, Self> original) {
    super(original);
    myElementName = original.myElementName;
  }

  @Override
  public T resolve() {
    final JpsCompositeElement parent = getParentReference().resolve();
    if (parent == null) return null;

    JpsElementCollection<? extends S> collection = getCollection(parent);
    if (collection == null) return null;

    if (collection instanceof JpsNamedElementCollection<?>) {
      S element = ((JpsNamedElementCollection<? extends S>)collection).findChild(myElementName);
      return element != null ? resolve(element) : null;
    }

    final List<? extends S> elements = collection.getElements();
    for (S element : elements) {
      if (element.getName().equals(myElementName)) {
        T resolved = resolve(element);
        if (resolved != null) {
          return resolved;
        }
      }
    }
    return null;
  }

  /**
   * @deprecated override {@link #getNamedElementCollection} instead to speed up {@link #resolve()}
   */
  @SuppressWarnings("DeprecatedIsStillUsed")
  @Deprecated
  protected @Nullable JpsElementCollection<? extends S> getCollection(@NotNull JpsCompositeElement parent) {
    return getNamedElementCollection(parent);
  }
  
  protected @Nullable JpsNamedElementCollection<? extends S> getNamedElementCollection(@NotNull JpsCompositeElement parent) {
    return null;
  }

  protected abstract @Nullable T resolve(S element);

  public JpsElementReference<? extends JpsCompositeElement> getParentReference() {
    return myContainer.getChild(PARENT_REFERENCE_ROLE);
  }

  @Override
  public JpsElementReference<T> asExternal(@NotNull JpsModel model) {
    model.registerExternalReference(this);
    return this;
  }
}
PK          gl
  l
  >   org/jetbrains/jps/model/impl/JpsNamedElementReferenceImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsElementCollectionRole;
import org.jetbrains.jps.model.ex.JpsNamedElementCollectionRole;

/**
 * This class is for internal use only, override {@link JpsNamedElementReferenceBase} instead.
 */
@ApiStatus.Internal
public abstract class JpsNamedElementReferenceImpl<T extends JpsNamedElement, Self extends JpsNamedElementReferenceImpl<T, Self>> extends JpsNamedElementReferenceBase<T, T, Self> {
  /**
   * @deprecated use {@link #getCollectionRole()} instead
   */
  @SuppressWarnings("DeprecatedIsStillUsed") 
  @Deprecated
  protected final @Nullable JpsElementCollectionRole<? extends T> myCollectionRole;
  private final JpsElementChildRoleBase<? extends JpsElementCollection<? extends T>> myActualCollectionRole;

  /**
   * @deprecated use {@link #JpsNamedElementReferenceImpl(JpsNamedElementCollectionRole, String, JpsElementReference)} instead JpsNamedElementReferenceImpl}
   */
  @Deprecated
  protected JpsNamedElementReferenceImpl(@NotNull JpsElementCollectionRole<? extends T> role, @NotNull String elementName,
                                         @NotNull JpsElementReference<? extends JpsCompositeElement> parentReference) {
    super(elementName, parentReference);
    myCollectionRole = role;
    myActualCollectionRole = role;
  }

  protected JpsNamedElementReferenceImpl(@NotNull JpsNamedElementCollectionRole<? extends T> role, @NotNull String elementName,
                                         @NotNull JpsElementReference<? extends JpsCompositeElement> parentReference) {
    super(elementName, parentReference);
    myCollectionRole = null;
    myActualCollectionRole = role;
  }

  protected JpsElementChildRoleBase<? extends JpsElementCollection<? extends T>> getCollectionRole() {
    return myActualCollectionRole;
  }

  protected JpsNamedElementReferenceImpl(JpsNamedElementReferenceImpl<T, Self> original) {
    super(original);
    myCollectionRole = original.myCollectionRole;
    myActualCollectionRole = original.myActualCollectionRole;
  }

  @Override
  protected T resolve(T element) {
    return element;
  }

  @Override
  protected @Nullable JpsElementCollection<? extends T> getCollection(@NotNull JpsCompositeElement parent) {
    return parent.getContainer().getChild(myActualCollectionRole);
  }
}
PK          J
    0   org/jetbrains/jps/model/impl/JpsProjectBase.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsElementCollectionRole;
import org.jetbrains.jps.model.impl.runConfiguration.JpsRunConfigurationImpl;
import org.jetbrains.jps.model.runConfiguration.JpsRunConfiguration;
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
import org.jetbrains.jps.model.runConfiguration.JpsTypedRunConfiguration;

import java.util.List;

@ApiStatus.Internal
public abstract class JpsProjectBase extends JpsRootElementBase<JpsProjectBase> implements JpsProject {
  private static final JpsElementCollectionRole<JpsRunConfiguration>
    RUN_CONFIGURATIONS_ROLE = JpsElementCollectionRole.create(JpsElementChildRoleBase.create("run configuration"));

  protected JpsProjectBase(@NotNull JpsModel model) { 
    super(model);
    myContainer.setChild(RUN_CONFIGURATIONS_ROLE);
  }

  @Override
  public @NotNull <P extends JpsElement> Iterable<JpsTypedRunConfiguration<P>> getRunConfigurations(JpsRunConfigurationType<P> type) {
    return getRunConfigurationCollection().getElementsOfType(type);
  }

  @Override
  public @NotNull List<JpsRunConfiguration> getRunConfigurations() {
    return getRunConfigurationCollection().getElements();
  }

  @Override
  public @NotNull <P extends JpsElement> JpsTypedRunConfiguration<P> addRunConfiguration(@NotNull String name,
                                                                                         @NotNull JpsRunConfigurationType<P> type,
                                                                                         @NotNull P properties) {
    return getRunConfigurationCollection().addChild(new JpsRunConfigurationImpl<>(name, type, properties));
  }

  private JpsElementCollection<JpsRunConfiguration> getRunConfigurationCollection() {
    return myContainer.getChild(RUN_CONFIGURATIONS_ROLE);
  }

  @Override
  public @NotNull JpsElementReference<JpsProject> createReference() {
    return new JpsProjectElementReference();
  }
}
PK          /c  c  <   org/jetbrains/jps/model/impl/JpsProjectElementReference.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.ex.JpsElementReferenceBase;

@ApiStatus.Internal
public final class JpsProjectElementReference extends JpsElementReferenceBase<JpsProjectElementReference, JpsProject> {
  @Override
  public JpsProject resolve() {
    final JpsModel model = getModel();
    return model != null ? model.getProject() : null;
  }

  @Override
  public @NotNull JpsProjectElementReference createCopy() {
    return new JpsProjectElementReference();
  }

  @Override
  public String toString() {
    return "project ref";
  }
}
PK              0   org/jetbrains/jps/model/impl/JpsProjectImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsElementCollectionRole;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryCollection;
import org.jetbrains.jps.model.library.JpsLibraryType;
import org.jetbrains.jps.model.library.impl.JpsLibraryCollectionImpl;
import org.jetbrains.jps.model.library.impl.JpsLibraryRole;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleType;
import org.jetbrains.jps.model.module.JpsSdkReferencesTable;
import org.jetbrains.jps.model.module.JpsTypedModule;
import org.jetbrains.jps.model.module.impl.JpsModuleImpl;
import org.jetbrains.jps.model.module.impl.JpsModuleRole;
import org.jetbrains.jps.model.module.impl.JpsSdkReferencesTableImpl;

import java.util.List;
import java.util.Objects;

final class JpsProjectImpl extends JpsProjectBase {
  private static final JpsElementCollectionRole<JpsElementReference<?>> EXTERNAL_REFERENCES_COLLECTION_ROLE =
    JpsElementCollectionRole.create(JpsElementChildRoleBase.create("external reference"));
  private final JpsLibraryCollection myLibraryCollection;
  private String myName = "";

  JpsProjectImpl(@NotNull JpsModel model) {
    super(model);
    myContainer.setChild(JpsModuleRole.MODULE_COLLECTION_ROLE);
    myContainer.setChild(EXTERNAL_REFERENCES_COLLECTION_ROLE);
    myContainer.setChild(JpsSdkReferencesTableImpl.ROLE);
    myLibraryCollection = new JpsLibraryCollectionImpl(myContainer.setChild(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE));
  }

  @Override
  public @NotNull String getName() {
    return myName;
  }

  @Override
  public void setName(@NotNull String name) {
    if (!Objects.equals(myName, name)) {
      myName = name;
    }
  }

  public void addExternalReference(@NotNull JpsElementReference<?> reference) {
    myContainer.getChild(EXTERNAL_REFERENCES_COLLECTION_ROLE).addChild(reference);
  }

  @Override
  public @NotNull
  <P extends JpsElement, ModuleType extends JpsModuleType<P> & JpsElementTypeWithDefaultProperties<P>>
  JpsModule addModule(final @NotNull String name, @NotNull ModuleType moduleType) {
    final JpsElementCollection<JpsModule> collection = myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE);
    return collection.addChild(new JpsModuleImpl<>(moduleType, name, moduleType.createDefaultProperties()));
  }

  @Override
  public @NotNull <P extends JpsElement, LibraryType extends JpsLibraryType<P> & JpsElementTypeWithDefaultProperties<P>>
  JpsLibrary addLibrary(@NotNull String name, @NotNull LibraryType libraryType) {
    return myLibraryCollection.addLibrary(name, libraryType);
  }

  @Override
  public @NotNull List<JpsModule> getModules() {
    return myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE).getElements();
  }

  @Override
  public @NotNull <P extends JpsElement> Iterable<JpsTypedModule<P>> getModules(JpsModuleType<P> type) {
    return myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE).getElementsOfType(type);
  }

  @Override
  public void addModule(@NotNull JpsModule module) {
    myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE).addChild(module);
  }

  @Override
  public void removeModule(@NotNull JpsModule module) {
    myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE).removeChild(module);
  }

  @Override
  public @NotNull JpsLibraryCollection getLibraryCollection() {
    return myLibraryCollection;
  }

  @Override
  public @NotNull JpsSdkReferencesTable getSdkReferencesTable() {
    return myContainer.getChild(JpsSdkReferencesTableImpl.ROLE);
  }
}
PK          awX  X  4   org/jetbrains/jps/model/impl/JpsRootElementBase.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;

@ApiStatus.Internal
public abstract class JpsRootElementBase<E extends JpsRootElementBase<E>> extends JpsCompositeElementBase<E> {
  private final JpsModel myModel;

  protected JpsRootElementBase(@NotNull JpsModel model) {
    super();
    myModel = model;
  }

  @Override
  public final @NotNull JpsModel getModel() {
    return myModel;
  }

  @Override
  public final @NotNull E createCopy() {
    throw new UnsupportedOperationException("'createCopy' not implemented in " + getClass().getName());
  }
}
PK          p    6   org/jetbrains/jps/model/impl/JpsSimpleElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsSimpleElement;
import org.jetbrains.jps.model.ex.JpsElementBase;

final class JpsSimpleElementImpl<D> extends JpsElementBase<JpsSimpleElementImpl<D>> implements JpsSimpleElement<D> {
  private D myData;

  JpsSimpleElementImpl(D data) {
    myData = data;
  }

  private JpsSimpleElementImpl(JpsSimpleElementImpl<D> original) {
    myData = original.myData;
  }

  @Override
  public @NotNull D getData() {
    return myData;
  }

  @Override
  public void setData(@NotNull D data) {
    if (!myData.equals(data)) {
      myData = data;
    }
  }

  @Override
  public @NotNull JpsSimpleElementImpl<D> createCopy() {
    return new JpsSimpleElementImpl<>(this);
  }
}
PK          Go>z    0   org/jetbrains/jps/model/impl/JpsUrlListImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsUrlList;
import org.jetbrains.jps.model.ex.JpsElementBase;

import java.util.ArrayList;
import java.util.List;

final class JpsUrlListImpl extends JpsElementBase<JpsUrlListImpl> implements JpsUrlList {
  private final List<String> myUrls = new ArrayList<>();

  JpsUrlListImpl() {
  }

  JpsUrlListImpl(JpsUrlListImpl list) {
    myUrls.addAll(list.myUrls);
  }

  @Override
  public @NotNull JpsUrlListImpl createCopy() {
    return new JpsUrlListImpl(this);
  }

  @Override
  public @NotNull List<String> getUrls() {
    return myUrls;
  }

  @Override
  public void addUrl(@NotNull String url) {
    myUrls.add(url);
  }

  @Override
  public void removeUrl(@NotNull String url) {
    myUrls.remove(url);
  }
}
PK          Q    0   org/jetbrains/jps/model/impl/JpsUrlListRole.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementCreator;
import org.jetbrains.jps.model.JpsUrlList;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;

@ApiStatus.Internal
public final class JpsUrlListRole extends JpsElementChildRoleBase<JpsUrlList> implements JpsElementCreator<JpsUrlList> {
  public JpsUrlListRole(String debugName) {
    super(debugName);
  }

  @Override
  public @NotNull JpsUrlList create() {
    return new JpsUrlListImpl();
  }
}
PK          K{  {  9   org/jetbrains/jps/service/impl/JpsServiceManagerImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.service.impl;

import com.intellij.openapi.progress.ProcessCanceledException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.plugin.JpsPluginManager;
import org.jetbrains.jps.service.JpsServiceManager;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

public final class JpsServiceManagerImpl extends JpsServiceManager {
  private final ConcurrentMap<Class<?>, Object> myServices = new ConcurrentHashMap<>(16, 0.75f, 1);
  private final Map<Class<?>, List<?>> myExtensions = new HashMap<>();
  private final AtomicInteger myModificationStamp = new AtomicInteger(0);
  private JpsPluginManager myPluginManager;

  @Override
  public <T> T getService(Class<T> serviceClass) {
    //noinspection unchecked
    T service = (T)myServices.get(serviceClass);
    if (service == null) {
      // confine costly service initialization to single thread for defined startup profile
      synchronized (myServices) {
        //noinspection unchecked
        service = (T)myServices.get(serviceClass);
        if (service == null) {
          final Iterator<T> iterator = ServiceLoader.load(serviceClass, serviceClass.getClassLoader()).iterator();
          if (!iterator.hasNext()) {
            throw new ServiceConfigurationError("Implementation for " + serviceClass + " not found");
          }
          final T loadedService = iterator.next();
          if (iterator.hasNext()) {
            throw new ServiceConfigurationError("More than one implementation for " + serviceClass + " found: " + loadedService.getClass() +
              " and " + iterator.next().getClass());
          }
          //noinspection unchecked
          service = (T)myServices.putIfAbsent(serviceClass, loadedService);
          if (service == null) {
            service = loadedService;
          }
        }
      }
    }
    return service;
  }

  @Override
  public <T> Iterable<T> getExtensions(Class<T> extensionClass) {
    // confine costly service initialization to single thread for defined startup profile
    synchronized (myExtensions) {
      List<?> cached = cleanupExtensionCache() ? null : myExtensions.get(extensionClass);
      if (cached == null) {
        myExtensions.put(extensionClass, cached = new ArrayList<>(loadExtensions(extensionClass)));
      }
      //noinspection unchecked
      return (List<T>)cached;
    }
  }

  @ApiStatus.Internal
  public boolean cleanupExtensionCache() {
    synchronized (myExtensions) {
      JpsPluginManager manager = myPluginManager;
      if (manager != null) {
        int stamp = manager.getModificationStamp();
        if (myModificationStamp.getAndSet(stamp) != stamp) {
          myExtensions.clear();
          return true;
        }
      }
      return false;
    }
  }

  private @NotNull <T> Collection<T> loadExtensions(Class<T> extensionClass) {
    JpsPluginManager pluginManager = myPluginManager;
    if (pluginManager == null || !pluginManager.isFullyLoaded()) {
      Iterator<JpsPluginManager> managers = ServiceLoader.load(JpsPluginManager.class, JpsPluginManager.class.getClassLoader()).iterator();
      if (managers.hasNext()) {
        try {
          pluginManager = managers.next();
        }
        catch (ServiceConfigurationError e) {
          Throwable cause = e.getCause();
          if (cause instanceof ProcessCanceledException) {
            throw (ProcessCanceledException)cause;
          }
          throw e;
        }
        if (managers.hasNext()) {
          throw new ServiceConfigurationError("More than one implementation of " + JpsPluginManager.class + " found: " + pluginManager.getClass() + " and " + managers.next().getClass());
        }
      }
      else {
        pluginManager = new SingleClassLoaderPluginManager();
      }
      myPluginManager = pluginManager;
    }
    return pluginManager.loadExtensions(extensionClass);
  }

  private static final class SingleClassLoaderPluginManager extends JpsPluginManager {
    @Override
    public @NotNull <T> Collection<T> loadExtensions(@NotNull Class<T> extensionClass) {
      ServiceLoader<T> loader = ServiceLoader.load(extensionClass, extensionClass.getClassLoader());
      return loader.stream().map(ServiceLoader.Provider::get).collect(Collectors.toList());
    }

    @Override
    public boolean isFullyLoaded() {
      return true;
    }

    @Override
    public int getModificationStamp() {
      return 0;
    }
  }
}
PK          O    8   org/jetbrains/jps/service/impl/SharedThreadPoolImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.service.impl;

import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.concurrency.AppExecutorUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.service.SharedThreadPool;

import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.*;

public final class SharedThreadPoolImpl extends SharedThreadPool {
  private final ExecutorService myService = Executors.newCachedThreadPool(ConcurrencyUtil.newNamedThreadFactory("JPS thread pool", true, Thread.NORM_PRIORITY));

  @Override
  public @NotNull ExecutorService createBoundedExecutor(@NotNull String name, int maxThreads) {
    return AppExecutorUtil.createBoundedApplicationPoolExecutor(name, this, maxThreads);
  }

  @Override
  public @NotNull Executor createCustomPriorityQueueBoundedExecutor(@NotNull String name,
                                                                    int maxThreads,
                                                                    @NotNull Comparator<? super Runnable> comparator) {
    return AppExecutorUtil.createCustomPriorityQueueBoundedApplicationPoolExecutor(name, this, maxThreads, comparator);
  }

  @Override
  public void execute(@NotNull Runnable command) {
    myService.execute(command);
  }

  @Override
  public void shutdown() {
    myService.shutdown();
  }

  @Override
  public @NotNull List<Runnable> shutdownNow() {
    return myService.shutdownNow();
  }

  @Override
  public boolean isShutdown() {
    return myService.isShutdown();
  }

  @Override
  public boolean isTerminated() {
    return myService.isTerminated();
  }

  @Override
  public boolean awaitTermination(long timeout, @NotNull TimeUnit unit) throws InterruptedException {
    return myService.awaitTermination(timeout, unit);
  }

  @Override
  public @NotNull <T> Future<T> submit(@NotNull Callable<T> task) {
    return myService.submit(task);
  }

  @Override
  public @NotNull <T> Future<T> submit(@NotNull Runnable task, T result) {
    return myService.submit(task, result);
  }

  @Override
  public @NotNull Future<?> submit(@NotNull Runnable task) {
    return myService.submit(task);
  }

  @Override
  public @NotNull <T> List<Future<T>> invokeAll(@NotNull Collection<? extends Callable<T>> tasks) throws InterruptedException {
    return myService.invokeAll(tasks);
  }

  @Override
  public @NotNull <T> List<Future<T>> invokeAll(@NotNull Collection<? extends Callable<T>> tasks,
                                                long timeout,
                                                @NotNull TimeUnit unit) throws InterruptedException {
    return myService.invokeAll(tasks, timeout, unit);
  }

  @Override
  public @NotNull <T> T invokeAny(@NotNull Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
    return myService.invokeAny(tasks);
  }

  @Override
  public <T> T invokeAny(@NotNull Collection<? extends Callable<T>> tasks,
                         long timeout,
                         @NotNull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
    return myService.invokeAny(tasks, timeout, unit);
  }
}
PK          j|      0   org/jetbrains/jps/service/impl/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.service.impl;

import org.jetbrains.annotations.ApiStatus;PK          m    :   org/jetbrains/jps/model/artifact/impl/JpsArtifactImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl;

import com.intellij.openapi.util.text.Strings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.artifact.JpsArtifactType;
import org.jetbrains.jps.model.artifact.elements.JpsArchivePackagingElement;
import org.jetbrains.jps.model.artifact.elements.JpsCompositePackagingElement;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsNamedCompositeElementBase;

import java.util.Objects;

class JpsArtifactImpl<P extends JpsElement> extends JpsNamedCompositeElementBase<JpsArtifactImpl<P>> implements JpsArtifact {
  private static final JpsElementChildRole<JpsCompositePackagingElement>
    ROOT_ELEMENT_CHILD_ROLE = JpsElementChildRoleBase.create("root element");
  private final JpsArtifactType<P> myArtifactType;
  private String myOutputPath;
  private boolean myBuildOnMake;


  JpsArtifactImpl(@NotNull String name, @NotNull JpsCompositePackagingElement rootElement, @NotNull JpsArtifactType<P> type, @NotNull P properties) {
    super(name);
    myArtifactType = type;
    myContainer.setChild(ROOT_ELEMENT_CHILD_ROLE, rootElement);
    myContainer.setChild(type.getPropertiesRole(), properties);
  }

  private JpsArtifactImpl(JpsArtifactImpl<P> original) {
    super(original);
    myArtifactType = original.myArtifactType;
    myOutputPath = original.myOutputPath;
  }

  @Override
  public @NotNull JpsArtifactImpl<P> createCopy() {
    return new JpsArtifactImpl<>(this);
  }

  @Override
  public String getOutputPath() {
    return myOutputPath;
  }

  @Override
  public void setOutputPath(@Nullable String outputPath) {
    if (!Objects.equals(myOutputPath, outputPath)) {
      myOutputPath = outputPath;
    }
  }

  @Override
  public @Nullable String getOutputFilePath() {
    if (Strings.isEmpty(myOutputPath)) {
      return null;
    }

    JpsCompositePackagingElement root = getRootElement();
    return root instanceof JpsArchivePackagingElement ? myOutputPath + "/" + ((JpsArchivePackagingElement)root).getArchiveName() : myOutputPath;
  }

  @Override
  public @NotNull JpsArtifactType<P> getArtifactType() {
    return myArtifactType;
  }

  @Override
  public @NotNull JpsArtifactReferenceImpl createReference() {
    return new JpsArtifactReferenceImpl(getName());
  }

  @Override
  public @NotNull JpsCompositePackagingElement getRootElement() {
    return myContainer.getChild(ROOT_ELEMENT_CHILD_ROLE);
  }

  @Override
  public void setRootElement(@NotNull JpsCompositePackagingElement rootElement) {
    myContainer.setChild(ROOT_ELEMENT_CHILD_ROLE, rootElement);
  }

  @Override
  public P getProperties() {
    return myContainer.getChild(myArtifactType.getPropertiesRole());
  }

  @Override
  public boolean isBuildOnMake() {
    return myBuildOnMake;
  }

  @Override
  public void setBuildOnMake(boolean buildOnMake) {
    if (myBuildOnMake != buildOnMake) {
      myBuildOnMake = buildOnMake;
    }
  }
}
PK          ]*    C   org/jetbrains/jps/model/artifact/impl/JpsArtifactReferenceImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.artifact.JpsArtifactReference;
import org.jetbrains.jps.model.impl.JpsNamedElementReferenceImpl;

class JpsArtifactReferenceImpl extends JpsNamedElementReferenceImpl<JpsArtifact,JpsArtifactReferenceImpl> implements JpsArtifactReference {
  JpsArtifactReferenceImpl(@NotNull String artifactName) {
    super(JpsArtifactRole.ARTIFACT_COLLECTION_ROLE, artifactName, JpsElementFactory.getInstance().createProjectReference());
  }

  private JpsArtifactReferenceImpl(JpsArtifactReferenceImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsArtifactReferenceImpl createCopy() {
    return new JpsArtifactReferenceImpl(this);
  }

  @Override
  public @NotNull String getArtifactName() {
    return myElementName;
  }

  @Override
  public JpsArtifactReferenceImpl asExternal(@NotNull JpsModel model) {
    model.registerExternalReference(this);
    return this;
  }
}
PK          s<    :   org/jetbrains/jps/model/artifact/impl/JpsArtifactRole.java// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.artifact.impl;

import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsNamedElementCollectionRole;

final class JpsArtifactRole extends JpsElementChildRoleBase<JpsArtifact> {
  private static final JpsArtifactRole INSTANCE = new JpsArtifactRole();
  public static final JpsNamedElementCollectionRole<JpsArtifact> ARTIFACT_COLLECTION_ROLE = JpsNamedElementCollectionRole.create(INSTANCE);

  private JpsArtifactRole() {
    super("artifact");
  }
}
PK          
Ѣ    A   org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl.java/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jetbrains.jps.model.artifact.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementCollection;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.artifact.JpsArtifactReference;
import org.jetbrains.jps.model.artifact.JpsArtifactService;
import org.jetbrains.jps.model.artifact.JpsArtifactType;
import org.jetbrains.jps.model.artifact.elements.JpsCompositePackagingElement;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class JpsArtifactServiceImpl extends JpsArtifactService {

  @Override
  public List<JpsArtifact> getArtifacts(@NotNull JpsProject project) {
    JpsElementCollection<JpsArtifact> collection = project.getContainer().getChild(JpsArtifactRole.ARTIFACT_COLLECTION_ROLE);
    return collection != null ? collection.getElements() : Collections.emptyList();
  }

  @Override
  public List<JpsArtifact> getSortedArtifacts(@NotNull JpsProject project) {
    List<JpsArtifact> artifacts = new ArrayList<>(getArtifacts(project));
    artifacts.sort((o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
    return artifacts;
  }

  @Override
  public <P extends JpsElement> JpsArtifact addArtifact(@NotNull JpsProject project,
                                                        @NotNull String name,
                                                        @NotNull JpsCompositePackagingElement rootElement,
                                                        @NotNull JpsArtifactType<P> type,
                                                        @NotNull P properties) {
    JpsArtifact artifact = createArtifact(name, rootElement, type, properties);
    return project.getContainer().getOrSetChild(JpsArtifactRole.ARTIFACT_COLLECTION_ROLE).addChild(artifact);
  }


  @Override
  public <P extends JpsElement> JpsArtifact createArtifact(@NotNull String name, @NotNull JpsCompositePackagingElement rootElement,
                                                           @NotNull JpsArtifactType<P> type, @NotNull P properties) {
    return new JpsArtifactImpl<>(name, rootElement, type, properties);
  }

  @Override
  public JpsArtifactReference createReference(@NotNull String artifactName) {
    return new JpsArtifactReferenceImpl(artifactName);
  }
}
PK          v      7   org/jetbrains/jps/model/artifact/impl/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.model.artifact.impl;

import org.jetbrains.annotations.ApiStatus;PK          lY`{  {  F   org/jetbrains/jps/model/fileTypes/impl/FileNameMatcherFactoryImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.fileTypes.impl;

import com.intellij.openapi.fileTypes.ExactFileNameMatcher;
import com.intellij.openapi.fileTypes.ExtensionFileNameMatcher;
import com.intellij.openapi.fileTypes.FileNameMatcher;
import com.intellij.openapi.fileTypes.WildcardFileNameMatcher;
import com.intellij.openapi.util.text.Strings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.fileTypes.FileNameMatcherFactory;

public final class FileNameMatcherFactoryImpl extends FileNameMatcherFactory {
  @Override
  public @NotNull FileNameMatcher createMatcher(@NotNull String pattern) {
    if (pattern.startsWith("*.") &&
        pattern.indexOf('*', 2) < 0 &&
        pattern.indexOf('.', 2) < 0 &&
        pattern.indexOf('?', 2) < 0) {
      return new ExtensionFileNameMatcher(Strings.toLowerCase(pattern.substring(2)));
    }

    if (pattern.contains("*") || pattern.contains("?")) {
      return new WildcardFileNameMatcher(pattern);
    }

    return new ExactFileNameMatcher(pattern);
  }
}
PK          ĠN      8   org/jetbrains/jps/model/fileTypes/impl/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.model.fileTypes.impl;

import org.jetbrains.annotations.ApiStatus;PK          So    J   org/jetbrains/jps/model/impl/runConfiguration/JpsRunConfigurationImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.impl.runConfiguration;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.ex.JpsNamedCompositeElementBase;
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
import org.jetbrains.jps.model.runConfiguration.JpsTypedRunConfiguration;

public final class JpsRunConfigurationImpl<P extends JpsElement> extends JpsNamedCompositeElementBase<JpsRunConfigurationImpl<P>> implements
                                                                                                                            JpsTypedRunConfiguration<P> {
  private final JpsRunConfigurationType<P> myType;
  
  public JpsRunConfigurationImpl(@NotNull String name, JpsRunConfigurationType<P> type, P properties) {
    super(name);
    myType = type;
    myContainer.setChild(myType.getPropertiesRole(), properties);
  }

  private JpsRunConfigurationImpl(JpsRunConfigurationImpl<P> original) {
    super(original);
    myType = original.myType;
  }

  @Override
  public @NotNull JpsRunConfigurationImpl<P> createCopy() {
    return new JpsRunConfigurationImpl<>(this);
  }

  @Override
  public @NotNull P getProperties() {
    return myContainer.getChild(myType.getPropertiesRole());
  }

  @Override
  public JpsRunConfigurationType<P> getType() {
    return myType;
  }
}
PK                ?   org/jetbrains/jps/model/impl/runConfiguration/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.model.impl.runConfiguration;

import org.jetbrains.annotations.ApiStatus;PK          i-  -  V   org/jetbrains/jps/model/jarRepository/impl/JpsRemoteRepositoriesConfigurationImpl.java// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.jarRepository.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.jarRepository.JpsRemoteRepositoriesConfiguration;
import org.jetbrains.jps.model.jarRepository.JpsRemoteRepositoryDescription;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @author Eugene Zhuravlev
 */
final class JpsRemoteRepositoriesConfigurationImpl extends JpsElementBase<JpsRemoteRepositoriesConfigurationImpl> implements JpsRemoteRepositoriesConfiguration{
  public static final JpsElementChildRole<JpsRemoteRepositoriesConfiguration> ROLE = JpsElementChildRoleBase.create("remote repositories configuration");
  
  private final List<JpsRemoteRepositoryDescription> repositories = new ArrayList<>();

  JpsRemoteRepositoriesConfigurationImpl() {
    this(Arrays.asList( // defaults
      new JpsRemoteRepositoryDescription("central", "Maven Central repository", "https://repo1.maven.org/maven2"),
      new JpsRemoteRepositoryDescription("jboss.community", "JBoss Community repository", "https://repository.jboss.org/nexus/content/repositories/public/")
    ));
  }

  public JpsRemoteRepositoriesConfigurationImpl(List<? extends JpsRemoteRepositoryDescription> repositories) {
    this.repositories.addAll(repositories);
  }

  @Override
  public @NotNull JpsRemoteRepositoriesConfigurationImpl createCopy() {
    return new JpsRemoteRepositoriesConfigurationImpl(repositories);
  }

  @Override
  public List<JpsRemoteRepositoryDescription> getRepositories() {
    return Collections.unmodifiableList(repositories);
  }

  @Override
  public void setRepositories(List<? extends JpsRemoteRepositoryDescription> repositories) {
    this.repositories.clear();
    this.repositories.addAll(repositories);
  }
}
PK          q8    N   org/jetbrains/jps/model/jarRepository/impl/JpsRemoteRepositoryServiceImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.jarRepository.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.jarRepository.JpsRemoteRepositoriesConfiguration;
import org.jetbrains.jps.model.jarRepository.JpsRemoteRepositoryService;

/**
 * @author Eugene Zhuravlev
 */
public class JpsRemoteRepositoryServiceImpl extends JpsRemoteRepositoryService {
  @Override
  public @Nullable JpsRemoteRepositoriesConfiguration getRemoteRepositoriesConfiguration(@NotNull JpsProject project) {
    return project.getContainer().getChild(JpsRemoteRepositoriesConfigurationImpl.ROLE);
  }

  @Override
  public synchronized @NotNull JpsRemoteRepositoriesConfiguration getOrCreateRemoteRepositoriesConfiguration(@NotNull JpsProject project) {
    JpsRemoteRepositoriesConfiguration config = getRemoteRepositoriesConfiguration(project);
    if (config == null) {
      config = project.getContainer().setChild(JpsRemoteRepositoriesConfigurationImpl.ROLE, new JpsRemoteRepositoriesConfigurationImpl());
    }
    return config;
  }
}
PK          5h      <   org/jetbrains/jps/model/jarRepository/impl/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.model.jarRepository.impl;

import org.jetbrains.annotations.ApiStatus;PK          M    K   org/jetbrains/jps/model/java/impl/ExplodedDirectoryModuleExtensionImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementCreator;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.java.ExplodedDirectoryModuleExtension;

import java.util.Objects;

class ExplodedDirectoryModuleExtensionImpl extends JpsElementBase<ExplodedDirectoryModuleExtensionImpl> implements
                                                                                                               ExplodedDirectoryModuleExtension {
  private String myExplodedUrl;
  private boolean myExcludeExploded;

  ExplodedDirectoryModuleExtensionImpl() {
  }

  ExplodedDirectoryModuleExtensionImpl(ExplodedDirectoryModuleExtensionImpl original) {
    myExcludeExploded = original.myExcludeExploded;
    myExplodedUrl = original.myExplodedUrl;
  }

  @Override
  public String getExplodedUrl() {
    return myExplodedUrl;
  }

  @Override
  public void setExplodedUrl(String explodedUrl) {
    if (!Objects.equals(myExplodedUrl, explodedUrl)) {
      myExplodedUrl = explodedUrl;
    }
  }

  @Override
  public boolean isExcludeExploded() {
    return myExcludeExploded;
  }

  @Override
  public void setExcludeExploded(boolean excludeExploded) {
    if (myExcludeExploded != excludeExploded) {
      myExcludeExploded = excludeExploded;
    }
  }

  @Override
  public @NotNull ExplodedDirectoryModuleExtensionImpl createCopy() {
    return new ExplodedDirectoryModuleExtensionImpl(this);
  }

  public static class ExplodedDirectoryModuleExtensionRole extends JpsElementChildRoleBase<ExplodedDirectoryModuleExtension> implements JpsElementCreator<ExplodedDirectoryModuleExtension> {
    public static final ExplodedDirectoryModuleExtensionRole INSTANCE = new ExplodedDirectoryModuleExtensionRole();

    public ExplodedDirectoryModuleExtensionRole() {
      super("exploded directory");
    }

    @Override
    public @NotNull ExplodedDirectoryModuleExtension create() {
      return new ExplodedDirectoryModuleExtensionImpl();
    }
  }
}
PK          +  +  >   org/jetbrains/jps/model/java/impl/JavaModuleExtensionRole.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementCreator;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.java.JpsJavaModuleExtension;

final class JavaModuleExtensionRole extends JpsElementChildRoleBase<JpsJavaModuleExtension> implements JpsElementCreator<JpsJavaModuleExtension> {
  public static final JavaModuleExtensionRole INSTANCE = new JavaModuleExtensionRole();

  private JavaModuleExtensionRole() {
    super("java module extension");
  }

  @Override
  public @NotNull JpsJavaModuleExtensionImpl create() {
    return new JpsJavaModuleExtensionImpl();
  }
}
PK          W    :   org/jetbrains/jps/model/java/impl/JavaModuleIndexImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.java.JavaModuleIndex;
import org.jetbrains.jps.model.java.JavaSourceRootType;
import org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.util.JpsPathUtil;

import java.io.File;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@ApiStatus.Internal
public class JavaModuleIndexImpl extends JpsElementBase<JavaModuleIndexImpl> implements JavaModuleIndex {
  private static final String SOURCE_SUFFIX = ":S";
  private static final String TEST_SUFFIX = ":T";
  private static final String MODULE_INFO_FILE = "module-info.java";
  private static final File NULL_FILE = new File("-");

  private final Map<String, File> myMapping;
  private final JpsCompilerExcludes myExcludes;

  public JavaModuleIndexImpl(@NotNull JpsCompilerExcludes excludes) {
    myMapping = new ConcurrentHashMap<>();
    myExcludes = excludes;
  }

  @Override
  public @Nullable File getModuleInfoFile(@NotNull JpsModule module, boolean forTests) {
    var key = module.getName() + (forTests ? TEST_SUFFIX : SOURCE_SUFFIX);
    var file = myMapping.computeIfAbsent(key, __ -> findModuleInfoFile(module, forTests));
    return file == NULL_FILE ? null : file;
  }

  private File findModuleInfoFile(JpsModule module, boolean forTests) {
    var rootType = forTests ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;

    for (var root : module.getSourceRoots()) {
      if (rootType.equals(root.getRootType())) {
        var file = new File(JpsPathUtil.urlToOsPath(root.getUrl()), MODULE_INFO_FILE);
        if (file.isFile() && !myExcludes.isExcluded(file)) {
          return file;
        }
      }
    }

    return NULL_FILE;
  }

  @TestOnly
  public void dropCache() {
    myMapping.clear();
  }
}
PK          ]0    :   org/jetbrains/jps/model/java/impl/JavaModuleIndexRole.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementParameterizedCreator;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.java.JavaModuleIndex;
import org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes;

/**
 * @author Eugene Zhuravlev
 */
final class JavaModuleIndexRole extends JpsElementChildRoleBase<JavaModuleIndex> implements JpsElementParameterizedCreator<JavaModuleIndex, JpsCompilerExcludes>{
  static final JavaModuleIndexRole INSTANCE = new JavaModuleIndexRole();

  private JavaModuleIndexRole() {
    super("java module index");
  }

  @Override
  public @NotNull JavaModuleIndex create(@NotNull JpsCompilerExcludes excludes) {
    return new JavaModuleIndexImpl(excludes);
  }
}PK              ?   org/jetbrains/jps/model/java/impl/JavaProjectExtensionRole.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementCreator;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
import org.jetbrains.jps.model.java.JpsJavaProjectExtension;

/**
 * This class is for internal use only, call {@link JpsJavaExtensionService#getProjectExtension(JpsProject)} to get an instance of 
 * {@link JpsJavaProjectExtension} for a project. 
 */
@ApiStatus.Internal
public class JavaProjectExtensionRole extends JpsElementChildRoleBase<JpsJavaProjectExtension> implements JpsElementCreator<JpsJavaProjectExtension> {
  public static final JavaProjectExtensionRole INSTANCE = new JavaProjectExtensionRole();

  public JavaProjectExtensionRole() {
    super("java project extension");
  }

  @Override
  public @NotNull JpsJavaProjectExtension create() {
    return new JpsJavaProjectExtensionImpl();
  }
}
PK          #    2   org/jetbrains/jps/model/java/impl/JavaSdkUtil.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.containers.CollectionFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

public final class JavaSdkUtil {
  private JavaSdkUtil() {
  }

  public static @NotNull List<Path> getJdkClassesRoots(@NotNull Path home, boolean isJre) {
    Path[] jarDirs;
    Path fileName = home.getFileName();
    if (fileName != null && "Home".equals(fileName.toString()) && Files.exists(home.resolve("../Classes/classes.jar"))) {
      Path libDir = home.resolve("lib");
      Path classesDir = home.resolveSibling("Classes");
      Path libExtDir = libDir.resolve("ext");
      Path libEndorsedDir = libDir.resolve("endorsed");
      jarDirs = new Path[]{libEndorsedDir, libDir, classesDir, libExtDir};
    }
    else if (Files.exists(home.resolve("lib/jrt-fs.jar"))) {
      jarDirs = new Path[0];
    }
    else {
      Path libDir = home.resolve(isJre ? "lib" : "jre/lib");
      Path libExtDir = libDir.resolve("ext");
      Path libEndorsedDir = libDir.resolve("endorsed");
      jarDirs = new Path[]{libEndorsedDir, libDir, libExtDir};
    }

    List<Path> rootFiles = new ArrayList<>();

    if (Registry.is("project.structure.add.tools.jar.to.new.jdk", false)) {
      @SuppressWarnings("IdentifierGrammar") Path toolsJar = home.resolve("lib/tools.jar");
      if (Files.isRegularFile(toolsJar)) {
        rootFiles.add(toolsJar);
      }
    }

    Set<String> pathFilter = CollectionFactory.createFilePathSet();
    for (Path jarDir : jarDirs) {
      if (jarDir != null && Files.isDirectory(jarDir)) {
        try (DirectoryStream<Path> stream = Files.newDirectoryStream(jarDir, "*.jar")) {
          for (Path jarFile : stream) {
            String jarFileName = jarFile.getFileName().toString();
            if (jarFileName.equals("alt-rt.jar") || jarFileName.equals("alt-string.jar")) {
              continue;  // filter out alternative implementations
            }
            String canonicalPath = getCanonicalPath(jarFile);
            if (canonicalPath == null || !pathFilter.add(canonicalPath)) {
              continue;  // filter out duplicate (symbolically linked) .jar files commonly found in OS X JDK distributions
            }
            rootFiles.add(jarFile);
          }
        }
        catch (IOException ignored) { }
      }
    }

    if (rootFiles.stream().map(path -> path.getFileName().toString()).anyMatch(name -> name.startsWith("ibm"))) {
      // ancient IBM JDKs split JRE classes between `rt.jar` and `vm.jar`, and the latter might be anywhere
      try (var paths = Files.walk(isJre ? home : home.resolve("jre"))) {
        paths.filter(path -> path.getFileName().toString().equals("vm.jar"))
          .findFirst()
          .ifPresent(rootFiles::add);
      }
      catch (IOException ignored) {
      }
    }

    Path classesZip = home.resolve("lib/classes.zip");
    if (Files.isRegularFile(classesZip)) {
      rootFiles.add(classesZip);
    }

    if (rootFiles.isEmpty()) {
      Path classesDir = home.resolve("classes");
      if (Files.isDirectory(classesDir)) {
        rootFiles.add(classesDir);
      }
    }

    return rootFiles;
  }

  private static @Nullable String getCanonicalPath(Path file) {
    try {
      return file.toRealPath().toString();
    }
    catch (IOException e) {
      return null;
    }
  }
}
PK         - 	  ?$  =   org/jetbrains/jps/model/java/impl/JdkVersionDetectorImpl.java]wӸBa9gP
@J$s_8$j+)~Gdˎ}}mh4Nt)t&cAPN0"<Ba¥`\&"cFQ2Ar )EH!>ɂ
N#4^nJBx}#S !ʱ^ߦߒlƇ;;Hs̸qnqRNR#F<$E2Rq=,ƣe&'PnF_L2|2#":I;_e	>&2吒h3;&|a7Td,P3/>Ig%b]tD	2MD8~&qLנ6twݙRIC02*`xL@{Hpop%t%V8~$a 𓭁,"rfUAZO,+$$kTa.+GOI,אsf}rQ!os-+ΉP[$MbwMi| Q	q;i>GaLF/FA(lA$EMEǣ;td>,|W T	QDk+*VHӨo ;Ƨh̩2!AA?vPkh=vP	i9T!S@cE(+c_xkabcQR`k	L|U}j";3)U0-qųƂ
SW#,QX,A$
'іAh<ߐp_C2+eYBK|Q(EDV̲!q-v2UD)l{g(hW[H֏#T0 R'$
0>a|2xadλ7o?^\|9z~EvI߱DCGBNIX3SU	"-ӺҒÑ+xAbJT@/sE)!3$ K].BG'tR!pI\bN(Yڀf>T2%"~b5lDR)8`;<y5[FFۈF[G/A>ͥx<N[B1+} Sb-L^ydS0)	nEX֭{1	
ӽF6]GS:mifH`B̥-nܾ[`k#Tfʂ!qNj
˫˳uLƚΊl<'4PPїg\m]}Nu*BxAG0G~wܠ!?A?F8mIx?48_!>/ʁ~PN>8D"U`+Uճ ?ЌkP0Ox[_hĮ?JtQD`lģJC
-QjeͣsGTX"5	v}1v3!G1U{BD( %
v0}bN
SI5ٷe0ɲLeM,$
AlJ܆9\~ED)SHmUC `HLD΂hu)ΓY>)
ZǪeB6ڮ
B`ŧ6%\%Q=%2ݶ"S1_~9F_zfR[#Z5.?#`,~|XlriJ)k}4ѣ1Sw0#r8UvkvZqViI	zz|\lZ78XPTi27(ZJAǫnrR~~4Jzj^r,Ȱ	?oaW5mO7'Pmናsp</6I"%,q:LMv{Ǘ:0pCȈP <zHU<=wPy%X{%x%ָV1~gjm;AH|r99[nc1NMmjߟѼr<7VdL<2<d{j;T*$F4%!pT< zhvga<l'%loZ"8TE.ky)l"pBd~ŔdO`;QgkCP >|{5/ƍ{oxk	Ђ*ЖelSB<JkRP.bpwX;+$iW0QT.a}2nXKX+Br3r[Cn.`;(W^}wPCB	VsJ'$eqc2/ݘj5"c"DDW}Ԡr喋k_W76X9a^V.T4g2("aJ5\wAΩ+պFZDQ!V0hR/:s0t xPK          jSe    :   org/jetbrains/jps/model/java/impl/JpsJavaAwareProject.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.java.JpsJavaDependencyExtension;
import org.jetbrains.jps.model.java.JpsJavaModuleExtension;
import org.jetbrains.jps.model.module.JpsDependencyElement;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsTestModuleProperties;

/**
 * Temporary interface which provides access to custom implementation of Java-related properties in JPS Model. 
 */
@ApiStatus.Internal
public interface JpsJavaAwareProject extends JpsProject {
  @Nullable JpsJavaModuleExtension getJavaModuleExtension(@NotNull JpsModule module);
  
  @Nullable JpsJavaDependencyExtension getJavaDependencyExtension(@NotNull JpsDependencyElement element);

  @Nullable JpsTestModuleProperties getTestModuleProperties(@NotNull JpsModule module);

  boolean isProductionOnTestDependency(@NotNull JpsDependencyElement element);
}
PK          \}Q	  Q	  L   org/jetbrains/jps/model/java/impl/JpsJavaDependenciesEnumerationHandler.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import com.intellij.util.SmartList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.module.JpsDependencyElement;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.service.JpsServiceManager;

import java.util.Collection;
import java.util.List;

/**
 * Implement this class and register implementations of its {@link Factory} in META-INF/services/org.jetbrains.jps.model.java.impl.JpsJavaDependenciesEnumerationHandler$Factory
 * file to change how dependencies of modules are processed. The same logic must be implemented in {@link com.intellij.openapi.roots.OrderEnumerationHandler}
 * extension on IDE side.
 */
public abstract class JpsJavaDependenciesEnumerationHandler {
  public static List<JpsJavaDependenciesEnumerationHandler> createHandlers(Collection<JpsModule> rootModules) {
    List<JpsJavaDependenciesEnumerationHandler> handlers = null;
    for (Factory factory : JpsServiceManager.getInstance().getExtensions(Factory.class)) {
      JpsJavaDependenciesEnumerationHandler handler = factory.createHandler(rootModules);
      if (handler != null) {
        if (handlers == null) {
          handlers = new SmartList<>();
        }
        handlers.add(handler);
      }
    }
    return handlers;
  }

  public static boolean shouldProcessDependenciesRecursively(final List<? extends JpsJavaDependenciesEnumerationHandler> handlers) {
    if (handlers != null) {
      for (JpsJavaDependenciesEnumerationHandler handler : handlers) {
        if (!handler.shouldProcessDependenciesRecursively()) {
          return false;
        }
      }
    }
    return true;
  }

  public abstract static class Factory {

    public abstract @Nullable JpsJavaDependenciesEnumerationHandler createHandler(@NotNull Collection<JpsModule> modules);
  }
  public boolean shouldAddRuntimeDependenciesToTestCompilationClasspath() {
    return false;
  }

  public boolean isProductionOnTestsDependency(JpsDependencyElement element) {
    return false;
  }

  public boolean shouldIncludeTestsFromDependentModulesToTestClasspath() {
    return true;
  }

  public boolean shouldProcessDependenciesRecursively() {
    return true;
  }
}
PK          G    H   org/jetbrains/jps/model/java/impl/JpsJavaDependenciesEnumeratorImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.java.*;
import org.jetbrains.jps.model.library.JpsOrderRootType;
import org.jetbrains.jps.model.module.JpsDependencyElement;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsSdkDependency;
import org.jetbrains.jps.model.module.impl.JpsDependenciesEnumeratorBase;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

@ApiStatus.Internal
public class JpsJavaDependenciesEnumeratorImpl extends JpsDependenciesEnumeratorBase<JpsJavaDependenciesEnumeratorImpl> implements JpsJavaDependenciesEnumerator {
  private boolean myProductionOnly;
  private boolean myRuntimeOnly;
  private boolean myCompileOnly;
  private boolean myExportedOnly;
  private boolean myRecursivelyExportedOnly;
  private JpsJavaClasspathKind myClasspathKind;
  private final List<JpsJavaDependenciesEnumerationHandler> myHandlers;

  public JpsJavaDependenciesEnumeratorImpl(Collection<JpsModule> rootModules) {
    super(rootModules);
    List<JpsJavaDependenciesEnumerationHandler> handlers = JpsJavaDependenciesEnumerationHandler.createHandlers(rootModules);
    myHandlers = handlers != null ? handlers : Collections.emptyList();
  }

  @Override
  public @NotNull JpsJavaDependenciesEnumerator productionOnly() {
    myProductionOnly = true;
    return this;
  }

  @Override
  public @NotNull JpsJavaDependenciesEnumerator compileOnly() {
    myCompileOnly = true;
    return this;
  }

  @Override
  public @NotNull JpsJavaDependenciesEnumerator runtimeOnly() {
    myRuntimeOnly = true;
    return this;
  }

  @Override
  public @NotNull JpsJavaDependenciesEnumerator exportedOnly() {
    if (myRecursively) {
      myRecursivelyExportedOnly = true;
    }
    else {
      myExportedOnly = true;
    }
    return this;
  }

  @Override
  public @NotNull JpsJavaDependenciesEnumerator recursivelyExportedOnly() {
    return recursively().exportedOnly();
  }

  @Override
  public @NotNull JpsJavaDependenciesEnumerator includedIn(@NotNull JpsJavaClasspathKind classpathKind) {
    myClasspathKind = classpathKind;
    return this;
  }

  @Override
  public @NotNull JpsJavaDependenciesRootsEnumerator classes() {
    return new JpsJavaDependenciesRootsEnumeratorImpl(this, JpsOrderRootType.COMPILED);
  }

  @Override
  public @NotNull JpsJavaDependenciesRootsEnumerator sources() {
    return new JpsJavaDependenciesRootsEnumeratorImpl(this, JpsOrderRootType.SOURCES);
  }

  @Override
  public @NotNull JpsJavaDependenciesRootsEnumerator annotations() {
    return new JpsJavaDependenciesRootsEnumeratorImpl(this, JpsAnnotationRootType.INSTANCE);
  }

  @Override
  protected JpsJavaDependenciesEnumeratorImpl self() {
    return this;
  }

  @Override
  protected boolean shouldProcessDependenciesRecursively() {
    return JpsJavaDependenciesEnumerationHandler.shouldProcessDependenciesRecursively(myHandlers);
  }

  @Override
  protected boolean shouldProcess(JpsModule module, JpsDependencyElement element) {
    boolean exported = !(element instanceof JpsSdkDependency);
    JpsJavaDependencyExtension extension = JpsJavaExtensionService.getInstance().getDependencyExtension(element);
    if (extension != null) {
      exported = extension.isExported();
      JpsJavaDependencyScope scope = extension.getScope();
      boolean forTestCompile = scope.isIncludedIn(JpsJavaClasspathKind.TEST_COMPILE) || scope == JpsJavaDependencyScope.RUNTIME &&
                                                                                        shouldAddRuntimeDependenciesToTestCompilationClasspath();
      if (myCompileOnly && !scope.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_COMPILE) && !forTestCompile
        || myRuntimeOnly && !scope.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME) && !scope.isIncludedIn(JpsJavaClasspathKind.TEST_RUNTIME)
        || myClasspathKind != null && !scope.isIncludedIn(myClasspathKind) && !(myClasspathKind == JpsJavaClasspathKind.TEST_COMPILE && forTestCompile)) {
        return false;
      }
      if (myProductionOnly) {
        if (!scope.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_COMPILE) && !scope.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME)
            || myCompileOnly && !scope.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_COMPILE)
            || myRuntimeOnly && !scope.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME)) {
          return false;
        }
      }
    }
    if (!exported) {
      if (myExportedOnly) return false;
      if ((myRecursivelyExportedOnly || element instanceof JpsSdkDependency) && !isEnumerationRootModule(module)) return false;
    }
    return true;
  }

  public boolean isProductionOnly() {
    return myProductionOnly || myClasspathKind == JpsJavaClasspathKind.PRODUCTION_RUNTIME || myClasspathKind == JpsJavaClasspathKind.PRODUCTION_COMPILE;
  }

  public boolean isProductionOnTests(JpsDependencyElement element) {
    for (JpsJavaDependenciesEnumerationHandler handler : myHandlers) {
      if (handler.isProductionOnTestsDependency(element)) {
        return true;
      }
    }
    return false;
  }

  public boolean shouldIncludeTestsFromDependentModulesToTestClasspath() {
    for (JpsJavaDependenciesEnumerationHandler handler : myHandlers) {
      if (!handler.shouldIncludeTestsFromDependentModulesToTestClasspath()) {
        return false;
      }
    }
    return true;
  }

  public boolean shouldAddRuntimeDependenciesToTestCompilationClasspath() {
    for (JpsJavaDependenciesEnumerationHandler handler : myHandlers) {
      if (handler.shouldAddRuntimeDependenciesToTestCompilationClasspath()) {
        return true;
      }
    }
    return false;
  }
}
PK          >]    M   org/jetbrains/jps/model/java/impl/JpsJavaDependenciesRootsEnumeratorImpl.java/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.jps.model.java.*;
import org.jetbrains.jps.model.library.JpsOrderRootType;
import org.jetbrains.jps.model.module.*;
import org.jetbrains.jps.model.module.impl.JpsDependenciesRootsEnumeratorBase;

import java.util.function.Consumer;

class JpsJavaDependenciesRootsEnumeratorImpl extends JpsDependenciesRootsEnumeratorBase<JpsJavaDependenciesEnumeratorImpl> implements JpsJavaDependenciesRootsEnumerator {
  private boolean myWithoutSelfModuleOutput;

  JpsJavaDependenciesRootsEnumeratorImpl(JpsJavaDependenciesEnumeratorImpl dependenciesEnumerator, JpsOrderRootType rootType) {
    super(dependenciesEnumerator, rootType);
  }

  @Override
  public JpsJavaDependenciesRootsEnumerator withoutSelfModuleOutput() {
    myWithoutSelfModuleOutput = true;
    return this;
  }

  @Override
  protected boolean processModuleRootUrls(JpsModule module, JpsDependencyElement dependencyElement, Consumer<? super String> urlConsumer) {
    boolean includeProduction, includeTests;
    if (dependencyElement instanceof JpsModuleDependency) {
      boolean productionOnTests = myDependenciesEnumerator.isProductionOnTests(dependencyElement);
      includeProduction = !productionOnTests;
      includeTests = !myDependenciesEnumerator.isProductionOnly() && myDependenciesEnumerator.shouldIncludeTestsFromDependentModulesToTestClasspath()
                     || productionOnTests;
    }
    else {
      includeProduction = true;
      includeTests = !myDependenciesEnumerator.isProductionOnly() 
                     && (myDependenciesEnumerator.shouldIncludeTestsFromDependentModulesToTestClasspath() || myDependenciesEnumerator.isEnumerationRootModule(module));
    }

    if (myRootType == JpsOrderRootType.SOURCES) {
      for (JpsModuleSourceRoot root : module.getSourceRoots()) {
        JpsModuleSourceRootType<?> type = root.getRootType();
        if (type.equals(JavaSourceRootType.SOURCE) && includeProduction || type.equals(JavaSourceRootType.TEST_SOURCE) && includeTests) {
          urlConsumer.accept(root.getUrl());
        }
      }
    }
    else if (myRootType == JpsOrderRootType.COMPILED) {
      JpsJavaExtensionService extensionService = JpsJavaExtensionService.getInstance();
      if (myWithoutSelfModuleOutput && myDependenciesEnumerator.isEnumerationRootModule(module)) {
        if (includeProduction && includeTests) {
          String url = extensionService.getOutputUrl(module, false);
          if (url != null) {
            urlConsumer.accept(url);
          }
        }
      }
      else {
        String outputUrl = extensionService.getOutputUrl(module, false);
        if (includeTests) {
          String testsOutputUrl = extensionService.getOutputUrl(module, true);
          if (testsOutputUrl != null && !testsOutputUrl.equals(outputUrl)) {
            urlConsumer.accept(testsOutputUrl);
          }
        }
        if (includeProduction && outputUrl != null) {
          urlConsumer.accept(outputUrl);
        }
      }
    }
    else if (myRootType == JpsAnnotationRootType.INSTANCE) {
      JpsJavaModuleExtension extension = JpsJavaExtensionService.getInstance().getModuleExtension(module);
      if (extension != null) {
        for (String url : extension.getAnnotationRoots().getUrls()) {
          urlConsumer.accept(url);
        }
      }
    }
    return true;
  }
}
PK          ً    E   org/jetbrains/jps/model/java/impl/JpsJavaDependencyExtensionImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.java.JpsJavaDependencyExtension;
import org.jetbrains.jps.model.java.JpsJavaDependencyScope;

class JpsJavaDependencyExtensionImpl extends JpsElementBase<JpsJavaDependencyExtensionImpl> implements JpsJavaDependencyExtension {
  private boolean myExported;
  private JpsJavaDependencyScope myScope;

  JpsJavaDependencyExtensionImpl(boolean exported,
                                        JpsJavaDependencyScope scope) {
    myExported = exported;
    myScope = scope;
  }

  JpsJavaDependencyExtensionImpl(JpsJavaDependencyExtensionImpl original) {
    myExported = original.myExported;
    myScope = original.myScope;
  }

  @Override
  public boolean isExported() {
    return myExported;
  }

  @Override
  public void setExported(boolean exported) {
    if (myExported != exported) {
      myExported = exported;
    }
  }

  @Override
  public @NotNull JpsJavaDependencyScope getScope() {
    return myScope;
  }

  @Override
  public void setScope(@NotNull JpsJavaDependencyScope scope) {
    if (!scope.equals(myScope)) {
      myScope = scope;
    }
  }

  @Override
  public @NotNull JpsJavaDependencyExtensionImpl createCopy() {
    return new JpsJavaDependencyExtensionImpl(this);
  }
}
PK          o|Q    E   org/jetbrains/jps/model/java/impl/JpsJavaDependencyExtensionRole.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementCreator;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.java.JpsJavaDependencyExtension;
import org.jetbrains.jps.model.java.JpsJavaDependencyScope;

@ApiStatus.Internal
public final class JpsJavaDependencyExtensionRole extends JpsElementChildRoleBase<JpsJavaDependencyExtension> implements JpsElementCreator<JpsJavaDependencyExtension> {
  public static final JpsJavaDependencyExtensionRole INSTANCE = new JpsJavaDependencyExtensionRole();

  private JpsJavaDependencyExtensionRole() {
    super("java dependency extension");
  }

  @Override
  public @NotNull JpsJavaDependencyExtensionImpl create() {
    return new JpsJavaDependencyExtensionImpl(false, JpsJavaDependencyScope.COMPILE);
  }
}
PK         *]I{v  +  B   org/jetbrains/jps/model/java/impl/JpsJavaExtensionServiceImpl.javaZ[s6~ׯ@P[d/ڎR!6Er P9 xJcO"	|ޑӼSOL>2oLI)L	~[\HJ>KFQwR$2_3n"=')L2:x	,Ē3ug+xS*҃P~EyX{,NKSأ7 .[~j<β\Ŋ~Rx/ ڋ\]Hߦc!j3Mيejoi~p(D~滙jk)#4<[e)B7S3yAM39|gO*уwZʡIlץHsiS<i '{8<؛Cق	wÄ2ej_ATFXLh?1.Ӈ.=ՉK;vN5G$HgVEo#4؜>*oL!Ƥ="%'-6Vl%ST0l/j0ϱT)7d"SxDst| <$~("ˠw`!hY 6v|	MP@#K߬$[<њ.v^B(ߎ(, TW.Ҁ	5V	KCТ?*ikmFQ*XGQK.`:I!WOfPoodO͖ա}.tsk.^SI|Pv;vr"t/ऊS,q
~縷mMm,Xru\p(AL,/.v嗖	r!Gc	GqՃoG}+I?Wv3`r9i	N0"Gc$zֳ˅˩2d̯Tems8[񒝳5KQ5NCǣ\+(8S_JLKA:_G>ڑ5;7{ЕS
~Q:-Fc_;] *"镤TE> H9	:fwLp^0CM/JKVӥ@13mB޻=*;)xO؃9R5i#E]'9[a
EK<4XOpGGjd=2V뼃BϧS#_k ϓ
:GZ5t3i*+`i!Ju,0.Cm?)[G q(@h4@)Q9nxʜ_ayH9ҷ[PNLn\[/DjdX)%W
oM08$Bm"]tPO@O;(~<@{r>m9QBS.B~2O׬wVj4eYk>*ZIBϫz
]AcsC*@I#!ypB\~tC8z<	\Θ6MlA?B`#DQ=Q-*R#;hյa|T,_jIZ&ǵJGEV&z42!a1aZj4x<MUd5_4#N%kot!?Иfx&U dQfekU=jv>=Groʈޡ:^|u<YZo?=(B}IYnծsTMH}#MTj$
4ѧ$[~o,DOlΨ#?l1?'rbzL;ƨBV+]VC:* pM$e|&ä뫒4_vlhA $$PđǭHƃ,@[;;Egl0kUVz3[{^TG<@MJ_W@=WN=4//g7٬l[-}l&~Tm4+WP,3ʜ+_Qk9-~?GA*rܮY`wJi#on
Q	Α2GO&y$nziw'jDռE1}TPK          Py    A   org/jetbrains/jps/model/java/impl/JpsJavaModuleExtensionImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import com.intellij.openapi.util.Comparing;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsUrlList;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.impl.JpsUrlListRole;
import org.jetbrains.jps.model.java.JpsJavaModuleExtension;
import org.jetbrains.jps.model.java.LanguageLevel;

import java.util.Objects;

final class JpsJavaModuleExtensionImpl extends JpsCompositeElementBase<JpsJavaModuleExtensionImpl> implements JpsJavaModuleExtension {
  private static final JpsUrlListRole JAVADOC_ROOTS_ROLE = new JpsUrlListRole("javadoc roots");
  private static final JpsUrlListRole ANNOTATIONS_ROOTS_ROLE = new JpsUrlListRole("annotation roots");
  private String myOutputUrl;
  private String myTestOutputUrl;
  private boolean myInheritOutput;
  private boolean myExcludeOutput;
  private LanguageLevel myLanguageLevel;

  JpsJavaModuleExtensionImpl() {
    myContainer.setChild(JAVADOC_ROOTS_ROLE);
    myContainer.setChild(ANNOTATIONS_ROOTS_ROLE);
  }

  private JpsJavaModuleExtensionImpl(JpsJavaModuleExtensionImpl original) {
    super(original);
    myOutputUrl = original.myOutputUrl;
    myTestOutputUrl = original.myTestOutputUrl;
    myLanguageLevel = original.myLanguageLevel;
  }

  @Override
  public @NotNull JpsJavaModuleExtensionImpl createCopy() {
    return new JpsJavaModuleExtensionImpl(this);
  }

  @Override
  public @NotNull JpsUrlList getAnnotationRoots() {
    return myContainer.getChild(ANNOTATIONS_ROOTS_ROLE);
  }

  @Override
  public @NotNull JpsUrlList getJavadocRoots() {
    return myContainer.getChild(JAVADOC_ROOTS_ROLE);
  }

  @Override
  public String getOutputUrl() {
    return myOutputUrl;
  }

  @Override
  public void setOutputUrl(String outputUrl) {
    if (!Objects.equals(myOutputUrl, outputUrl)) {
      myOutputUrl = outputUrl;
    }
  }

  @Override
  public String getTestOutputUrl() {
    return myTestOutputUrl;
  }

  @Override
  public void setTestOutputUrl(String testOutputUrl) {
    if (!Objects.equals(myTestOutputUrl, testOutputUrl)) {
      myTestOutputUrl = testOutputUrl;
    }
  }

  @Override
  public LanguageLevel getLanguageLevel() {
    return myLanguageLevel;
  }

  @Override
  public void setLanguageLevel(LanguageLevel languageLevel) {
    if (!Comparing.equal(myLanguageLevel, languageLevel)) {
      myLanguageLevel = languageLevel;
    }
  }

  @Override
  public boolean isInheritOutput() {
    return myInheritOutput;
  }

  @Override
  public void setInheritOutput(boolean inheritOutput) {
    if (myInheritOutput != inheritOutput) {
      myInheritOutput = inheritOutput;
    }
  }

  @Override
  public boolean isExcludeOutput() {
    return myExcludeOutput;
  }

  @Override
  public void setExcludeOutput(boolean excludeOutput) {
    if (myExcludeOutput != excludeOutput) {
      myExcludeOutput = excludeOutput;
    }
  }
}
PK          Q    B   org/jetbrains/jps/model/java/impl/JpsJavaProjectExtensionImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import com.intellij.openapi.util.Comparing;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.java.JpsJavaProjectExtension;
import org.jetbrains.jps.model.java.LanguageLevel;

import java.util.Objects;

final class JpsJavaProjectExtensionImpl extends JpsElementBase<JpsJavaProjectExtensionImpl> implements JpsJavaProjectExtension {
  private String myOutputUrl;
  private LanguageLevel myLanguageLevel;

  JpsJavaProjectExtensionImpl() {
  }

  private JpsJavaProjectExtensionImpl(JpsJavaProjectExtensionImpl original) {
    myOutputUrl = original.myOutputUrl;
    myLanguageLevel = original.myLanguageLevel;
  }

  @Override
  public @NotNull JpsJavaProjectExtensionImpl createCopy() {
    return new JpsJavaProjectExtensionImpl(this);
  }

  @Override
  public String getOutputUrl() {
    return myOutputUrl;
  }

  @Override
  public void setOutputUrl(String outputUrl) {
    if (!Objects.equals(myOutputUrl, outputUrl)) {
      myOutputUrl = outputUrl;
    }
  }

  @Override
  public LanguageLevel getLanguageLevel() {
    return myLanguageLevel;
  }

  @Override
  public void setLanguageLevel(LanguageLevel languageLevel) {
    if (!Comparing.equal(myLanguageLevel, languageLevel)) {
      myLanguageLevel = languageLevel;
    }
  }
}
PK          h5  5  T   org/jetbrains/jps/model/java/impl/JpsProductionModuleOutputPackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.impl.elements.JpsModuleOutputPackagingElementBase;
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
import org.jetbrains.jps.model.java.JpsProductionModuleOutputPackagingElement;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleReference;

class JpsProductionModuleOutputPackagingElementImpl extends JpsModuleOutputPackagingElementBase<JpsProductionModuleOutputPackagingElementImpl>
  implements JpsProductionModuleOutputPackagingElement {
  JpsProductionModuleOutputPackagingElementImpl(JpsModuleReference moduleReference) {
    super(moduleReference);
  }

  private JpsProductionModuleOutputPackagingElementImpl(JpsProductionModuleOutputPackagingElementImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsProductionModuleOutputPackagingElementImpl createElementCopy() {
    return new JpsProductionModuleOutputPackagingElementImpl(this);
  }

  @Override
  protected String getOutputUrl(@NotNull JpsModule module) {
    return JpsJavaExtensionService.getInstance().getOutputUrl(module, false);
  }
}
PK          Zug  g  T   org/jetbrains/jps/model/java/impl/JpsProductionModuleSourcePackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.java.JpsProductionModuleSourcePackagingElement;
import org.jetbrains.jps.model.module.JpsModuleReference;

final class JpsProductionModuleSourcePackagingElementImpl extends JpsCompositeElementBase<JpsProductionModuleSourcePackagingElementImpl>
  implements JpsProductionModuleSourcePackagingElement {

  private static final JpsElementChildRole<JpsModuleReference>
    MODULE_REFERENCE_CHILD_ROLE = JpsElementChildRoleBase.create("module reference");

  JpsProductionModuleSourcePackagingElementImpl(JpsModuleReference moduleReference) {
    myContainer.setChild(MODULE_REFERENCE_CHILD_ROLE, moduleReference);
  }

  @Override
  public @NotNull JpsModuleReference getModuleReference() {
    return myContainer.getChild(MODULE_REFERENCE_CHILD_ROLE);
  }

  private JpsProductionModuleSourcePackagingElementImpl(JpsProductionModuleSourcePackagingElementImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsProductionModuleSourcePackagingElementImpl createCopy() {
    return new JpsProductionModuleSourcePackagingElementImpl(this);
  }

  @Override
  public @NotNull JpsProductionModuleSourcePackagingElementImpl createElementCopy() {
    return new JpsProductionModuleSourcePackagingElementImpl(this);
  }

}
PK          g1    N   org/jetbrains/jps/model/java/impl/JpsTestModuleOutputPackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.impl.elements.JpsModuleOutputPackagingElementBase;
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
import org.jetbrains.jps.model.java.JpsTestModuleOutputPackagingElement;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleReference;

final class JpsTestModuleOutputPackagingElementImpl extends JpsModuleOutputPackagingElementBase<JpsTestModuleOutputPackagingElementImpl>
  implements JpsTestModuleOutputPackagingElement {
  JpsTestModuleOutputPackagingElementImpl(JpsModuleReference moduleReference) {
    super(moduleReference);
  }

  private JpsTestModuleOutputPackagingElementImpl(JpsTestModuleOutputPackagingElementImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsTestModuleOutputPackagingElementImpl createElementCopy() {
    return new JpsTestModuleOutputPackagingElementImpl(this);
  }

  @Override
  protected String getOutputUrl(@NotNull JpsModule module) {
    return JpsJavaExtensionService.getInstance().getOutputUrl(module, true);
  }
}
PK          (MDc
  c
  E   org/jetbrains/jps/model/java/impl/JpsWrappedJavaSdkReferenceImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementReference;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.java.JpsJavaSdkType;
import org.jetbrains.jps.model.java.JpsJavaSdkTypeWrapper;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsTypedLibrary;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.library.sdk.JpsSdkReference;

final class JpsWrappedJavaSdkReferenceImpl extends JpsCompositeElementBase<JpsWrappedJavaSdkReferenceImpl> implements JpsSdkReference<JpsDummyElement> {
  private static final JpsElementChildRoleBase<JpsSdkReference<?>> WRAPPER_ROLE = JpsElementChildRoleBase.create("wrapper reference");
  private final JpsJavaSdkTypeWrapper mySdkType;

  JpsWrappedJavaSdkReferenceImpl(JpsJavaSdkTypeWrapper sdkType, JpsSdkReference<?> wrapperReference) {
    mySdkType = sdkType;
    myContainer.setChild(WRAPPER_ROLE, wrapperReference);
  }

  private JpsWrappedJavaSdkReferenceImpl(JpsWrappedJavaSdkReferenceImpl original) {
    super(original);
    mySdkType = original.mySdkType;
  }

  @Override
  public @NotNull JpsWrappedJavaSdkReferenceImpl createCopy() {
    return new JpsWrappedJavaSdkReferenceImpl(this);
  }

  @Override
  public @NotNull String getSdkName() {
    JpsTypedLibrary<JpsSdk<JpsDummyElement>> sdk = resolve();
    return sdk != null ? sdk.getName() : "<unknown>";
  }

  @Override
  public @Nullable JpsTypedLibrary<JpsSdk<JpsDummyElement>> resolve() {
    JpsTypedLibrary<? extends JpsSdk<? extends JpsElement>> wrapper = myContainer.getChild(WRAPPER_ROLE).resolve();
    if (wrapper == null) return null;
    JpsModel model = getModel();
    if (model == null) return null;
    String sdkName = mySdkType.getJavaSdkName(wrapper.getProperties().getSdkProperties());
    if (sdkName == null) return null;

    JpsLibrary library = model.getGlobal().getLibraryCollection().findLibrary(sdkName);
    return library != null ? library.asTyped(JpsJavaSdkType.INSTANCE) : null;
  }

  @Override
  public JpsElementReference<JpsTypedLibrary<JpsSdk<JpsDummyElement>>> asExternal(@NotNull JpsModel model) {
    model.registerExternalReference(this);
    return this;
  }
}
PK          Ag
  
  B   org/jetbrains/jps/model/library/impl/JpsLibraryCollectionImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.library.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementCollection;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryCollection;
import org.jetbrains.jps.model.library.JpsLibraryType;
import org.jetbrains.jps.model.library.JpsTypedLibrary;

import java.util.List;

public final class JpsLibraryCollectionImpl implements JpsLibraryCollection {
  private final JpsElementCollection<JpsLibrary> myCollection;

  public JpsLibraryCollectionImpl(JpsElementCollection<JpsLibrary> collection) {
    myCollection = collection;
  }

  @Override
  public @NotNull <P extends JpsElement, LibraryType extends JpsLibraryType<P> & JpsElementTypeWithDefaultProperties<P>>
  JpsLibrary addLibrary(@NotNull String name, @NotNull LibraryType type) {
    return addLibrary(name, type, type.createDefaultProperties());
  }

  @Override
  public @NotNull <P extends JpsElement> JpsTypedLibrary<P> addLibrary(@NotNull String name, @NotNull JpsLibraryType<P> type,
                                                                       @NotNull P properties) {
    return myCollection.addChild(new JpsLibraryImpl<>(name, type, properties));
  }

  @Override
  public @NotNull List<JpsLibrary> getLibraries() {
    return myCollection.getElements();
  }

  @Override
  public @NotNull <P extends JpsElement> Iterable<JpsTypedLibrary<P>> getLibraries(@NotNull JpsLibraryType<P> type) {
    return myCollection.getElementsOfType(type);
  }

  @Override
  public void addLibrary(@NotNull JpsLibrary library) {
    myCollection.addChild(library);
  }

  @Override
  public void removeLibrary(@NotNull JpsLibrary library) {
    myCollection.removeChild(library);
  }

  @Override
  public JpsLibrary findLibrary(@NotNull String name) {
    for (JpsLibrary library : getLibraries()) {
      if (name.equals(library.getName())) {
        return library;
      }
    }
    return null;
  }

  @Override
  public @Nullable <E extends JpsElement> JpsTypedLibrary<E> findLibrary(@NotNull String name, @NotNull JpsLibraryType<E> type) {
    for (JpsTypedLibrary<E> library : getLibraries(type)) {
      if (name.equals(library.getName())) {
        return library;
      }
    }
    return null;
  }


}
PK          8sY_  _  8   org/jetbrains/jps/model/library/impl/JpsLibraryImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.library.impl;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsElementCollectionRole;
import org.jetbrains.jps.model.ex.JpsNamedCompositeElementBase;
import org.jetbrains.jps.model.impl.JpsElementCollectionImpl;
import org.jetbrains.jps.model.library.*;
import org.jetbrains.jps.util.JpsPathUtil;

import java.io.File;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

@ApiStatus.Internal
public final class JpsLibraryImpl<P extends JpsElement> extends JpsNamedCompositeElementBase<JpsLibraryImpl<P>> implements JpsTypedLibrary<P> {
  private static final ConcurrentMap<JpsOrderRootType, JpsElementCollectionRole<JpsLibraryRoot>> rootRoles = new ConcurrentHashMap<>();
  private final JpsLibraryType<P> libraryType;

  public JpsLibraryImpl(@NotNull String name, @NotNull JpsLibraryType<P> type, @NotNull P properties) {
    super(name);
    libraryType = type;
    myContainer.setChild(libraryType.getPropertiesRole(), properties);
  }

  private JpsLibraryImpl(@NotNull JpsLibraryImpl<P> original) {
    super(original);
    libraryType = original.libraryType;
  }

  @Override
  public @NotNull JpsLibraryType<P> getType() {
    return libraryType;
  }

  @Override
  public @Nullable <T extends JpsElement> JpsTypedLibrary<T> asTyped(@NotNull JpsLibraryType<T> type) {
    //noinspection unchecked
    return libraryType.equals(type) ? (JpsTypedLibrary<T>)this : null;
  }

  @Override
  public @NotNull P getProperties() {
    return myContainer.getChild(libraryType.getPropertiesRole());
  }

  @Override
  public @NotNull List<JpsLibraryRoot> getRoots(@NotNull JpsOrderRootType rootType) {
    final JpsElementCollection<JpsLibraryRoot> rootsCollection = myContainer.getChild(getRole(rootType));
    return rootsCollection != null ? rootsCollection.getElements() : Collections.emptyList();
  }

  @Override
  public void addRoot(@NotNull String url, @NotNull JpsOrderRootType rootType) {
    addRoot(url, rootType, JpsLibraryRoot.InclusionOptions.ROOT_ITSELF);
  }

  @Override
  public void addRoot(@NotNull File file, @NotNull JpsOrderRootType rootType) {
    addRoot(JpsPathUtil.getLibraryRootUrl(file), rootType);
  }

  @Override
  public void addRoot(@NotNull String url,
                      @NotNull JpsOrderRootType rootType,
                      @NotNull JpsLibraryRoot.InclusionOptions options) {
    myContainer.getOrSetChild(getRole(rootType)).addChild(new JpsLibraryRootImpl(url, rootType, options));
  }

  @Override
  public void removeUrl(@NotNull String url, @NotNull JpsOrderRootType rootType) {
    final JpsElementCollection<JpsLibraryRoot> rootsCollection = myContainer.getChild(getRole(rootType));
    if (rootsCollection != null) {
      for (JpsLibraryRoot root : rootsCollection.getElements()) {
        if (root.getUrl().equals(url) && root.getRootType().equals(rootType)) {
          rootsCollection.removeChild(root);
          break;
        }
      }
    }
  }

  private static @NotNull JpsElementCollectionRole<JpsLibraryRoot> getRole(@NotNull JpsOrderRootType type) {
    return rootRoles.computeIfAbsent(type, it -> {
      return JpsElementCollectionRole.create(new JpsLibraryRootRole(it));
    });
  }

  @Override
  public void delete() {
    getParent().removeChild(this);
  }

  @Override
  public JpsElementCollectionImpl<JpsLibrary> getParent() {
    //noinspection unchecked
    return (JpsElementCollectionImpl<JpsLibrary>)myParent;
  }

  @SuppressWarnings("removal")
  @Override
  public @NotNull JpsLibraryImpl<P> createCopy() {
    return new JpsLibraryImpl<>(this);
  }

  @Override
  public @NotNull JpsLibraryReference createReference() {
    return new JpsLibraryReferenceImpl(getName(), createParentReference());
  }

  private JpsElementReference<JpsCompositeElement> createParentReference() {
    //noinspection unchecked
    return ((JpsReferenceableElement<JpsCompositeElement>)getParent().getParent()).createReference();
  }

  @Override
  public @NotNull @Unmodifiable List<File> getFiles(@NotNull JpsOrderRootType rootType) {
    return JpsLibraryRootProcessing.convertToFiles(getRoots(rootType));
  }

  @Override
  public @NotNull List<Path> getPaths(@NotNull JpsOrderRootType rootType) {
    return JpsLibraryRootProcessing.convertToPaths(getRoots(rootType));
  }

  @Override
  public List<String> getRootUrls(@NotNull JpsOrderRootType rootType) {
    return JpsLibraryRootProcessing.convertToUrls(getRoots(rootType));
  }

  @Override
  public String toString() {
    return "JpsLibraryImpl: " + getName();
  }
}PK          3    A   org/jetbrains/jps/model/library/impl/JpsLibraryReferenceImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.library.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsCompositeElement;
import org.jetbrains.jps.model.JpsElementReference;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.impl.JpsNamedElementReferenceImpl;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryReference;

public final class JpsLibraryReferenceImpl extends JpsNamedElementReferenceImpl<JpsLibrary, JpsLibraryReferenceImpl> implements JpsLibraryReference {
  public JpsLibraryReferenceImpl(String elementName, JpsElementReference<? extends JpsCompositeElement> parentReference) {
    super(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE, elementName, parentReference);
  }

  private JpsLibraryReferenceImpl(JpsLibraryReferenceImpl original) {
    super(original);
  }

  @Override
  public @NotNull String getLibraryName() {
    return myElementName;
  }

  @Override
  public @NotNull JpsLibraryReferenceImpl createCopy() {
    return new JpsLibraryReferenceImpl(this);
  }

  @Override
  public JpsLibraryReference asExternal(@NotNull JpsModel model) {
    model.registerExternalReference(this);
    return this;
  }

  @Override
  public String toString() {
    return "lib ref: '" + myElementName + "' in " + getParentReference();
  }
}
PK          z    8   org/jetbrains/jps/model/library/impl/JpsLibraryRole.java// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.library.impl;

import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsNamedElementCollectionRole;
import org.jetbrains.jps.model.library.JpsLibrary;

public final class JpsLibraryRole extends JpsElementChildRoleBase<JpsLibrary> {
  private static final JpsLibraryRole INSTANCE = new JpsLibraryRole();
  public static final JpsNamedElementCollectionRole<JpsLibrary> LIBRARIES_COLLECTION_ROLE = JpsNamedElementCollectionRole.create(INSTANCE);

  private JpsLibraryRole() {
    super("library");
  }
}
PK          ?    <   org/jetbrains/jps/model/library/impl/JpsLibraryRootImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.library.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryRoot;
import org.jetbrains.jps.model.library.JpsOrderRootType;

final class JpsLibraryRootImpl extends JpsElementBase<JpsLibraryRootImpl> implements JpsLibraryRoot {
  private final String myUrl;
  private final JpsOrderRootType myRootType;
  private final InclusionOptions myOptions;

  JpsLibraryRootImpl(@NotNull String url, @NotNull JpsOrderRootType rootType, @NotNull InclusionOptions options) {
    myUrl = url;
    myRootType = rootType;
    myOptions = options;
  }

  JpsLibraryRootImpl(JpsLibraryRootImpl original) {
    myUrl = original.myUrl;
    myRootType = original.myRootType;
    myOptions = original.myOptions;
  }

  @Override
  public @NotNull JpsOrderRootType getRootType() {
    return myRootType;
  }

  @Override
  public @NotNull String getUrl() {
    return myUrl;
  }

  @Override
  public @NotNull InclusionOptions getInclusionOptions() {
    return myOptions;
  }

  @Override
  public @NotNull JpsLibraryRootImpl createCopy() {
    return new JpsLibraryRootImpl(this);
  }

  @Override
  public @NotNull JpsLibrary getLibrary() {
    return (JpsLibrary)myParent.getParent();
  }
}
PK          %I"^    B   org/jetbrains/jps/model/library/impl/JpsLibraryRootProcessing.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.library.impl;

import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.containers.CollectionFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.library.JpsLibraryRoot;
import org.jetbrains.jps.util.JpsPathUtil;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

public final class JpsLibraryRootProcessing {
  private static final Set<String> AR_EXTENSIONS = CollectionFactory.createFilePathSet(Arrays.asList("jar", "zip", "swc", "ane"));

  private JpsLibraryRootProcessing() {
  }

  public static @NotNull List<String> convertToUrls(@NotNull List<JpsLibraryRoot> roots) {
    List<String> urls = new ArrayList<>();
    for (JpsLibraryRoot root : roots) {
      switch (root.getInclusionOptions()) {
        case ROOT_ITSELF:
          urls.add(root.getUrl());
          break;
        case ARCHIVES_UNDER_ROOT:
          collectArchives(JpsPathUtil.urlToFile(root.getUrl()), false, urls);
          break;
        case ARCHIVES_UNDER_ROOT_RECURSIVELY:
          collectArchives(JpsPathUtil.urlToFile(root.getUrl()), true, urls);
          break;
      }
    }
    return urls;
  }

  public static @NotNull List<File> convertToFiles(@NotNull List<JpsLibraryRoot> roots) {
    List<String> urls = convertToUrls(roots);
    List<File> files = new ArrayList<>(urls.size());
    for (String url : urls) {
      if (!JpsPathUtil.isJrtUrl(url)) {
        files.add(JpsPathUtil.urlToFile(url));
      }
    }
    return files;
  }

  public static @NotNull List<Path> convertToPaths(@NotNull List<JpsLibraryRoot> roots) {
    List<String> urls = convertToUrls(roots);
    List<Path> result = new ArrayList<>(urls.size());
    for (String url : urls) {
      if (!JpsPathUtil.isJrtUrl(url)) {
        result.add(Path.of(JpsPathUtil.urlToPath(url)));
      }
    }
    return result;
  }

  private static void collectArchives(File file, boolean recursively, List<? super String> result) {
    final File[] children = file.listFiles();
    if (children != null) {
      // There is no guarantee about order of files on different OS
      Arrays.sort(children);
      for (File child : children) {
        final String extension = FileUtilRt.getExtension(child.getName());
        if (child.isDirectory()) {
          if (recursively) {
            collectArchives(child, recursively, result);
          }
        }
        // todo get list of extensions mapped to Archive file type from IDE settings
        else if (AR_EXTENSIONS.contains(extension)) {
          result.add(JpsPathUtil.getLibraryRootUrl(child));
        }
      }
    }
  }
}
PK          ?C$    <   org/jetbrains/jps/model/library/impl/JpsLibraryRootRole.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.library.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.library.JpsLibraryRoot;
import org.jetbrains.jps.model.library.JpsOrderRootType;

final class JpsLibraryRootRole extends JpsElementChildRoleBase<JpsLibraryRoot> {
  private final JpsOrderRootType rootType;

  JpsLibraryRootRole(@NotNull JpsOrderRootType rootType) {
    super("library root");
    this.rootType = rootType;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    return rootType.equals(((JpsLibraryRootRole)o).rootType);
  }

  @Override
  public int hashCode() {
    return rootType.hashCode();
  }
}
PK          >C    =   org/jetbrains/jps/model/library/impl/JpsSdkReferenceImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.library.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.impl.JpsNamedElementReferenceBase;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsTypedLibrary;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.library.sdk.JpsSdkReference;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;

public final class JpsSdkReferenceImpl<P extends JpsElement> extends JpsNamedElementReferenceBase<JpsLibrary, JpsTypedLibrary<JpsSdk<P>>, JpsSdkReferenceImpl<P>> implements JpsSdkReference<P> {
  private final JpsSdkType<P> mySdkType;

  public JpsSdkReferenceImpl(@NotNull String elementName, @NotNull JpsSdkType<P> sdkType,
                             @NotNull JpsElementReference<? extends JpsCompositeElement> parentReference) {
    super(elementName, parentReference);
    mySdkType = sdkType;
  }

  private JpsSdkReferenceImpl(JpsSdkReferenceImpl<P> original) {
    super(original);
    mySdkType = original.mySdkType;
  }

  @Override
  public @NotNull String getSdkName() {
    return myElementName;
  }

  @Override
  protected JpsTypedLibrary<JpsSdk<P>> resolve(JpsLibrary element) {
    return element.asTyped(mySdkType);
  }

  @Override
  public @NotNull JpsSdkReferenceImpl<P> createCopy() {
    return new JpsSdkReferenceImpl<>(this);
  }

  @Override
  protected @Nullable JpsNamedElementCollection<? extends JpsLibrary> getNamedElementCollection(@NotNull JpsCompositeElement parent) {
    return parent.getContainer().getChild(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE);
  }

  @Override
  public String toString() {
    return "SDK reference: '" + myElementName + "' in " + getParentReference();
  }
}
PK                6   org/jetbrains/jps/model/library/impl/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.model.library.impl;

import org.jetbrains.annotations.ApiStatus;PK          0Kd  d  F   org/jetbrains/jps/model/module/impl/JpsDependenciesEnumeratorBase.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.module.impl;

import com.intellij.openapi.util.Condition;
import com.intellij.util.CollectConsumer;
import com.intellij.util.Consumer;
import com.intellij.util.EmptyConsumer;
import com.intellij.util.Processor;
import com.intellij.util.containers.CollectionFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.module.*;

import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

public abstract class JpsDependenciesEnumeratorBase<Self extends JpsDependenciesEnumerator> implements JpsDependenciesEnumerator {
  private boolean myWithoutSdk;
  private boolean myWithoutLibraries;
  private boolean myWithoutDepModules;
  private boolean myWithoutModuleSourceEntries;
  protected boolean myRecursively;
  private final Set<JpsModule> myRootModules;
  private Condition<? super JpsDependencyElement> myCondition;

  protected JpsDependenciesEnumeratorBase(Collection<JpsModule> rootModules) {
    myRootModules = Collections.unmodifiableSet(
      rootModules instanceof Set? (Set<JpsModule>)rootModules : new LinkedHashSet<>(rootModules)
    );
  }

  @Override
  public @NotNull Self withoutLibraries() {
    myWithoutLibraries = true;
    return self();
  }

  @Override
  public @NotNull Self withoutDepModules() {
    myWithoutDepModules = true;
    return self();
  }

  @Override
  public @NotNull Self withoutSdk() {
    myWithoutSdk = true;
    return self();
  }

  @Override
  public @NotNull Self withoutModuleSourceEntries() {
    myWithoutModuleSourceEntries = true;
    return self();
  }

  @Override
  public @NotNull Self satisfying(@NotNull Condition<? super JpsDependencyElement> condition) {
    myCondition = condition;
    return self();
  }

  @Override
  public @NotNull Self recursively() {
    myRecursively = true;
    return self();
  }

  protected abstract Self self();

  @Override
  public @NotNull Set<JpsModule> getModules() {
    Set<JpsModule> result = new LinkedHashSet<>();
    processModules(new CollectConsumer<>(result));
    return result;
  }

  @Override
  public void processModules(final @NotNull Consumer<? super JpsModule> consumer) {
    processModuleAndLibraries(consumer, EmptyConsumer.getInstance());
  }

  protected boolean shouldProcessDependenciesRecursively() {
    return true;
  }

  public boolean processDependencies(Processor<? super JpsDependencyElement> processor) {
    Set<JpsModule> processed = CollectionFactory.createSmallMemoryFootprintSet();
    for (JpsModule module : myRootModules) {
      if (!doProcessDependencies(module, processor, processed)) {
        return false;
      }
    }
    return true;
  }

  private boolean doProcessDependencies(JpsModule module, Processor<? super JpsDependencyElement> processor, Set<? super JpsModule> processed) {
    if (!processed.add(module)) return true;

    for (JpsDependencyElement element : module.getDependenciesList().getDependencies()) {
      if (myCondition != null && !myCondition.value(element)) continue;

      if (myWithoutSdk && element instanceof JpsSdkDependency
       || myWithoutLibraries && element instanceof JpsLibraryDependency
       || myWithoutModuleSourceEntries && element instanceof JpsModuleSourceDependency) continue;

      if (myWithoutDepModules) {
        if (!myRecursively && element instanceof JpsModuleDependency) continue;
        if (element instanceof JpsModuleSourceDependency && !isEnumerationRootModule(module)) continue;
      }

      if (!shouldProcess(module, element)) {
        continue;
      }

      if (element instanceof JpsModuleDependency) {
        if (myRecursively && shouldProcessDependenciesRecursively()) {
          JpsModule depModule = ((JpsModuleDependency)element).getModule();
          if (depModule != null) {
            if (!doProcessDependencies(depModule, processor, processed)) {
              return false;
            }
            continue;
          }
        }
        if (myWithoutDepModules) continue;
      }

      if (!processor.process(element)) {
        return false;
      }
    }

    return true;
  }

  protected boolean shouldProcess(JpsModule module, JpsDependencyElement element) {
    return true;
  }

  public boolean isEnumerationRootModule(JpsModule module) {
    return myRootModules.contains(module);
  }

  @Override
  public @NotNull Set<JpsLibrary> getLibraries() {
    Set<JpsLibrary> libraries = new LinkedHashSet<>();
    processLibraries(new CollectConsumer<>(libraries));
    return libraries;
  }

  @Override
  public void processLibraries(final @NotNull Consumer<? super JpsLibrary> consumer) {
    processModuleAndLibraries(EmptyConsumer.getInstance(), consumer);
  }

  @Override
  public void processModuleAndLibraries(final @Nullable Consumer<? super JpsModule> moduleConsumer, final @Nullable Consumer<? super JpsLibrary> libraryConsumer) {
    processDependencies(dependencyElement -> {
      if (moduleConsumer != null) {
        if (myRecursively && dependencyElement instanceof JpsModuleSourceDependency) {
          moduleConsumer.consume(dependencyElement.getContainingModule());
        }
        else if ((!myRecursively || !shouldProcessDependenciesRecursively()) && dependencyElement instanceof JpsModuleDependency) {
          JpsModule module = ((JpsModuleDependency)dependencyElement).getModule();
          if (module != null) {
            moduleConsumer.consume(module);
          }
        }
      }
      if (libraryConsumer != null && dependencyElement instanceof JpsLibraryDependency) {
        JpsLibrary library = ((JpsLibraryDependency)dependencyElement).getLibrary();
        if (library != null) {
          libraryConsumer.consume(library);
        }
      }
      return true;
    });
  }
}
PK          1W  W  @   org/jetbrains/jps/model/module/impl/JpsDependenciesListImpl.java/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsElementCollectionRole;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryReference;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;
import org.jetbrains.jps.model.module.*;

import java.util.List;

final class JpsDependenciesListImpl extends JpsCompositeElementBase<JpsDependenciesListImpl> implements JpsDependenciesList {
  public static final JpsElementCollectionRole<JpsDependencyElement> DEPENDENCY_COLLECTION_ROLE =
    JpsElementCollectionRole.create(JpsElementChildRoleBase.create("dependency"));

  JpsDependenciesListImpl() {
    super();
    myContainer.setChild(DEPENDENCY_COLLECTION_ROLE);
  }

  private JpsDependenciesListImpl(JpsDependenciesListImpl original) {
    super(original);
  }

  @Override
  public @NotNull List<JpsDependencyElement> getDependencies() {
    return myContainer.getChild(DEPENDENCY_COLLECTION_ROLE).getElements();
  }

  @Override
  public void clear() {
    myContainer.getChild(DEPENDENCY_COLLECTION_ROLE).removeAllChildren();
  }

  @Override
  public @NotNull JpsModuleDependency addModuleDependency(@NotNull JpsModule module) {
    return addModuleDependency(module.createReference());
  }

  @Override
  public @NotNull JpsModuleDependency addModuleDependency(@NotNull JpsModuleReference moduleReference) {
    final JpsModuleDependencyImpl dependency = new JpsModuleDependencyImpl(moduleReference);
    myContainer.getChild(DEPENDENCY_COLLECTION_ROLE).addChild(dependency);
    return dependency;
  }

  @Override
  public @NotNull JpsLibraryDependency addLibraryDependency(@NotNull JpsLibrary libraryElement) {
    return addLibraryDependency(libraryElement.createReference());
  }

  @Override
  public @NotNull JpsLibraryDependency addLibraryDependency(@NotNull JpsLibraryReference libraryReference) {
    final JpsLibraryDependencyImpl dependency = new JpsLibraryDependencyImpl(libraryReference);
    myContainer.getChild(DEPENDENCY_COLLECTION_ROLE).addChild(dependency);
    return dependency;
  }

  @Override
  public void addModuleSourceDependency() {
    myContainer.getChild(DEPENDENCY_COLLECTION_ROLE).addChild(new JpsModuleSourceDependencyImpl());
  }

  @Override
  public void addSdkDependency(@NotNull JpsSdkType<?> sdkType) {
    myContainer.getChild(DEPENDENCY_COLLECTION_ROLE).addChild(new JpsSdkDependencyImpl(sdkType));
  }

  @Override
  public @NotNull JpsDependenciesListImpl createCopy() {
    return new JpsDependenciesListImpl(this);
  }

  @Override
  public JpsModuleImpl getParent() {
    return (JpsModuleImpl)super.getParent();
  }
}
PK          8n~  ~  K   org/jetbrains/jps/model/module/impl/JpsDependenciesRootsEnumeratorBase.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.module.impl;

import com.intellij.util.CollectConsumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsOrderRootType;
import org.jetbrains.jps.model.module.*;
import org.jetbrains.jps.util.JpsPathUtil;

import java.io.File;
import java.nio.file.Path;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.function.Consumer;

public abstract class JpsDependenciesRootsEnumeratorBase<E extends JpsDependenciesEnumeratorBase<?>> implements JpsDependenciesRootsEnumerator {
  protected final JpsOrderRootType myRootType;
  protected final E myDependenciesEnumerator;

  public JpsDependenciesRootsEnumeratorBase(E dependenciesEnumerator, JpsOrderRootType rootType) {
    myDependenciesEnumerator = dependenciesEnumerator;
    myRootType = rootType;
  }

  @Override
  public Collection<String> getUrls() {
    Set<String> urls = new LinkedHashSet<>();
    processUrls(new CollectConsumer<>(urls));
    return urls;
  }

  @Override
  public final Collection<File> getRoots() {
    Set<File> files = new LinkedHashSet<>();
    Consumer<String> urlConsumer = url -> {
      if (!JpsPathUtil.isJrtUrl(url)) {
        files.add(JpsPathUtil.urlToFile(url));
      }
    };
    myDependenciesEnumerator.processDependencies(dependencyElement -> {
      if (dependencyElement instanceof JpsModuleSourceDependency) {
        processModuleRootUrls(dependencyElement.getContainingModule(), dependencyElement, urlConsumer);
      }
      else if (dependencyElement instanceof JpsModuleDependency) {
        JpsModule dep = ((JpsModuleDependency)dependencyElement).getModule();
        if (dep != null) {
          processModuleRootUrls(dep, dependencyElement, urlConsumer);
        }
      }
      else if (dependencyElement instanceof JpsLibraryDependency) {
        JpsLibrary lib = ((JpsLibraryDependency)dependencyElement).getLibrary();
        if (lib != null) {
          files.addAll(lib.getFiles(myRootType));
        }
      }
      else if (dependencyElement instanceof JpsSdkDependency) {
        JpsLibrary lib = ((JpsSdkDependency)dependencyElement).resolveSdk();
        if (lib != null) {
          processLibraryRootUrls(lib, urlConsumer);
        }
      }
      return true;
    });
    return files;
  }

  @Override
  public final Collection<Path> getPaths() {
    Set<Path> files = new LinkedHashSet<>();
    Consumer<String> urlConsumer = url -> {
      if (!JpsPathUtil.isJrtUrl(url)) {
        files.add(Path.of(JpsPathUtil.urlToPath(url)));
      }
    };
    myDependenciesEnumerator.processDependencies(dependencyElement -> {
      if (dependencyElement instanceof JpsModuleSourceDependency) {
        processModuleRootUrls(dependencyElement.getContainingModule(), dependencyElement, urlConsumer);
      }
      else if (dependencyElement instanceof JpsModuleDependency) {
        JpsModule dep = ((JpsModuleDependency)dependencyElement).getModule();
        if (dep != null) {
          processModuleRootUrls(dep, dependencyElement, urlConsumer);
        }
      }
      else if (dependencyElement instanceof JpsLibraryDependency) {
        JpsLibrary lib = ((JpsLibraryDependency)dependencyElement).getLibrary();
        if (lib != null) {
          files.addAll(lib.getPaths(myRootType));
        }
      }
      else if (dependencyElement instanceof JpsSdkDependency) {
        JpsLibrary lib = ((JpsSdkDependency)dependencyElement).resolveSdk();
        if (lib != null) {
          processLibraryRootUrls(lib, urlConsumer);
        }
      }
      return true;
    });
    return files;
  }

  private void processUrls(@NotNull Consumer<? super String> urlConsumer) {
    myDependenciesEnumerator.processDependencies(dependencyElement -> {
      if (dependencyElement instanceof JpsModuleSourceDependency) {
        processModuleRootUrls(dependencyElement.getContainingModule(), dependencyElement, urlConsumer);
      }
      else if (dependencyElement instanceof JpsModuleDependency) {
        JpsModule dep = ((JpsModuleDependency)dependencyElement).getModule();
        if (dep != null) {
          processModuleRootUrls(dep, dependencyElement, urlConsumer);
        }
      }
      else if (dependencyElement instanceof JpsLibraryDependency) {
        JpsLibrary lib = ((JpsLibraryDependency)dependencyElement).getLibrary();
        if (lib != null) {
          processLibraryRootUrls(lib, urlConsumer);
        }
      }
      else if (dependencyElement instanceof JpsSdkDependency) {
        JpsLibrary lib = ((JpsSdkDependency)dependencyElement).resolveSdk();
        if (lib != null) {
          processLibraryRootUrls(lib, urlConsumer);
        }
      }
      return true;
    });
  }

  private void processLibraryRootUrls(JpsLibrary library, Consumer<? super String> urlConsumer) {
    for (String url : library.getRootUrls(myRootType)) {
      urlConsumer.accept(url);
    }
  }

  protected abstract boolean processModuleRootUrls(JpsModule module, JpsDependencyElement dependencyElement, Consumer<? super String> urlConsumer);
}PK          ;    A   org/jetbrains/jps/model/module/impl/JpsDependencyElementBase.java/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.module.JpsDependencyElement;
import org.jetbrains.jps.model.module.JpsModule;

abstract class JpsDependencyElementBase<Self extends JpsDependencyElementBase<Self>> extends JpsCompositeElementBase<Self> implements JpsDependencyElement {
  protected JpsDependencyElementBase() {
    super();
  }

  protected JpsDependencyElementBase(JpsDependencyElementBase<Self> original) {
    super(original);
  }

  @Override
  public void remove() {
    ((JpsDependenciesListImpl)myParent.getParent()).getContainer().getChild(JpsDependenciesListImpl.DEPENDENCY_COLLECTION_ROLE).removeChild(this);
  }

  public JpsDependenciesListImpl getDependenciesList() {
    return (JpsDependenciesListImpl)myParent.getParent();
  }

  @Override
  public JpsModule getContainingModule() {
    return getDependenciesList().getParent();
  }
}
PK          e    A   org/jetbrains/jps/model/module/impl/JpsLibraryDependencyImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.module.impl;

import com.intellij.openapi.util.Ref;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryReference;
import org.jetbrains.jps.model.module.JpsLibraryDependency;

final class JpsLibraryDependencyImpl extends JpsDependencyElementBase<JpsLibraryDependencyImpl> implements JpsLibraryDependency {
  public static final JpsElementChildRole<JpsLibraryReference>
    LIBRARY_REFERENCE_CHILD_ROLE = JpsElementChildRoleBase.create("library reference");

  private volatile Ref<JpsLibrary> myCachedLibrary = null;
  
  JpsLibraryDependencyImpl(final JpsLibraryReference reference) {
    super();
    myContainer.setChild(LIBRARY_REFERENCE_CHILD_ROLE, reference);
  }

  JpsLibraryDependencyImpl(JpsLibraryDependencyImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsLibraryReference getLibraryReference() {
    return myContainer.getChild(LIBRARY_REFERENCE_CHILD_ROLE);
  }

  @Override
  public JpsLibrary getLibrary() {
    Ref<JpsLibrary> libRef = myCachedLibrary;
    if (libRef == null) {
      libRef = new Ref<>(getLibraryReference().resolve());
      myCachedLibrary = libRef;
    }
    return libRef.get();
  }

  @Override
  public @NotNull JpsLibraryDependencyImpl createCopy() {
    return new JpsLibraryDependencyImpl(this);
  }

  @Override
  public String toString() {
    return "lib dep [" + getLibraryReference() + "]";
  }
}
PK          $(G    @   org/jetbrains/jps/model/module/impl/JpsModuleDependencyImpl.java/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jetbrains.jps.model.module.impl;

import com.intellij.openapi.util.Ref;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleDependency;
import org.jetbrains.jps.model.module.JpsModuleReference;

final class JpsModuleDependencyImpl extends JpsDependencyElementBase<JpsModuleDependencyImpl> implements JpsModuleDependency {
  private static final JpsElementChildRole<JpsModuleReference>
    MODULE_REFERENCE_CHILD_ROLE = JpsElementChildRoleBase.create("module reference");

  private volatile Ref<JpsModule> myCachedModule = null;

  JpsModuleDependencyImpl(final JpsModuleReference moduleReference) {
    super();
    myContainer.setChild(MODULE_REFERENCE_CHILD_ROLE, moduleReference);
  }

  JpsModuleDependencyImpl(JpsModuleDependencyImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsModuleReference getModuleReference() {
    return myContainer.getChild(MODULE_REFERENCE_CHILD_ROLE);
  }

  @Override
  public JpsModule getModule() {
    Ref<JpsModule> moduleRef = myCachedModule;
    if (moduleRef == null) {
      moduleRef = new Ref<>(getModuleReference().resolve());
      myCachedModule = moduleRef;
    }
    return moduleRef.get();
  }

  @Override
  public @NotNull JpsModuleDependencyImpl createCopy() {
    return new JpsModuleDependencyImpl(this);
  }

  @Override
  public String toString() {
    return "module dep [" + getModuleReference() + "]";
  }
}
PK         \     6   org/jetbrains/jps/model/module/impl/JpsModuleImpl.javaYo6_塐L	=60m@hG,y%KxuqHEW]]^`zK(P?Qh&DMI棻tCD遬16}$!Za`?W%5N2w`)1]qi>w%f1>OJE$IJ<Ii3%Wj7R}6'<m537qL=Ia?,Xrj%ٔK!F-ޑxeqCȖ+hb?IMF2p+Vp9YĖ.§W,&8YF\+ʀ~1xb_+2am$:-'!+U̍ŨC|0 's@1XbQjr8Yϧ#J7;cd!4;~hw|7`a	vBc=Xqevp6h@)R5 ;L۩d$'Eg|(QtiRU P7WT`dwN%%-79)O4D8-J 1`.2B<F~TMܘY.ï{^Y:בס\EMнd;置25,xS\y^snl3x</GӉ0Brm87fCQ=ⱑ-YQt/++.іE	|jַ&߾|ßP(:js-+=s$Jycv TFGmFgk_BV*s0ĀI
^b@g~aq|!3Oy]]@ ffӾ8Yʄ²yD<MtUm$ܔdQZ'e1L()[,ݘ(JڏL=[џ醧.-(Q <8$6 ٲɝsSIj	={A5UjGd	@δ#җliV\,*J.}oꮧ<}\v_mR	\yfNU#mW;Yz!E' !)LX[A?ח߄0qt<o;ÁrNuThe2{8(^k*M
Fc`'yBS뵐]F!\hoshippAc
TXU/Qj'򺈓CzΓ)%7n|ӣ7v]މ ZksFVZ"G<k7eUh	سokN'2FZ	h#@LًWDy[6x1K9m|WgH[lHaɖW7=$oAN]3ԩA}9o{g~8TUm'yS;Pv\xVs̢іɩya'ԭ#^M&
HYCEi;כr(eEi?ܻRHq\SU*(Fi/1Z%u[Ig=JOWy:ce&2SLfmBxMŃ̸Fg$tPK              ?   org/jetbrains/jps/model/module/impl/JpsModuleReferenceImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.impl.JpsNamedElementReferenceImpl;
import org.jetbrains.jps.model.impl.JpsProjectElementReference;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleReference;

public final class JpsModuleReferenceImpl extends JpsNamedElementReferenceImpl<JpsModule, JpsModuleReferenceImpl> implements JpsModuleReference {
  public JpsModuleReferenceImpl(String elementName) {
    super(JpsModuleRole.MODULE_COLLECTION_ROLE, elementName, new JpsProjectElementReference());
  }

  @Override
  public @NotNull JpsModuleReferenceImpl createCopy() {
    return new JpsModuleReferenceImpl(myElementName);
  }

  @Override
  public @NotNull String getModuleName() {
    return myElementName;
  }

  @Override
  public JpsModuleReference asExternal(@NotNull JpsModel model) {
    model.registerExternalReference(this);
    return this;
  }

  @Override
  public String toString() {
    return "module ref: '" + myElementName + "' in " + getParentReference();
  }
}
PK          ~    6   org/jetbrains/jps/model/module/impl/JpsModuleRole.java// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsNamedElementCollectionRole;
import org.jetbrains.jps.model.module.JpsModule;

public final class JpsModuleRole extends JpsElementChildRoleBase<JpsModule> {
  private static final JpsElementChildRole<JpsModule> INSTANCE = new JpsModuleRole();
  public static final JpsNamedElementCollectionRole<JpsModule> MODULE_COLLECTION_ROLE = JpsNamedElementCollectionRole.create(INSTANCE);

  private JpsModuleRole() {
    super("module");
  }
}
PK              F   org/jetbrains/jps/model/module/impl/JpsModuleSourceDependencyImpl.java/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.module.JpsModuleSourceDependency;

final class JpsModuleSourceDependencyImpl extends JpsDependencyElementBase<JpsModuleSourceDependencyImpl>
  implements JpsModuleSourceDependency {
  JpsModuleSourceDependencyImpl() {
    super();
  }

  JpsModuleSourceDependencyImpl(JpsModuleSourceDependencyImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsModuleSourceDependencyImpl createCopy() {
    return new JpsModuleSourceDependencyImpl(this);
  }

  @Override
  public String toString() {
    return "module source dep";
  }
}
PK          LЕ    @   org/jetbrains/jps/model/module/impl/JpsModuleSourceRootImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementType;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
import org.jetbrains.jps.model.module.JpsTypedModuleSourceRoot;
import org.jetbrains.jps.util.JpsPathUtil;

import java.io.File;
import java.nio.file.Path;
import java.util.Set;

public final class JpsModuleSourceRootImpl<P extends JpsElement> extends JpsCompositeElementBase<JpsModuleSourceRootImpl<P>> implements JpsTypedModuleSourceRoot<P> {
  private final JpsModuleSourceRootType<P> rootType;
  private final String url;

  public JpsModuleSourceRootImpl(String url, JpsModuleSourceRootType<P> type, P properties) {
    super();
    rootType = type;
    myContainer.setChild(type.getPropertiesRole(), properties);
    this.url = url;
  }

  @SuppressWarnings("deprecation")
  private JpsModuleSourceRootImpl(JpsModuleSourceRootImpl<P> original) {
    super(original);
    rootType = original.rootType;
    url = original.url;
  }

  @Override
  public <T extends JpsElement> T getProperties(@NotNull JpsModuleSourceRootType<T> type) {
    if (rootType.equals(type)) {
      //noinspection unchecked
      return (T)myContainer.getChild(rootType.getPropertiesRole());
    }
    return null;
  }

  @Override
  public @Nullable <T extends JpsElement> T getProperties(@NotNull Set<? extends JpsModuleSourceRootType<T>> types) {
    if (types.contains(rootType)) {
      //noinspection unchecked
      return (T)getProperties();
    }
    return null;
  }

  @Override
  public @Nullable <T extends JpsElement> JpsTypedModuleSourceRoot<T> asTyped(@NotNull JpsModuleSourceRootType<T> type) {
    //noinspection unchecked
    return rootType.equals(type) ? (JpsTypedModuleSourceRoot<T>)this : null;
  }

  @Override
  public @NotNull JpsTypedModuleSourceRoot<?> asTyped() {
    return this;
  }

  @Override
  public JpsElementType<?> getType() {
    return rootType;
  }

  @Override
  public @NotNull P getProperties() {
    return myContainer.getChild(rootType.getPropertiesRole());
  }

  @Override
  public @NotNull JpsModuleSourceRootType<P> getRootType() {
    return rootType;
  }

  @Override
  public @NotNull String getUrl() {
    return url;
  }

  @Override
  public @NotNull File getFile() {
    return JpsPathUtil.urlToFile(url);
  }

  @Override
  public @NotNull Path getPath() {
    return Path.of(JpsPathUtil.urlToPath(url));
  }

  @SuppressWarnings("removal")
  @Override
  public @NotNull JpsModuleSourceRootImpl<P> createCopy() {
    return new JpsModuleSourceRootImpl<>(this);
  }

  @Override
  public String toString() {
    return "JpsModuleSourceRootImpl(" +
           "rootType=" + rootType +
           ", url='" + url + '\'' +
           ')';
  }
}
PK              @   org/jetbrains/jps/model/module/impl/JpsModuleSourceRootRole.java// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsElementCollectionRole;
import org.jetbrains.jps.model.module.JpsModuleSourceRoot;

final class JpsModuleSourceRootRole extends JpsElementChildRoleBase<JpsModuleSourceRoot> {
  private static final JpsModuleSourceRootRole INSTANCE = new JpsModuleSourceRootRole();
  static final JpsElementCollectionRole<JpsModuleSourceRoot> ROOT_COLLECTION_ROLE = JpsElementCollectionRole.create(INSTANCE);

  private JpsModuleSourceRootRole() {
    super("module source root");
  }
}
PK          ^    =   org/jetbrains/jps/model/module/impl/JpsSdkDependencyImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.sdk.JpsSdkReference;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;
import org.jetbrains.jps.model.module.JpsSdkDependency;

final class JpsSdkDependencyImpl extends JpsDependencyElementBase<JpsSdkDependencyImpl> implements JpsSdkDependency {
  private final JpsSdkType<?> mySdkType;

  JpsSdkDependencyImpl(@NotNull JpsSdkType<?> sdkType) {
    super();
    mySdkType = sdkType;
  }

  JpsSdkDependencyImpl(JpsSdkDependencyImpl original) {
    super(original);
    mySdkType = original.mySdkType;
  }

  @Override
  public @NotNull JpsSdkDependencyImpl createCopy() {
    return new JpsSdkDependencyImpl(this);
  }

  @Override
  public @NotNull JpsSdkType<?> getSdkType() {
    return mySdkType;
  }

  @Override
  public JpsLibrary resolveSdk() {
    final JpsSdkReference<?> reference = getSdkReference();
    if (reference == null) return null;
    return reference.resolve();
  }

  @Override
  public @Nullable JpsSdkReference<?> getSdkReference() {
    return getContainingModule().getSdkReference(mySdkType);
  }

  @Override
  public String toString() {
    return "sdk dep [" + mySdkType + "]";
  }
}
PK          A    <   org/jetbrains/jps/model/module/impl/JpsSdkReferenceRole.java/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.library.sdk.JpsSdkReference;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;

public final class JpsSdkReferenceRole<P extends JpsElement> extends JpsElementChildRoleBase<JpsSdkReference<P>> {
  private final JpsSdkType<P> myType;

  public JpsSdkReferenceRole(@NotNull JpsSdkType<P> type) {
    super("sdk reference " + type);
    myType = type;
  }

  @Override
  public int hashCode() {
    return myType.hashCode();
  }

  @Override
  public boolean equals(Object obj) {
    return obj instanceof JpsSdkReferenceRole && myType.equals(((JpsSdkReferenceRole)obj).myType);
  }
}
PK          _@
  @
  B   org/jetbrains/jps/model/module/impl/JpsSdkReferencesTableImpl.java// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementCreator;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.library.sdk.JpsSdkReference;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;
import org.jetbrains.jps.model.module.JpsSdkReferencesTable;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public final class JpsSdkReferencesTableImpl extends JpsCompositeElementBase<JpsSdkReferencesTableImpl> implements JpsSdkReferencesTable {
  public static final JpsSdkReferencesTableRole ROLE = new JpsSdkReferencesTableRole();
  private static final ConcurrentMap<JpsSdkType, JpsSdkReferenceRole> ourReferenceRoles = new ConcurrentHashMap<>();

  public JpsSdkReferencesTableImpl() {
    super();
  }

  private JpsSdkReferencesTableImpl(JpsSdkReferencesTableImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsSdkReferencesTableImpl createCopy() {
    return new JpsSdkReferencesTableImpl(this);
  }

  @Override
  public <P extends JpsElement> void setSdkReference(@NotNull JpsSdkType<P> type, @Nullable JpsSdkReference<P> sdkReference) {
    JpsSdkReferenceRole<P> role = getSdkReferenceRole(type);
    if (sdkReference != null) {
      myContainer.setChild(role, sdkReference);
    }
    else {
      myContainer.removeChild(role);
    }
  }

  @Override
  public <P extends JpsElement> JpsSdkReference<P> getSdkReference(@NotNull JpsSdkType<P> type) {
    return myContainer.getChild(getSdkReferenceRole(type));
  }

  @SuppressWarnings("unchecked")
  private static @NotNull <P extends JpsElement> JpsSdkReferenceRole<P> getSdkReferenceRole(@NotNull JpsSdkType<P> type) {
    JpsSdkReferenceRole<P> role = ourReferenceRoles.get(type);
    if (role != null) return role;
    ourReferenceRoles.putIfAbsent(type, new JpsSdkReferenceRole<>(type));
    return ourReferenceRoles.get(type);
  }

  public static class JpsSdkReferencesTableRole extends JpsElementChildRoleBase<JpsSdkReferencesTable> implements JpsElementCreator<JpsSdkReferencesTable> {
    JpsSdkReferencesTableRole() {
      super("sdk references");
    }

    @Override
    public @NotNull JpsSdkReferencesTable create() {
      return new JpsSdkReferencesTableImpl();
    }
  }
}
PK              D   org/jetbrains/jps/model/module/impl/JpsTestModulePropertiesImpl.java// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.module.impl;

import com.intellij.openapi.util.NullableLazyValue;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleReference;
import org.jetbrains.jps.model.module.JpsTestModuleProperties;

import static com.intellij.openapi.util.NullableLazyValue.volatileLazyNullable;

public final class JpsTestModulePropertiesImpl extends JpsCompositeElementBase<JpsTestModulePropertiesImpl> implements JpsTestModuleProperties {
  public static final JpsElementChildRole<JpsTestModuleProperties> ROLE = JpsElementChildRoleBase.create("test module properties");

  private static final JpsElementChildRole<JpsModuleReference> MODULE_REFERENCE_CHILD_ROLE = JpsElementChildRoleBase.create("production module reference");

  private final NullableLazyValue<JpsModule> myCachedProductionModule = volatileLazyNullable(() -> getProductionModuleReference().resolve());

  public JpsTestModulePropertiesImpl(@NotNull JpsModuleReference productionModuleReference) {
    myContainer.setChild(MODULE_REFERENCE_CHILD_ROLE, productionModuleReference);
  }

  private JpsTestModulePropertiesImpl(JpsTestModulePropertiesImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsModuleReference getProductionModuleReference() {
    return myContainer.getChild(MODULE_REFERENCE_CHILD_ROLE);
  }

  @Override
  public @Nullable JpsModule getProductionModule() {
    return myCachedProductionModule.getValue();
  }


  @Override
  public @NotNull JpsTestModulePropertiesImpl createCopy() {
    return new JpsTestModulePropertiesImpl(this);
  }
}
PK          ^      5   org/jetbrains/jps/model/module/impl/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.model.module.impl;

import org.jetbrains.annotations.ApiStatus;PK          $N    Y   com/intellij/platform/jps/model/impl/resolver/JpsDependencyResolverConfigurationImpl.java// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.jps.model.impl.resolver;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import com.intellij.platform.jps.model.resolver.JpsDependencyResolverConfiguration;

public class JpsDependencyResolverConfigurationImpl extends JpsElementBase<JpsDependencyResolverConfigurationImpl>
  implements JpsDependencyResolverConfiguration {
  public static final JpsElementChildRole<JpsDependencyResolverConfiguration> ROLE =
    JpsElementChildRoleBase.create("dependency resolver configuration");

  private boolean checksumVerificationEnabled;
  private boolean bindRepositoryEnabled;

  public JpsDependencyResolverConfigurationImpl() {
    this(false, false);
  }

  private JpsDependencyResolverConfigurationImpl(JpsDependencyResolverConfigurationImpl other) {
    this(other.checksumVerificationEnabled, other.bindRepositoryEnabled);
  }

  private JpsDependencyResolverConfigurationImpl(boolean checksumVerificationEnabled,
                                                 boolean bindRepositoryEnabled) {
    this.checksumVerificationEnabled = checksumVerificationEnabled;
    this.bindRepositoryEnabled = bindRepositoryEnabled;
  }

  @Override
  public boolean isSha256ChecksumVerificationEnabled() {
    return checksumVerificationEnabled;
  }

  @Override
  public boolean isBindRepositoryEnabled() {
    return bindRepositoryEnabled;
  }

  @Override
  public void setSha256ChecksumVerificationEnabled(boolean value) {
    checksumVerificationEnabled = value;
  }

  @Override
  public void setBindRepositoryEnabled(boolean value) {
    bindRepositoryEnabled = value;
  }

  @Override
  public @NotNull JpsDependencyResolverConfigurationImpl createCopy() {
    return new JpsDependencyResolverConfigurationImpl(this);
  }
}
PK          &    `   com/intellij/platform/jps/model/impl/resolver/JpsDependencyResolverConfigurationServiceImpl.java// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.jps.model.impl.resolver;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsProject;
import com.intellij.platform.jps.model.resolver.JpsDependencyResolverConfiguration;
import com.intellij.platform.jps.model.resolver.JpsDependencyResolverConfigurationService;

public class JpsDependencyResolverConfigurationServiceImpl extends JpsDependencyResolverConfigurationService {
  @Override
  public @Nullable JpsDependencyResolverConfiguration getDependencyResolverConfiguration(@NotNull JpsProject project) {
    return project.getContainer().getChild(JpsDependencyResolverConfigurationImpl.ROLE);
  }

  @Override
  public @NotNull JpsDependencyResolverConfiguration getOrCreateDependencyResolverConfiguration(@NotNull JpsProject project) {
    JpsDependencyResolverConfiguration config = getDependencyResolverConfiguration(project);
    if (config == null) {
      config = project.getContainer().setChild(JpsDependencyResolverConfigurationImpl.ROLE, new JpsDependencyResolverConfigurationImpl());
    }
    return config;
  }
}
PK          w      ?   com/intellij/platform/jps/model/impl/resolver/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package com.intellij.platform.jps.model.impl.resolver;

import org.jetbrains.annotations.ApiStatus;PK              R   org/jetbrains/jps/model/artifact/impl/elements/JpsArchivePackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.elements.JpsArchivePackagingElement;

class JpsArchivePackagingElementImpl extends JpsCompositePackagingElementBase<JpsArchivePackagingElementImpl>
  implements JpsArchivePackagingElement {
  private String myArchiveName;

  JpsArchivePackagingElementImpl(String archiveName) {
    myArchiveName = archiveName;
  }

  private JpsArchivePackagingElementImpl(JpsArchivePackagingElementImpl original) {
    super(original);
    myArchiveName = original.myArchiveName;
  }

  @Override
  public @NotNull JpsArchivePackagingElementImpl createCopy() {
    return new JpsArchivePackagingElementImpl(this);
  }

  @Override
  public @NotNull JpsArchivePackagingElementImpl createElementCopy() {
    return new JpsArchivePackagingElementImpl(this);
  }

  @Override
  public String getArchiveName() {
    return myArchiveName;
  }

  @Override
  public void setArchiveName(String directoryName) {
    if (!myArchiveName.equals(directoryName)) {
      myArchiveName = directoryName;
    }
  }
}
PK          u/    Y   org/jetbrains/jps/model/artifact/impl/elements/JpsArtifactOutputPackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.artifact.JpsArtifactReference;
import org.jetbrains.jps.model.artifact.elements.JpsArtifactOutputPackagingElement;
import org.jetbrains.jps.model.artifact.elements.JpsArtifactRootElement;
import org.jetbrains.jps.model.artifact.elements.JpsCompositePackagingElement;
import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
import org.jetbrains.jps.model.artifact.elements.ex.JpsComplexPackagingElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

class JpsArtifactOutputPackagingElementImpl extends JpsComplexPackagingElementBase<JpsArtifactOutputPackagingElementImpl>
  implements JpsArtifactOutputPackagingElement {
  private static final JpsElementChildRole<JpsArtifactReference>
    ARTIFACT_REFERENCE_CHILD_ROLE = JpsElementChildRoleBase.create("artifact reference");

  JpsArtifactOutputPackagingElementImpl(@NotNull JpsArtifactReference reference) {
    myContainer.setChild(ARTIFACT_REFERENCE_CHILD_ROLE, reference);
  }

  private JpsArtifactOutputPackagingElementImpl(JpsArtifactOutputPackagingElementImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsArtifactOutputPackagingElementImpl createElementCopy() {
    return new JpsArtifactOutputPackagingElementImpl(this);
  }

  @Override
  public @NotNull JpsArtifactReference getArtifactReference() {
    return myContainer.getChild(ARTIFACT_REFERENCE_CHILD_ROLE);
  }

  @Override
  public List<JpsPackagingElement> getSubstitution() {
    JpsArtifact artifact = getArtifactReference().resolve();
    if (artifact == null) return Collections.emptyList();
    JpsCompositePackagingElement rootElement = artifact.getRootElement();
    if (rootElement instanceof JpsArtifactRootElement) {
      return new ArrayList<>(rootElement.getChildren());
    }
    else {
      return Collections.singletonList(rootElement);
    }
  }
}
PK          C 8  8  N   org/jetbrains/jps/model/artifact/impl/elements/JpsArtifactRootElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.elements.JpsArtifactRootElement;

class JpsArtifactRootElementImpl extends JpsCompositePackagingElementBase<JpsArtifactRootElementImpl> implements JpsArtifactRootElement {
  JpsArtifactRootElementImpl() {
  }

  private JpsArtifactRootElementImpl(JpsArtifactRootElementImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsArtifactRootElementImpl createCopy() {
    return new JpsArtifactRootElementImpl();
  }

  @Override
  public @NotNull JpsArtifactRootElementImpl createElementCopy() {
    return new JpsArtifactRootElementImpl();
  }
}
PK          7V/&  &  T   org/jetbrains/jps/model/artifact/impl/elements/JpsCompositePackagingElementBase.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.elements.JpsCompositePackagingElement;
import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsElementCollectionRole;

import java.util.List;

public abstract class JpsCompositePackagingElementBase<Self extends JpsCompositePackagingElementBase<Self>> extends JpsCompositeElementBase<Self>
  implements JpsCompositePackagingElement {
  private static final JpsElementCollectionRole<JpsPackagingElement> CHILDREN_ROLE = JpsElementCollectionRole.create(JpsElementChildRoleBase.create("child"));

  protected JpsCompositePackagingElementBase() {
    myContainer.setChild(CHILDREN_ROLE);
  }

  protected JpsCompositePackagingElementBase(JpsCompositePackagingElementBase<Self> original) {
    super(original);
  }

  @Override
  public @NotNull List<JpsPackagingElement> getChildren() {
    return myContainer.getChild(CHILDREN_ROLE).getElements();
  }


  @Override
  public <E extends JpsPackagingElement> E addChild(@NotNull E child) {
    return myContainer.getChild(CHILDREN_ROLE).addChild(child);
  }

  @Override
  public void removeChild(@NotNull JpsPackagingElement child) {
    myContainer.getChild(CHILDREN_ROLE).removeChild(child);
  }
}
PK          u}  }  X   org/jetbrains/jps/model/artifact/impl/elements/JpsDirectoryCopyPackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.elements.JpsDirectoryCopyPackagingElement;

class JpsDirectoryCopyPackagingElementImpl extends JpsFileCopyPackagingElementBase<JpsDirectoryCopyPackagingElementImpl>
  implements JpsDirectoryCopyPackagingElement {
  JpsDirectoryCopyPackagingElementImpl(String directoryPath) {
    super(directoryPath);
  }

  @Override
  public @NotNull JpsDirectoryCopyPackagingElementImpl createElementCopy() {
    return new JpsDirectoryCopyPackagingElementImpl(myFilePath);
  }

  @Override
  public String getDirectoryPath() {
    return getFilePath();
  }

  @Override
  public void setDirectoryPath(String path) {
    setFilePath(path);
  }
}
PK          R{Ѧ    T   org/jetbrains/jps/model/artifact/impl/elements/JpsDirectoryPackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.elements.JpsDirectoryPackagingElement;

class JpsDirectoryPackagingElementImpl extends JpsCompositePackagingElementBase<JpsDirectoryPackagingElementImpl> implements JpsDirectoryPackagingElement {
  private String myDirectoryName;

  JpsDirectoryPackagingElementImpl(String directoryName) {
    myDirectoryName = directoryName;
  }

  private JpsDirectoryPackagingElementImpl(JpsDirectoryPackagingElementImpl original) {
    super(original);
    myDirectoryName = original.myDirectoryName;
  }

  @Override
  public @NotNull JpsDirectoryPackagingElementImpl createCopy() {
    return new JpsDirectoryPackagingElementImpl(this);
  }

  @Override
  public @NotNull JpsDirectoryPackagingElementImpl createElementCopy() {
    return new JpsDirectoryPackagingElementImpl(this);
  }

  @Override
  public String getDirectoryName() {
    return myDirectoryName;
  }

  @Override
  public void setDirectoryName(String directoryName) {
    if (!myDirectoryName.equals(directoryName)) {
      myDirectoryName = directoryName;
    }
  }
}
PK          xZH  H  ]   org/jetbrains/jps/model/artifact/impl/elements/JpsExtractedDirectoryPackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.elements.JpsExtractedDirectoryPackagingElement;

import java.util.Objects;

class JpsExtractedDirectoryPackagingElementImpl extends JpsFileCopyPackagingElementBase<JpsExtractedDirectoryPackagingElementImpl>
  implements JpsExtractedDirectoryPackagingElement {
  private String myPathInJar;

  JpsExtractedDirectoryPackagingElementImpl(String filePath, String pathInJar) {
    super(filePath);
    myPathInJar = pathInJar;
  }

  @Override
  public @NotNull JpsExtractedDirectoryPackagingElementImpl createElementCopy() {
    return new JpsExtractedDirectoryPackagingElementImpl(myFilePath, myPathInJar);
  }

  @Override
  public String getPathInJar() {
    return myPathInJar;
  }

  @Override
  public void setPathInJar(String pathInJar) {
    if (!Objects.equals(myPathInJar, pathInJar)) {
      myPathInJar = pathInJar;
    }
  }
}
PK          qJZb  b  S   org/jetbrains/jps/model/artifact/impl/elements/JpsFileCopyPackagingElementBase.java// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
import org.jetbrains.jps.model.ex.JpsElementBase;

import java.util.Objects;

abstract class JpsFileCopyPackagingElementBase<Self extends JpsFileCopyPackagingElementBase<Self>> extends JpsElementBase<Self> implements
                                                                                                                                 JpsPackagingElement {
  protected String myFilePath;

  protected JpsFileCopyPackagingElementBase(String filePath) {
    myFilePath = filePath;
  }

  @Override
  public @NotNull Self createCopy() {
    //noinspection unchecked
    return (Self)createElementCopy();
  }

  public String getFilePath() {
    return myFilePath;
  }

  public void setFilePath(String filePath) {
    if (!Objects.equals(myFilePath, filePath)) {
      myFilePath = filePath;
    }
  }
}
PK          %6    S   org/jetbrains/jps/model/artifact/impl/elements/JpsFileCopyPackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.elements.JpsFileCopyPackagingElement;

import java.util.Objects;

class JpsFileCopyPackagingElementImpl extends JpsFileCopyPackagingElementBase<JpsFileCopyPackagingElementImpl> implements JpsFileCopyPackagingElement {
  private String myRenamedOutputFileName;

  JpsFileCopyPackagingElementImpl(String filePath, String renamedOutputFileName) {
    super(filePath);
    myRenamedOutputFileName = renamedOutputFileName;
  }

  @Override
  public @NotNull JpsFileCopyPackagingElementImpl createElementCopy() {
    return new JpsFileCopyPackagingElementImpl(myFilePath, myRenamedOutputFileName);
  }

  @Override
  public String getRenamedOutputFileName() {
    return myRenamedOutputFileName;
  }

  @Override
  public void setRenamedOutputFileName(String renamedOutputFileName) {
    if (!Objects.equals(myRenamedOutputFileName, renamedOutputFileName)) {
      myRenamedOutputFileName = renamedOutputFileName;
    }
  }
}
PK          z	  	  W   org/jetbrains/jps/model/artifact/impl/elements/JpsLibraryFilesPackagingElementImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.artifact.elements.JpsLibraryFilesPackagingElement;
import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
import org.jetbrains.jps.model.artifact.elements.JpsPackagingElementFactory;
import org.jetbrains.jps.model.artifact.elements.ex.JpsComplexPackagingElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryReference;
import org.jetbrains.jps.model.library.JpsOrderRootType;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

class JpsLibraryFilesPackagingElementImpl extends JpsComplexPackagingElementBase<JpsLibraryFilesPackagingElementImpl> implements JpsLibraryFilesPackagingElement {
  private static final JpsElementChildRole<JpsLibraryReference>
    LIBRARY_REFERENCE_CHILD_ROLE = JpsElementChildRoleBase.create("library reference");

  JpsLibraryFilesPackagingElementImpl(@NotNull JpsLibraryReference reference) {
    myContainer.setChild(LIBRARY_REFERENCE_CHILD_ROLE, reference);
  }

  private JpsLibraryFilesPackagingElementImpl(JpsLibraryFilesPackagingElementImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsLibraryFilesPackagingElementImpl createElementCopy() {
    return new JpsLibraryFilesPackagingElementImpl(this);
  }

  @Override
  public @NotNull JpsLibraryReference getLibraryReference() {
    return myContainer.getChild(LIBRARY_REFERENCE_CHILD_ROLE);
  }

  @Override
  public List<JpsPackagingElement> getSubstitution() {
    JpsLibrary library = getLibraryReference().resolve();
    if (library == null) return Collections.emptyList();
    List<JpsPackagingElement> result = new ArrayList<>();
    for (File file : library.getFiles(JpsOrderRootType.COMPILED)) {
      String path = FileUtil.toSystemIndependentName(file.getAbsolutePath());
      if (file.isDirectory()) {
        result.add(JpsPackagingElementFactory.getInstance().createDirectoryCopy(path));
      }
      else {
        result.add(JpsPackagingElementFactory.getInstance().createFileCopy(path, null));
      }
    }
    return result;
  }
}
PK          PL
    W   org/jetbrains/jps/model/artifact/impl/elements/JpsModuleOutputPackagingElementBase.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.artifact.elements.JpsModuleOutputPackagingElement;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleReference;

public abstract class JpsModuleOutputPackagingElementBase<Self extends JpsModuleOutputPackagingElementBase<Self>> extends JpsCompositeElementBase<Self> implements
                                                                                                                                                        JpsModuleOutputPackagingElement {
  private static final JpsElementChildRole<JpsModuleReference>
    MODULE_REFERENCE_CHILD_ROLE = JpsElementChildRoleBase.create("module reference");

  public JpsModuleOutputPackagingElementBase(JpsModuleReference moduleReference) {
    myContainer.setChild(MODULE_REFERENCE_CHILD_ROLE, moduleReference);
  }

  public JpsModuleOutputPackagingElementBase(JpsModuleOutputPackagingElementBase<Self> original) {
    super(original);
  }

  @Override
  public @NotNull Self createCopy() {
    //noinspection unchecked
    return (Self)createElementCopy();
  }

  @Override
  public @NotNull JpsModuleReference getModuleReference() {
    return myContainer.getChild(MODULE_REFERENCE_CHILD_ROLE);
  }

  @Override
  public @Nullable String getOutputUrl() {
    JpsModule module = getModuleReference().resolve();
    if (module == null) return null;
    return getOutputUrl(module);
  }

  protected abstract @Nullable String getOutputUrl(@NotNull JpsModule module);
}
PK          w̡    R   org/jetbrains/jps/model/artifact/impl/elements/JpsPackagingElementFactoryImpl.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.artifact.impl.elements;

import com.intellij.openapi.util.text.Strings;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.artifact.JpsArtifactReference;
import org.jetbrains.jps.model.artifact.elements.*;
import org.jetbrains.jps.model.library.JpsLibraryReference;

@ApiStatus.Internal
public class JpsPackagingElementFactoryImpl extends JpsPackagingElementFactory {

  @Override
  public @NotNull JpsDirectoryCopyPackagingElement createDirectoryCopy(@NotNull String directoryPath) {
    return new JpsDirectoryCopyPackagingElementImpl(directoryPath);
  }

  @Override
  public JpsPackagingElement createParentDirectories(String relativeOutputPath, JpsPackagingElement element) {
    relativeOutputPath = Strings.trimStart(relativeOutputPath, "/");
    if (relativeOutputPath.isEmpty()) {
      return element;
    }
    int slash = relativeOutputPath.indexOf('/');
    if (slash == -1) slash = relativeOutputPath.length();
    String rootName = relativeOutputPath.substring(0, slash);
    String pathTail = relativeOutputPath.substring(slash);
    final JpsDirectoryPackagingElement root = createDirectory(rootName);
    final JpsCompositePackagingElement last = getOrCreateDirectoryOrArchive(root, pathTail, true);
    last.addChild(element);
    return root;
  }

  @Override
  public JpsCompositePackagingElement getOrCreateDirectory(@NotNull JpsCompositePackagingElement root, @NotNull String path) {
    return getOrCreateDirectoryOrArchive(root, path, true);
  }

  @Override
  public JpsCompositePackagingElement getOrCreateArchive(@NotNull JpsCompositePackagingElement root, @NotNull String path) {
    return getOrCreateDirectoryOrArchive(root, path, false);
  }

  private @NotNull JpsCompositePackagingElement getOrCreateDirectoryOrArchive(@NotNull JpsCompositePackagingElement root,
                                                                              @NotNull @NonNls String path, final boolean directory) {
    path = Strings.trimStart(Strings.trimEnd(path, "/"), "/");
    if (path.isEmpty()) {
      return root;
    }
    int index = path.lastIndexOf('/');
    String lastName = path.substring(index + 1);
    String parentPath = index != -1 ? path.substring(0, index) : "";

    final JpsCompositePackagingElement parent = getOrCreateDirectoryOrArchive(root, parentPath, true);
    final JpsCompositePackagingElement last = directory ? createDirectory(lastName) : createArchive(lastName);
    return parent.addChild(last);
  }

  @Override
  public @NotNull JpsFileCopyPackagingElement createFileCopy(@NotNull String filePath, @Nullable String outputFileName) {
    return new JpsFileCopyPackagingElementImpl(filePath, outputFileName);
  }

  @Override
  public @NotNull JpsExtractedDirectoryPackagingElement createExtractedDirectory(@NotNull String jarPath, @NotNull String pathInJar) {
    return new JpsExtractedDirectoryPackagingElementImpl(jarPath, pathInJar);
  }

  @Override
  public @NotNull JpsDirectoryPackagingElement createDirectory(@NotNull String directoryName) {
    return new JpsDirectoryPackagingElementImpl(directoryName);
  }

  @Override
  public @NotNull JpsArchivePackagingElement createArchive(@NotNull String archiveName) {
    return new JpsArchivePackagingElementImpl(archiveName);
  }

  @Override
  public @NotNull JpsArtifactRootElement createArtifactRoot() {
    return new JpsArtifactRootElementImpl();
  }

  @Override
  public @NotNull JpsLibraryFilesPackagingElement createLibraryElement(@NotNull JpsLibraryReference reference) {
    return new JpsLibraryFilesPackagingElementImpl(reference);
  }

  @Override
  public @NotNull JpsArtifactOutputPackagingElement createArtifactOutput(@NotNull JpsArtifactReference reference) {
    return new JpsArtifactOutputPackagingElementImpl(reference);
  }
}
PK          "%  %  G   org/jetbrains/jps/model/java/impl/compiler/JpsCompilerExcludesImpl.java// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl.compiler;

import com.intellij.openapi.util.io.FileUtilRt;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes;
import org.jetbrains.jps.util.JpsPathUtil;

import java.io.File;
import java.util.LinkedHashSet;
import java.util.Set;

@ApiStatus.Internal
public class JpsCompilerExcludesImpl implements JpsCompilerExcludes {
  private final Set<File> myFiles = new LinkedHashSet<>();
  private final Set<File> myDirectories = new LinkedHashSet<>();
  private final Set<File> myRecursivelyExcludedDirectories = new LinkedHashSet<>();

  @Override
  public void addExcludedFile(String url) {
    addExcludedFile(JpsPathUtil.urlToFile(url));
  }

  @Override
  public void addExcludedDirectory(String url, boolean recursively) {
    addExcludedDirectory(JpsPathUtil.urlToFile(url), recursively);
  }

  protected void addExcludedFile(File file) {
    myFiles.add(file);
  }

  protected void addExcludedDirectory(File dir, boolean recursively) {
    (recursively ? myRecursivelyExcludedDirectories : myDirectories).add(dir);
  }

  @Override
  public boolean isExcluded(File file) {
    if (myFiles.contains(file)) {
      return true;
    }

    if (!myDirectories.isEmpty() || !myRecursivelyExcludedDirectories.isEmpty()) { // optimization
      File parent = FileUtilRt.getParentFile(file);
      if (myDirectories.contains(parent)) {
        return true;
      }

      while (parent != null) {
        if (myRecursivelyExcludedDirectories.contains(parent)) {
          return true;
        }
        parent = FileUtilRt.getParentFile(parent);
      }
    }
    return false;
  }

  @Override
  public Set<File> getExcludedFiles() {
    return myFiles;
  }

  @Override
  public Set<File> getExcludedDirectories() {
    return myDirectories;
  }

  @Override
  public Set<File> getRecursivelyExcludedDirectories() {
    return myRecursivelyExcludedDirectories;
  }
}
PK                P   org/jetbrains/jps/model/java/impl/compiler/JpsJavaCompilerConfigurationImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl.compiler;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsFactoryElementChildRoleBase;
import org.jetbrains.jps.model.java.compiler.*;
import org.jetbrains.jps.model.module.JpsModule;

import java.io.File;
import java.util.*;

@ApiStatus.Internal
public class JpsJavaCompilerConfigurationImpl extends JpsCompositeElementBase<JpsJavaCompilerConfigurationImpl> implements JpsJavaCompilerConfiguration {
  public static final JpsFactoryElementChildRoleBase<JpsJavaCompilerConfiguration> ROLE = JpsFactoryElementChildRoleBase.create("compiler configuration", () -> new JpsJavaCompilerConfigurationImpl());
  private boolean myAddNotNullAssertions = true;
  private List<String> myNotNullAnnotations = Collections.singletonList(NotNull.class.getName());
  private boolean myClearOutputDirectoryOnRebuild = true;
  private final JpsCompilerExcludes myCompilerExcludes = new JpsCompilerExcludesImpl();
  private final JpsCompilerExcludes myValidationExcludes = new JpsCompilerExcludesImpl();
  private final List<String> myResourcePatterns = new ArrayList<>();
  private final List<ProcessorConfigProfile> myAnnotationProcessingProfiles = new ArrayList<>();
  private final ProcessorConfigProfileImpl myDefaultAnnotationProcessingProfile = new ProcessorConfigProfileImpl("Default");
  private boolean myUseReleaseOption = true;
  private String myProjectByteCodeTargetLevel;
  private final Map<String, String> myModulesByteCodeTargetLevels = new HashMap<>();
  private final Map<String, JpsJavaCompilerOptions> myCompilerOptions = new HashMap<>();
  private String myJavaCompilerId = "Javac";
  private Map<JpsModule, ProcessorConfigProfile> myAnnotationProcessingProfileMap;
  private ResourcePatterns myCompiledPatterns;
  private JpsValidationConfiguration myValidationConfiguration = new JpsValidationConfigurationImpl(false, Collections.emptySet());

  public JpsJavaCompilerConfigurationImpl() {
  }

  private JpsJavaCompilerConfigurationImpl(JpsJavaCompilerConfigurationImpl original) {
    super(original);
  }

  @Override
  public @NotNull JpsJavaCompilerConfigurationImpl createCopy() {
    return new JpsJavaCompilerConfigurationImpl(this);
  }

  @Override
  public boolean isAddNotNullAssertions() {
    return myAddNotNullAssertions;
  }

  @Override
  public List<String> getNotNullAnnotations() {
    return myNotNullAnnotations;
  }

  @Override
  public boolean isClearOutputDirectoryOnRebuild() {
    return myClearOutputDirectoryOnRebuild;
  }

  @Override
  public void setAddNotNullAssertions(boolean addNotNullAssertions) {
    myAddNotNullAssertions = addNotNullAssertions;
  }

  @Override
  public void setNotNullAnnotations(List<String> notNullAnnotations) {
    myNotNullAnnotations = Collections.unmodifiableList(notNullAnnotations);
  }

  @Override
  public void setClearOutputDirectoryOnRebuild(boolean clearOutputDirectoryOnRebuild) {
    myClearOutputDirectoryOnRebuild = clearOutputDirectoryOnRebuild;
  }

  @Override
  public @NotNull JpsCompilerExcludes getCompilerExcludes() {
    return myCompilerExcludes;
  }

  @Override
  public @NotNull JpsCompilerExcludes getValidationExcludes() {
    return myValidationExcludes;
  }

  @Override
  public @NotNull JpsValidationConfiguration getValidationConfiguration() {
    return myValidationConfiguration;
  }

  @Override
  public void setValidationConfiguration(boolean validateOnBuild, @NotNull Set<String> disabledValidators) {
    myValidationConfiguration = new JpsValidationConfigurationImpl(validateOnBuild, disabledValidators);
  }

  @Override
  public @NotNull ProcessorConfigProfile getDefaultAnnotationProcessingProfile() {
    return myDefaultAnnotationProcessingProfile;
  }

  @Override
  public @NotNull Collection<ProcessorConfigProfile> getAnnotationProcessingProfiles() {
    return myAnnotationProcessingProfiles;
  }

  @Override
  public void addResourcePattern(String pattern) {
    myResourcePatterns.add(pattern);
  }

  @Override
  public List<String> getResourcePatterns() {
    return myResourcePatterns;
  }

  @Override
  public boolean isResourceFile(@NotNull File file, @NotNull File srcRoot) {
    ResourcePatterns patterns = myCompiledPatterns;
    if (patterns == null) {
      myCompiledPatterns = patterns = new ResourcePatterns(this);
    }
    return patterns.isResourceFile(file, srcRoot);
  }

  @Override
  public @Nullable String getByteCodeTargetLevel(String moduleName) {
    String level = myModulesByteCodeTargetLevels.get(moduleName);
    if (level != null) {
      return level.isEmpty() ? null : level;
    }
    return myProjectByteCodeTargetLevel;
  }

  @Override
  public void setModuleByteCodeTargetLevel(String moduleName, String level) {
    myModulesByteCodeTargetLevels.put(moduleName, level);
  }

  @Override
  public @NotNull String getJavaCompilerId() {
    return myJavaCompilerId;
  }

  @Override
  public void setJavaCompilerId(@NotNull String compiler) {
    myJavaCompilerId = compiler;
  }

  @Override
  public @NotNull JpsJavaCompilerOptions getCompilerOptions(@NotNull String compilerId) {
    JpsJavaCompilerOptions options = myCompilerOptions.get(compilerId);
    if (options == null) {
      options = new JpsJavaCompilerOptions();
      myCompilerOptions.put(compilerId, options);
    }
    return options;
  }

  @Override
  public void setCompilerOptions(@NotNull String compilerId, @NotNull JpsJavaCompilerOptions options) {
    myCompilerOptions.put(compilerId, options);
  }

  @Override
  public @NotNull JpsJavaCompilerOptions getCurrentCompilerOptions() {
    return getCompilerOptions(getJavaCompilerId());
  }

  @Override
  public void setProjectByteCodeTargetLevel(String level) {
    myProjectByteCodeTargetLevel = level;
  }

  @Override
  public boolean useReleaseOption() {
    return myUseReleaseOption;
  }

  @Override
  public void setUseReleaseOption(boolean useReleaseOption) {
    myUseReleaseOption = useReleaseOption;
  }

  @Override
  public ProcessorConfigProfile addAnnotationProcessingProfile() {
    ProcessorConfigProfileImpl profile = new ProcessorConfigProfileImpl("");
    myAnnotationProcessingProfiles.add(profile);
    return profile;
  }

  @Override
  public @NotNull ProcessorConfigProfile getAnnotationProcessingProfile(JpsModule module) {
    Map<JpsModule, ProcessorConfigProfile> map = myAnnotationProcessingProfileMap;
    if (map == null) {
      map = new HashMap<>();
      final Map<String, JpsModule> namesMap = new HashMap<>();
      for (JpsModule m : module.getProject().getModules()) {
        namesMap.put(m.getName(), m);
      }
      if (!namesMap.isEmpty()) {
        for (ProcessorConfigProfile profile : getAnnotationProcessingProfiles()) {
          for (String name : profile.getModuleNames()) {
            final JpsModule mod = namesMap.get(name);
            if (mod != null) {
              map.put(mod, profile);
            }
          }
        }
      }
      myAnnotationProcessingProfileMap = map;
    }
    final ProcessorConfigProfile profile = map.get(module);
    return profile != null? profile : getDefaultAnnotationProcessingProfile();
  }
}
PK          a  a  N   org/jetbrains/jps/model/java/impl/compiler/JpsValidationConfigurationImpl.java// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.java.impl.compiler;

import org.jetbrains.jps.model.java.compiler.JpsValidationConfiguration;

import java.util.Set;

class JpsValidationConfigurationImpl implements JpsValidationConfiguration {
  private final boolean myValidateOnBuild;
  private final Set<String> myDisabledValidators;

  JpsValidationConfigurationImpl(boolean validateOnBuild, Set<String> disabledValidators) {
    myValidateOnBuild = validateOnBuild;
    myDisabledValidators = disabledValidators;
  }

  @Override
  public boolean isValidateOnBuild() {
    return myValidateOnBuild;
  }

  @Override
  public boolean isValidatorEnabled(String validatorId) {
    return !myDisabledValidators.contains(validatorId);
  }
}
PK           3$  J   org/jetbrains/jps/model/java/impl/compiler/ProcessorConfigProfileImpl.javaY[S6~W$/>A	Ѕt yxE\I&$ْlM_`-ӑ3>	SQ&d(BBİt).d_$uGgbA &+HDBb?>4Zp]Dpy-OeF),S.:í-|B5x$*RӔL^ru16ɢ9#҆"%3,
TRrLQb18I`")[tdȚ$G߷ RA#E`t	ׇ9D	n')jR zM#uJd5Ry YU~qƈahU놨?
%Z$r$|&|>] T=a=Jk+!bb*xI)JС*k4C<=F,#R7_$!WbgMwFY`8뫳/ۋ˯g_/O?wyK>i77*Tk°7-ǢSXל:VW	{rt,Ƶ̢f3APf1+VF|4BQ	AZa޻&Ese"7Q_oEAa3(HbfR4dwE;̍Λ\EPXRl%vk%<CO#Mpt\X2-P4ؕ&2~'^Q^!g#1c,Z	WQ9uCw*͊#Kl-g/ׄچBMСPѹ%wX6Fmz^yva[!Х&@ؖ	#EC/\rq3խfr*{&/6eϘDe"159bG^v[V)UT]'fHdMjӝk9#n;pU#WMsX>04C=fIV^oRw>m櫛nGKӀ^yZ.-CgNS­yK.4|<pd8G߅Vj }>ezT";h_$R?\
{nux~)CZq3fS.!9}c\TӹtE]D?If1`Vɳ n kH&`4MQ$y~WyST/qn+9?74LmmbU:o,p',Y.>Q@Pnc^v^Ǚ~S|dC;kAVO	VcZuX5lri;~N6eZÐj~^NGGz8l?;\o1~ʧx47۽.eximniC5ՑeŦ~U#jn%k͐lkcx5;8K0Z.m?;fM<ߜ:&'U}hŲ튌TNN&EԶz.Ws)tG}Ƥ8*Di.w3WzQ1}%49Cv/U=wɽA
eձR|,J|
`d:`|B,x"W1{>xb^;Oy/ԓg]ŋ}XPPK          f)%  %  @   org/jetbrains/jps/model/java/impl/compiler/ResourcePatterns.java// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl.compiler;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfoRt;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.Strings;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

/**
 * @author Eugene Zhuravlev
 */
@ApiStatus.Internal
public final class ResourcePatterns {
  private static final Logger LOG = Logger.getInstance(ResourcePatterns.class);

  private final List<CompiledPattern> myCompiledPatterns = new ArrayList<>();
  private final List<CompiledPattern> myNegatedCompiledPatterns = new ArrayList<>();

  public ResourcePatterns(final JpsJavaCompilerConfiguration configuration) {
    final List<String> patterns = configuration.getResourcePatterns();
    for (String pattern : patterns) {
      final CompiledPattern regexp = convertToRegexp(pattern);
      if (isPatternNegated(pattern)) {
        myNegatedCompiledPatterns.add(regexp);
      }
      else {
        myCompiledPatterns.add(regexp);
      }
    }
  }

  public boolean isResourceFile(File file, final @NotNull File srcRoot) {
    final String name = file.getName();
    final String relativePathToParent;
    final String parentPath = file.getParent();
    if (parentPath != null) {
      relativePathToParent = "/" + FileUtilRt.getRelativePath(FileUtilRt.toSystemIndependentName(srcRoot.getAbsolutePath()), FileUtilRt.toSystemIndependentName(parentPath), '/', SystemInfoRt.isFileSystemCaseSensitive);
    }
    else {
      relativePathToParent = null;
    }
    for (CompiledPattern pair : myCompiledPatterns) {
      if (matches(name, relativePathToParent, srcRoot, pair)) {
        return true;
      }
    }

    if (myNegatedCompiledPatterns.isEmpty()) {
      return false;
    }

    //noinspection ForLoopReplaceableByForEach
    for (int i = 0; i < myNegatedCompiledPatterns.size(); i++) {
      if (matches(name, relativePathToParent, srcRoot, myNegatedCompiledPatterns.get(i))) {
        return false;
      }
    }
    return true;
  }

  private static boolean matches(String name, String parentRelativePath, @NotNull File srcRoot, CompiledPattern pattern) {
    if (!matches(name, pattern.fileName)) {
      return false;
    }
    if (parentRelativePath != null) {
      if (pattern.dir != null && !matches(parentRelativePath, pattern.dir)) {
        return false;
      }
      if (pattern.srcRoot != null && !matches(srcRoot.getName(), pattern.srcRoot)) {
        return false;
      }
    }
    return true;
  }

  private static boolean matches(String s, Pattern p) {
    try {
      return p.matcher(s).matches();
    }
    catch (Exception e) {
      LOG.error("Exception matching file name \"" + s + "\" against the pattern \"" + p + "\"", e);
      return false;
    }
  }

  private static CompiledPattern convertToRegexp(String wildcardPattern) {
    if (isPatternNegated(wildcardPattern)) {
      wildcardPattern = wildcardPattern.substring(1);
    }

    wildcardPattern = FileUtilRt.toSystemIndependentName(wildcardPattern);

    String srcRoot = null;
    int colon = wildcardPattern.indexOf(":");
    if (colon > 0) {
      srcRoot = wildcardPattern.substring(0, colon);
      wildcardPattern = wildcardPattern.substring(colon + 1);
    }
    
    String dirPattern = null;
    int slash = wildcardPattern.lastIndexOf('/');
    if (slash >= 0) {
      dirPattern = wildcardPattern.substring(0, slash + 1);
      wildcardPattern = wildcardPattern.substring(slash + 1);
      dirPattern = optimizeDirPattern(dirPattern);
    }

    wildcardPattern = normalizeWildcards(wildcardPattern);
    wildcardPattern = optimize(wildcardPattern);

    final Pattern dirCompiled = dirPattern == null ? null : compilePattern(dirPattern);
    final Pattern srcCompiled = srcRoot == null ? null : compilePattern(optimize(normalizeWildcards(srcRoot)));
    return new CompiledPattern(compilePattern(wildcardPattern), dirCompiled, srcCompiled);
  }

  public static String optimizeDirPattern(String dirPattern) {
    if (!dirPattern.startsWith("/")) {
      dirPattern = "/" + dirPattern;
    }
    //now dirPattern starts and ends with '/'

    dirPattern = normalizeWildcards(dirPattern);

    dirPattern = StringUtil.replace(dirPattern, "/.*.*/", "(/.*)?/", false);
    dirPattern = Strings.trimEnd(dirPattern, "/");

    dirPattern = optimize(dirPattern);
    return dirPattern;
  }

  private static String optimize(String wildcardPattern) {
    return wildcardPattern.replaceAll("(?:\\.\\*)+", ".*");
  }

  public static String normalizeWildcards(String wildcardPattern) {
    wildcardPattern = StringUtil.replace(wildcardPattern, "\\!", "!");
    wildcardPattern = StringUtil.replace(wildcardPattern, ".", "\\.");
    wildcardPattern = StringUtil.replace(wildcardPattern, "*?", ".+");
    wildcardPattern = StringUtil.replace(wildcardPattern, "?*", ".+");
    wildcardPattern = StringUtil.replace(wildcardPattern, "*", ".*");
    wildcardPattern = StringUtil.replace(wildcardPattern, "?", ".");
    return wildcardPattern;
  }

  private static boolean isPatternNegated(String wildcardPattern) {
    return wildcardPattern.length() > 1 && wildcardPattern.charAt(0) == '!';
  }

  private static Pattern compilePattern(@NonNls String s) {
    return Pattern.compile(s, SystemInfoRt.isFileSystemCaseSensitive ? 0 : Pattern.CASE_INSENSITIVE);
  }
  
  private static class CompiledPattern {
    final @NotNull Pattern fileName;
    final @Nullable Pattern dir;
    final @Nullable Pattern srcRoot;

    CompiledPattern(@NotNull Pattern fileName, @Nullable Pattern dir, @Nullable Pattern srcRoot) {
      this.fileName = fileName;
      this.dir = dir;
      this.srcRoot = srcRoot;
    }
  }
  
}
PK          e4R    d   org/jetbrains/jps/model/java/impl/runConfiguration/JpsApplicationRunConfigurationPropertiesImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.java.impl.runConfiguration;

import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.ex.JpsElementBase;
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationProperties;
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationState;

public class JpsApplicationRunConfigurationPropertiesImpl extends JpsElementBase<JpsApplicationRunConfigurationPropertiesImpl> implements JpsApplicationRunConfigurationProperties {
  private final JpsApplicationRunConfigurationState myState;

  public JpsApplicationRunConfigurationPropertiesImpl(JpsApplicationRunConfigurationState state) {
    myState = state;
  }

  @Override
  public @NotNull JpsApplicationRunConfigurationPropertiesImpl createCopy() {
    return new JpsApplicationRunConfigurationPropertiesImpl(XmlSerializerUtil.createCopy(myState));
  }

  @Override
  public String getMainClass() {
    return myState.MAIN_CLASS_NAME;
  }

  @Override
  public void setMainClass(String value) {
    myState.MAIN_CLASS_NAME = value;
  }
}
PK                D   org/jetbrains/jps/model/java/impl/runConfiguration/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.model.java.impl.runConfiguration;

import org.jetbrains.annotations.ApiStatus;PK          `uM	  M	  8   org/jetbrains/jps/model/library/impl/sdk/JpsSdkImpl.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model.library.impl.sdk;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.library.impl.JpsLibraryImpl;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.library.sdk.JpsSdkReference;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;

import java.util.Objects;

public class JpsSdkImpl<P extends JpsElement> extends JpsCompositeElementBase<JpsSdkImpl<P>> implements JpsSdk<P> {
  private final JpsSdkType<P> mySdkType;
  private String myHomePath;
  private String myVersionString;

  public JpsSdkImpl(String homePath, String versionString, JpsSdkType<P> type, P properties) {
    myHomePath = homePath;
    myVersionString = versionString;
    mySdkType = type;
    myContainer.setChild(type.getSdkPropertiesRole(), properties);
  }

  private JpsSdkImpl(JpsSdkImpl<P> original) {
    super(original);
    mySdkType = original.mySdkType;
    myHomePath = original.myHomePath;
    myVersionString = original.myVersionString;
  }

  @Override
  public @NotNull JpsSdkImpl<P> createCopy() {
    return new JpsSdkImpl<>(this);
  }

  @Override
  public P getSdkProperties() {
    return myContainer.getChild(mySdkType.getSdkPropertiesRole());
  }

  @Override
  public JpsSdkReference<P> createReference() {
    return JpsElementFactory.getInstance().createSdkReference(getParent().getName(), mySdkType);
  }

  @Override
  public JpsSdkType<P> getSdkType() {
    return mySdkType;
  }

  @Override
  public @NotNull JpsLibraryImpl<JpsSdk<P>> getParent() {
    //noinspection unchecked
    return (JpsLibraryImpl<JpsSdk<P>>)super.getParent();
  }

  @Override
  public String getHomePath() {
    return myHomePath;
  }

  @Override
  public void setHomePath(String homePath) {
    if (!Objects.equals(myHomePath, homePath)) {
      myHomePath = homePath;
    }
  }

  @Override
  public String getVersionString() {
    return myVersionString;
  }

  @Override
  public void setVersionString(String versionString) {
    if (!Objects.equals(myVersionString, versionString)) {
      myVersionString = versionString;
    }
  }
}
PK          ^x      :   org/jetbrains/jps/model/library/impl/sdk/package-info.java// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.model.library.impl.sdk;

import org.jetbrains.annotations.ApiStatus;PK          k[4      d   META-INF/services/com.intellij.platform.jps.model.resolver.JpsDependencyResolverConfigurationService# Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
com.intellij.platform.jps.model.impl.resolver.JpsDependencyResolverConfigurationServiceImplPK          2   2   ;   META-INF/services/org.jetbrains.jps.model.JpsElementFactoryorg.jetbrains.jps.model.impl.JpsElementFactoryImplPK          )H@   @   I   META-INF/services/org.jetbrains.jps.model.JpsEncodingConfigurationServiceorg.jetbrains.jps.model.impl.JpsEncodingConfigurationServiceImplPK          =;9<   <   E   META-INF/services/org.jetbrains.jps.model.artifact.JpsArtifactServiceorg.jetbrains.jps.model.artifact.impl.JpsArtifactServiceImplPK          p'_M   M   V   META-INF/services/org.jetbrains.jps.model.artifact.elements.JpsPackagingElementFactoryorg.jetbrains.jps.model.artifact.impl.elements.JpsPackagingElementFactoryImplPK          !44   4   @   META-INF/services/org.jetbrains.jps.model.ex.JpsExElementFactoryorg.jetbrains.jps.model.impl.JpsExElementFactoryImplPK          t&A   A   J   META-INF/services/org.jetbrains.jps.model.fileTypes.FileNameMatcherFactoryorg.jetbrains.jps.model.fileTypes.impl.FileNameMatcherFactoryImplPK          }    R   META-INF/services/org.jetbrains.jps.model.jarRepository.JpsRemoteRepositoryService#
# Copyright 2000-2017 JetBrains s.r.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
org.jetbrains.jps.model.jarRepository.impl.JpsRemoteRepositoryServiceImplPK          8   8   A   META-INF/services/org.jetbrains.jps.model.java.JdkVersionDetectororg.jetbrains.jps.model.java.impl.JdkVersionDetectorImplPK          Yc=   =   F   META-INF/services/org.jetbrains.jps.model.java.JpsJavaExtensionServiceorg.jetbrains.jps.model.java.impl.JpsJavaExtensionServiceImplPK          4   4   =   META-INF/services/org.jetbrains.jps.service.JpsServiceManagerorg.jetbrains.jps.service.impl.JpsServiceManagerImplPK          clG3   3   <   META-INF/services/org.jetbrains.jps.service.SharedThreadPoolorg.jetbrains.jps.service.impl.SharedThreadPoolImplPK            V
    ;                 com/intellij/openapi/fileTypes/WildcardFileNameMatcher.javaPK            :l  l  .               org/jetbrains/jps/plugin/JpsPluginManager.javaPK           ؀Oن  ;:  ;               com/intellij/openapi/fileTypes/impl/FileTypeAssocTable.javaPK            sg	  g	  :               com/intellij/openapi/fileTypes/impl/IgnoredPatternSet.javaPK            [zZ  Z  7             ['  org/jetbrains/jps/model/ex/JpsElementContainerImpl.javaPK            1    5             
6  org/jetbrains/jps/model/impl/JpsDummyElementImpl.javaPK            *Y٘M  M  :             `8  org/jetbrains/jps/model/impl/JpsElementCollectionImpl.javaPK            r    7             D  org/jetbrains/jps/model/impl/JpsElementFactoryImpl.javaPK            N:~	  ~	  E             X  org/jetbrains/jps/model/impl/JpsEncodingConfigurationServiceImpl.javaPK            0x    E             b  org/jetbrains/jps/model/impl/JpsEncodingProjectConfigurationImpl.javaPK            L[  [  9             q  org/jetbrains/jps/model/impl/JpsExElementFactoryImpl.javaPK            _6    7             x  org/jetbrains/jps/model/impl/JpsExcludePatternImpl.javaPK            oΠq    ?             |  org/jetbrains/jps/model/impl/JpsFileTypesConfigurationImpl.javaPK            M  M  /             #  org/jetbrains/jps/model/impl/JpsGlobalBase.javaPK            "cZ  Z  ;               org/jetbrains/jps/model/impl/JpsGlobalElementReference.javaPK            WCB	  	  /             p  org/jetbrains/jps/model/impl/JpsGlobalImpl.javaPK            0SȄ    .             ~  org/jetbrains/jps/model/impl/JpsModelImpl.javaPK            0j    ?             m  org/jetbrains/jps/model/impl/JpsNamedElementCollectionImpl.javaPK            ;'  '  >               org/jetbrains/jps/model/impl/JpsNamedElementReferenceBase.javaPK            gl
  l
  >               org/jetbrains/jps/model/impl/JpsNamedElementReferenceImpl.javaPK            J
    0             ˹  org/jetbrains/jps/model/impl/JpsProjectBase.javaPK            /c  c  <               org/jetbrains/jps/model/impl/JpsProjectElementReference.javaPK                0               org/jetbrains/jps/model/impl/JpsProjectImpl.javaPK            awX  X  4             "  org/jetbrains/jps/model/impl/JpsRootElementBase.javaPK            p    6               org/jetbrains/jps/model/impl/JpsSimpleElementImpl.javaPK            Go>z    0               org/jetbrains/jps/model/impl/JpsUrlListImpl.javaPK            Q    0               org/jetbrains/jps/model/impl/JpsUrlListRole.javaPK            K{  {  9               org/jetbrains/jps/service/impl/JpsServiceManagerImpl.javaPK            O    8               org/jetbrains/jps/service/impl/SharedThreadPoolImpl.javaPK            j|      0              org/jetbrains/jps/service/impl/package-info.javaPK            m    :             
 org/jetbrains/jps/model/artifact/impl/JpsArtifactImpl.javaPK            ]*    C             , org/jetbrains/jps/model/artifact/impl/JpsArtifactReferenceImpl.javaPK            s<    :              org/jetbrains/jps/model/artifact/impl/JpsArtifactRole.javaPK            
Ѣ    A              org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl.javaPK            v      7             ' org/jetbrains/jps/model/artifact/impl/package-info.javaPK            lY`{  {  F             ( org/jetbrains/jps/model/fileTypes/impl/FileNameMatcherFactoryImpl.javaPK            ĠN      8             - org/jetbrains/jps/model/fileTypes/impl/package-info.javaPK            So    J             / org/jetbrains/jps/model/impl/runConfiguration/JpsRunConfigurationImpl.javaPK                  ?             N5 org/jetbrains/jps/model/impl/runConfiguration/package-info.javaPK            i-  -  V             6 org/jetbrains/jps/model/jarRepository/impl/JpsRemoteRepositoriesConfigurationImpl.javaPK            q8    N             <? org/jetbrains/jps/model/jarRepository/impl/JpsRemoteRepositoryServiceImpl.javaPK            5h      <             D org/jetbrains/jps/model/jarRepository/impl/package-info.javaPK            M    K             E org/jetbrains/jps/model/java/impl/ExplodedDirectoryModuleExtensionImpl.javaPK            +  +  >             N org/jetbrains/jps/model/java/impl/JavaModuleExtensionRole.javaPK            W    :             lR org/jetbrains/jps/model/java/impl/JavaModuleIndexImpl.javaPK            ]0    :             a[ org/jetbrains/jps/model/java/impl/JavaModuleIndexRole.javaPK                ?             b_ org/jetbrains/jps/model/java/impl/JavaProjectExtensionRole.javaPK            #    2             Wd org/jetbrains/jps/model/java/impl/JavaSdkUtil.javaPK           - 	  ?$  =             Gs org/jetbrains/jps/model/java/impl/JdkVersionDetectorImpl.javaPK            jSe    :             }} org/jetbrains/jps/model/java/impl/JpsJavaAwareProject.javaPK            \}Q	  Q	  L              org/jetbrains/jps/model/java/impl/JpsJavaDependenciesEnumerationHandler.javaPK            G    H             > org/jetbrains/jps/model/java/impl/JpsJavaDependenciesEnumeratorImpl.javaPK            >]    M              org/jetbrains/jps/model/java/impl/JpsJavaDependenciesRootsEnumeratorImpl.javaPK            ً    E              org/jetbrains/jps/model/java/impl/JpsJavaDependencyExtensionImpl.javaPK            o|Q    E             ߹ org/jetbrains/jps/model/java/impl/JpsJavaDependencyExtensionRole.javaPK           *]I{v  +  B             I org/jetbrains/jps/model/java/impl/JpsJavaExtensionServiceImpl.javaPK            Py    A              org/jetbrains/jps/model/java/impl/JpsJavaModuleExtensionImpl.javaPK            Q    B             a org/jetbrains/jps/model/java/impl/JpsJavaProjectExtensionImpl.javaPK            h5  5  T              org/jetbrains/jps/model/java/impl/JpsProductionModuleOutputPackagingElementImpl.javaPK            Zug  g  T             0 org/jetbrains/jps/model/java/impl/JpsProductionModuleSourcePackagingElementImpl.javaPK            g1    N             	 org/jetbrains/jps/model/java/impl/JpsTestModuleOutputPackagingElementImpl.javaPK            (MDc
  c
  E             y org/jetbrains/jps/model/java/impl/JpsWrappedJavaSdkReferenceImpl.javaPK            Ag
  
  B             ? org/jetbrains/jps/model/library/impl/JpsLibraryCollectionImpl.javaPK            8sY_  _  8               org/jetbrains/jps/model/library/impl/JpsLibraryImpl.javaPK            3    A             \ org/jetbrains/jps/model/library/impl/JpsLibraryReferenceImpl.javaPK            z    8             q org/jetbrains/jps/model/library/impl/JpsLibraryRole.javaPK            ?    <              org/jetbrains/jps/model/library/impl/JpsLibraryRootImpl.javaPK            %I"^    B             # org/jetbrains/jps/model/library/impl/JpsLibraryRootProcessing.javaPK            ?C$    <             / org/jetbrains/jps/model/library/impl/JpsLibraryRootRole.javaPK            >C    =             	3 org/jetbrains/jps/model/library/impl/JpsSdkReferenceImpl.javaPK                  6              ; org/jetbrains/jps/model/library/impl/package-info.javaPK            0Kd  d  F             ;< org/jetbrains/jps/model/module/impl/JpsDependenciesEnumeratorBase.javaPK            1W  W  @             T org/jetbrains/jps/model/module/impl/JpsDependenciesListImpl.javaPK            8n~  ~  K             a org/jetbrains/jps/model/module/impl/JpsDependenciesRootsEnumeratorBase.javaPK            ;    A             v org/jetbrains/jps/model/module/impl/JpsDependencyElementBase.javaPK            e    A             } org/jetbrains/jps/model/module/impl/JpsLibraryDependencyImpl.javaPK            $(G    @             - org/jetbrains/jps/model/module/impl/JpsModuleDependencyImpl.javaPK           \     6             ( org/jetbrains/jps/model/module/impl/JpsModuleImpl.javaPK                ?             F org/jetbrains/jps/model/module/impl/JpsModuleReferenceImpl.javaPK            ~    6              org/jetbrains/jps/model/module/impl/JpsModuleRole.javaPK                F              org/jetbrains/jps/model/module/impl/JpsModuleSourceDependencyImpl.javaPK            LЕ    @             D org/jetbrains/jps/model/module/impl/JpsModuleSourceRootImpl.javaPK                @              org/jetbrains/jps/model/module/impl/JpsModuleSourceRootRole.javaPK            ^    =             ӱ org/jetbrains/jps/model/module/impl/JpsSdkDependencyImpl.javaPK            A    <              org/jetbrains/jps/model/module/impl/JpsSdkReferenceRole.javaPK            _@
  @
  B              org/jetbrains/jps/model/module/impl/JpsSdkReferencesTableImpl.javaPK                D             _ org/jetbrains/jps/model/module/impl/JpsTestModulePropertiesImpl.javaPK            ^      5              org/jetbrains/jps/model/module/impl/package-info.javaPK            $N    Y              com/intellij/platform/jps/model/impl/resolver/JpsDependencyResolverConfigurationImpl.javaPK            &    `              com/intellij/platform/jps/model/impl/resolver/JpsDependencyResolverConfigurationServiceImpl.javaPK            w      ?             z com/intellij/platform/jps/model/impl/resolver/package-info.javaPK                R              org/jetbrains/jps/model/artifact/impl/elements/JpsArchivePackagingElementImpl.javaPK            u/    Y              org/jetbrains/jps/model/artifact/impl/elements/JpsArtifactOutputPackagingElementImpl.javaPK            C 8  8  N             u org/jetbrains/jps/model/artifact/impl/elements/JpsArtifactRootElementImpl.javaPK            7V/&  &  T              org/jetbrains/jps/model/artifact/impl/elements/JpsCompositePackagingElementBase.javaPK            u}  }  X              org/jetbrains/jps/model/artifact/impl/elements/JpsDirectoryCopyPackagingElementImpl.javaPK            R{Ѧ    T              org/jetbrains/jps/model/artifact/impl/elements/JpsDirectoryPackagingElementImpl.javaPK            xZH  H  ]              org/jetbrains/jps/model/artifact/impl/elements/JpsExtractedDirectoryPackagingElementImpl.javaPK            qJZb  b  S              org/jetbrains/jps/model/artifact/impl/elements/JpsFileCopyPackagingElementBase.javaPK            %6    S              org/jetbrains/jps/model/artifact/impl/elements/JpsFileCopyPackagingElementImpl.javaPK            z	  	  W              org/jetbrains/jps/model/artifact/impl/elements/JpsLibraryFilesPackagingElementImpl.javaPK            PL
    W              org/jetbrains/jps/model/artifact/impl/elements/JpsModuleOutputPackagingElementBase.javaPK            w̡    R             # org/jetbrains/jps/model/artifact/impl/elements/JpsPackagingElementFactoryImpl.javaPK            "%  %  G             K4 org/jetbrains/jps/model/java/impl/compiler/JpsCompilerExcludesImpl.javaPK                  P             < org/jetbrains/jps/model/java/impl/compiler/JpsJavaCompilerConfigurationImpl.javaPK            a  a  N             CZ org/jetbrains/jps/model/java/impl/compiler/JpsValidationConfigurationImpl.javaPK             3$  J             ^ org/jetbrains/jps/model/java/impl/compiler/ProcessorConfigProfileImpl.javaPK            f)%  %  @             e org/jetbrains/jps/model/java/impl/compiler/ResourcePatterns.javaPK            e4R    d             } org/jetbrains/jps/model/java/impl/runConfiguration/JpsApplicationRunConfigurationPropertiesImpl.javaPK                  D             	 org/jetbrains/jps/model/java/impl/runConfiguration/package-info.javaPK            `uM	  M	  8             ` org/jetbrains/jps/model/library/impl/sdk/JpsSdkImpl.javaPK            ^x      :              org/jetbrains/jps/model/library/impl/sdk/package-info.javaPK            k[4      d             F META-INF/services/com.intellij.platform.jps.model.resolver.JpsDependencyResolverConfigurationServicePK            2   2   ;              META-INF/services/org.jetbrains.jps.model.JpsElementFactoryPK            )H@   @   I             & META-INF/services/org.jetbrains.jps.model.JpsEncodingConfigurationServicePK            =;9<   <   E             ͑ META-INF/services/org.jetbrains.jps.model.artifact.JpsArtifactServicePK            p'_M   M   V             l META-INF/services/org.jetbrains.jps.model.artifact.elements.JpsPackagingElementFactoryPK            !44   4   @             - META-INF/services/org.jetbrains.jps.model.ex.JpsExElementFactoryPK            t&A   A   J              META-INF/services/org.jetbrains.jps.model.fileTypes.FileNameMatcherFactoryPK            }    R             h META-INF/services/org.jetbrains.jps.model.jarRepository.JpsRemoteRepositoryServicePK            8   8   A             j META-INF/services/org.jetbrains.jps.model.java.JdkVersionDetectorPK            Yc=   =   F              META-INF/services/org.jetbrains.jps.model.java.JpsJavaExtensionServicePK            4   4   =              META-INF/services/org.jetbrains.jps.service.JpsServiceManagerPK            clG3   3   <             1 META-INF/services/org.jetbrains.jps.service.SharedThreadPoolPK    | | _6     