Class SourceSetHelper

java.lang.Object
net.fabricmc.loom.util.gradle.SourceSetHelper

public final class SourceSetHelper extends Object
  • Field Details

    • IDEA_OUTPUT_XPATH

      @VisibleForTesting @Language("xpath") public static final String IDEA_OUTPUT_XPATH
      See Also:
  • Method Details

    • getSourceSets

      public static org.gradle.api.tasks.SourceSetContainer getSourceSets(org.gradle.api.Project project)
    • isSourceSetOfProject

      public static boolean isSourceSetOfProject(org.gradle.api.tasks.SourceSet sourceSet, org.gradle.api.Project project)
      Returns true when the provided project contains the SourceSet.
    • getSourceSetByName

      public static org.gradle.api.tasks.SourceSet getSourceSetByName(String name, org.gradle.api.Project project)
    • getMainSourceSet

      public static org.gradle.api.tasks.SourceSet getMainSourceSet(org.gradle.api.Project project)
    • isMainSourceSet

      public static boolean isMainSourceSet(org.gradle.api.tasks.SourceSet sourceSet)
    • createSourceSet

      public static org.gradle.api.tasks.SourceSet createSourceSet(String name, org.gradle.api.Project project)
    • getSourceSetProject

      public static org.gradle.api.Project getSourceSetProject(org.gradle.api.tasks.SourceSet sourceSet)
      Attempts to compute the owning project for the SourceSet

      A bit of a hack, would be nice for this to be added to the Gradle API.

    • getClasspath

      public static List<File> getClasspath(SourceSetReference reference, boolean forExport)
      Parameters:
      forExport - set to true when this classpath is going to be exported for another project to consume.
    • isIdeDrivenBuild

      @VisibleForTesting public static boolean isIdeDrivenBuild()
      判断当前构建是否由 IDE 驱动(IntelliJ 同步 / IDE 内运行).

      用于跳过对 IDE 工程文件的探测:命令行构建不需要 IDE 的编译输出目录(使用 Gradle 自己 产出的 classes),而无条件探测会让这些文件成为 Gradle 配置缓存输入。

    • getIdeaClasspath

      @VisibleForTesting public static List<File> getIdeaClasspath(SourceSetReference reference, org.gradle.api.Project project)
    • getEclipseClasspath

      @VisibleForTesting public static List<File> getEclipseClasspath(SourceSetReference reference, org.gradle.api.Project project)
    • getVscodeClasspath

      @VisibleForTesting public static List<File> getVscodeClasspath(SourceSetReference reference, org.gradle.api.Project project)
    • findFileInResource

      public static @Nullable File findFileInResource(org.gradle.api.Project project, org.gradle.api.tasks.SourceSet sourceSet, String path)
    • findFirstFileInResource

      public static @Nullable File findFirstFileInResource(String path, org.gradle.api.Project project, org.gradle.api.tasks.SourceSet... sourceSets)
    • getFirstSrcDir

      public static File getFirstSrcDir(org.gradle.api.tasks.SourceSet sourceSet)