Package org.elasticsearch.gradle.util
Class GradleUtils
java.lang.Object
org.elasticsearch.gradle.util.GradleUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 voiddisableTransitiveDependencies(org.gradle.api.artifacts.Configuration config) static voidextendSourceSet(org.gradle.api.Project project, String parentSourceSetName, String childSourceSetName) Extend the configurations of one source set from another.static voidextendSourceSet(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.SourceSetContainergetJavaSourceSets(org.gradle.api.Project project) static StringgetProjectPathFromTask(String taskPath) To calculate the project path from a task path without relying on Task#getProject() which is discouraged during task execution time.static booleanisIncludedBuild(org.gradle.api.Project project) Determine if the givenProjectis part of a composite included build.static booleanisModuleProject(String projectPath) static <T extends org.gradle.api.Task>
voidmaybeConfigure(org.gradle.api.tasks.TaskContainer tasks, String name, Class<? extends T> type, org.gradle.api.Action<? super T> config) static voidmaybeConfigure(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> noop()static StringprojectPath(String taskPath) static voidsetupIdeForTestSourceSet(org.gradle.api.Project project, org.gradle.api.tasks.SourceSet testSourceSet)
-
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
-
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
To calculate the project path from a task path without relying on Task#getProject() which is discouraged during task execution time. -
isModuleProject
-
disableTransitiveDependencies
public static void disableTransitiveDependencies(org.gradle.api.artifacts.Configuration config) -
projectPath
-
isIncludedBuild
public static boolean isIncludedBuild(org.gradle.api.Project project) Determine if the givenProjectis part of a composite included build. Returnsfalsefor 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
-