Class GradleUtils

java.lang.Object
org.elasticsearch.gradle.util.GradleUtils

public abstract class GradleUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.gradle.api.tasks.TaskProvider<org.gradle.api.tasks.testing.Test>
    addTestSourceSet(org.gradle.api.Project project, String sourceSetName)
    Add a source set and task of the same name that runs tests.
    static void
    disableTransitiveDependencies(org.gradle.api.artifacts.Configuration config)
     
    static void
    extendSourceSet(org.gradle.api.Project project, String parentSourceSetName, String childSourceSetName)
    Extend the configurations of one source set from another.
    static void
    extendSourceSet(org.gradle.api.Project project, String parentSourceSetName, String childSourceSetName, org.gradle.api.tasks.TaskProvider<org.gradle.api.tasks.testing.Test> test)
    Extends one configuration from another and refreshes the classpath of a provided Test.
    static org.gradle.api.tasks.TaskProvider<?>
    findByName(org.gradle.api.tasks.TaskContainer tasks, String name)
     
    static <T extends org.gradle.api.services.BuildService<?>>
    org.gradle.api.provider.Provider<T>
    getBuildService(org.gradle.api.services.BuildServiceRegistry registry, String name)
     
    static org.gradle.api.tasks.SourceSetContainer
    getJavaSourceSets(org.gradle.api.Project project)
     
    static String
    To calculate the project path from a task path without relying on Task#getProject() which is discouraged during task execution time.
    static boolean
    isIncludedBuild(org.gradle.api.Project project)
    Determine if the given Project is part of a composite included build.
    static boolean
    isModuleProject(String projectPath)
     
    static <T extends org.gradle.api.Task>
    void
    maybeConfigure(org.gradle.api.tasks.TaskContainer tasks, String name, Class<? extends T> type, org.gradle.api.Action<? super T> config)
     
    static void
    maybeConfigure(org.gradle.api.tasks.TaskContainer tasks, String name, org.gradle.api.Action<? super org.gradle.api.Task> config)
     
    static <T> org.gradle.api.Action<T>
     
    static String
    projectPath(String taskPath)
     
    static void
    setupIdeForTestSourceSet(org.gradle.api.Project project, org.gradle.api.tasks.SourceSet testSourceSet)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GradleUtils

      public GradleUtils()
  • Method Details

    • noop

      public static <T> org.gradle.api.Action<T> noop()
    • getJavaSourceSets

      public static org.gradle.api.tasks.SourceSetContainer getJavaSourceSets(org.gradle.api.Project project)
    • maybeConfigure

      public static void maybeConfigure(org.gradle.api.tasks.TaskContainer tasks, String name, org.gradle.api.Action<? super org.gradle.api.Task> config)
    • maybeConfigure

      public static <T extends org.gradle.api.Task> void maybeConfigure(org.gradle.api.tasks.TaskContainer tasks, String name, Class<? extends T> type, org.gradle.api.Action<? super T> config)
    • findByName

      public static org.gradle.api.tasks.TaskProvider<?> findByName(org.gradle.api.tasks.TaskContainer tasks, String name)
    • getBuildService

      public static <T extends org.gradle.api.services.BuildService<?>> org.gradle.api.provider.Provider<T> getBuildService(org.gradle.api.services.BuildServiceRegistry registry, String name)
    • addTestSourceSet

      public static org.gradle.api.tasks.TaskProvider<org.gradle.api.tasks.testing.Test> addTestSourceSet(org.gradle.api.Project project, String sourceSetName)
      Add a source set and task of the same name that runs tests.

      IDEs are also configured if setup, and the test task is added to check. The new test source set extends from the normal test source set to allow sharing of utilities.

      Returns:
      A task provider for the newly created test task
    • setupIdeForTestSourceSet

      public static void setupIdeForTestSourceSet(org.gradle.api.Project project, org.gradle.api.tasks.SourceSet testSourceSet)
    • extendSourceSet

      public static void extendSourceSet(org.gradle.api.Project project, String parentSourceSetName, String childSourceSetName)
      Extend the configurations of one source set from another.
    • extendSourceSet

      public static void extendSourceSet(org.gradle.api.Project project, String parentSourceSetName, String childSourceSetName, org.gradle.api.tasks.TaskProvider<org.gradle.api.tasks.testing.Test> test)
      Extends one configuration from another and refreshes the classpath of a provided Test. The Test parameter is only needed for eagerly defined test tasks.
    • getProjectPathFromTask

      public static String getProjectPathFromTask(String taskPath)
      To calculate the project path from a task path without relying on Task#getProject() which is discouraged during task execution time.
    • isModuleProject

      public static boolean isModuleProject(String projectPath)
    • disableTransitiveDependencies

      public static void disableTransitiveDependencies(org.gradle.api.artifacts.Configuration config)
    • projectPath

      public static String projectPath(String taskPath)
    • isIncludedBuild

      public static boolean isIncludedBuild(org.gradle.api.Project project)
      Determine if the given Project is part of a composite included build. Returns false for any projects that belong to the root "outer" build of a composite.
      Parameters:
      project - the current project
      Returns:
      true if the project is an included build