Class NestedActionAwareBuildControllerAdapter

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T findModel​(java.lang.Class<T> modelType)
      Fetches a snapshot of the model of the given type, if available.
      <T,​P>
      T
      findModel​(java.lang.Class<T> modelType, java.lang.Class<P> parameterType, org.gradle.api.Action<? super P> parameterInitializer)
      Fetches a snapshot of the model of the given type using the given parameter, if available.
      <T> T findModel​(Model target, java.lang.Class<T> modelType)
      Fetches a snapshot of the model of the given type, if available.
      <T,​P>
      T
      findModel​(Model target, java.lang.Class<T> modelType, java.lang.Class<P> parameterType, org.gradle.api.Action<? super P> parameterInitializer)
      Fetches a snapshot of the model of the given type for the given element using the given parameter, if available.
      GradleBuild getBuildModel()
      Returns an overview of the Gradle build, including some basic details of the projects that make up the build.
      boolean getCanQueryProjectModelInParallel​(java.lang.Class<?> modelType)
      Returns true when actions run using BuildController.run(Collection) and that query project models of the given type will run in parallel.
      <T> T getModel​(java.lang.Class<T> modelType)
      Fetches a snapshot of the model of the given type for the default project.
      <T,​P>
      T
      getModel​(java.lang.Class<T> modelType, java.lang.Class<P> parameterType, org.gradle.api.Action<? super P> parameterInitializer)
      Fetches a snapshot of the model of the given type using the given parameter.
      protected BuildResult<?> getModel​(java.lang.Object target, ModelIdentifier modelIdentifier, java.lang.Object parameter)  
      <T> T getModel​(Model target, java.lang.Class<T> modelType)
      Fetches a snapshot of the model of the given type for the given element, usually a Gradle project.
      <T,​P>
      T
      getModel​(Model target, java.lang.Class<T> modelType, java.lang.Class<P> parameterType, org.gradle.api.Action<? super P> parameterInitializer)
      Fetches a snapshot of the model of the given type for the given element using the given parameter.
      <T> java.util.List<T> run​(java.util.Collection<? extends BuildAction<? extends T>> buildActions)
      Runs the given actions and returns their results.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getCanQueryProjectModelInParallel

        public boolean getCanQueryProjectModelInParallel​(java.lang.Class<?> modelType)
        Description copied from interface: BuildController
        Returns true when actions run using BuildController.run(Collection) and that query project models of the given type will run in parallel. Returns false when the models will not be queried in parallel, for example because the target Gradle version does not support parallel execution, or because some build configuration disables the parallel execution, or because the queries are unsafe to perform in parallel.
        Specified by:
        getCanQueryProjectModelInParallel in interface BuildController
        Returns:
        true when project models may be queried in parallel.
      • run

        public <T> java.util.List<T> run​(java.util.Collection<? extends BuildAction<? extends T>> buildActions)
        Description copied from interface: BuildController
        Runs the given actions and returns their results. Attempts to run the actions in parallel, when supported by the Gradle version.

        This method works with all Gradle versions. For versions 6.7 and earlier, the actions are run sequentially rather than in parallel.

        When one or more actions fail with an exception, the exceptions are rethrown by this method and no result is returned.

        Specified by:
        run in interface BuildController
        Type Parameters:
        T - the result type.
        Parameters:
        buildActions - The actions to run.
        Returns:
        The action results. These are returned in the same order as the actions that produce them.
      • findModel

        public <T> T findModel​(java.lang.Class<T> modelType)
        Description copied from interface: BuildController
        Fetches a snapshot of the model of the given type, if available.

        See BuildController.getModel(Class) for more details.

        Specified by:
        findModel in interface BuildController
        Type Parameters:
        T - The model type.
        Parameters:
        modelType - The model type.
        Returns:
        The model, or null if not present.
      • getBuildModel

        public GradleBuild getBuildModel()
        Description copied from interface: BuildController
        Returns an overview of the Gradle build, including some basic details of the projects that make up the build. This is equivalent to calling #getModel(GradleBuild.class).
        Specified by:
        getBuildModel in interface BuildController
        Returns:
        The model.
      • findModel

        public <T> T findModel​(Model target,
                               java.lang.Class<T> modelType)
        Description copied from interface: BuildController
        Fetches a snapshot of the model of the given type, if available.

        See BuildController.getModel(Model, Class) for more details.

        Specified by:
        findModel in interface BuildController
        Type Parameters:
        T - The model type.
        modelType - The model type.
        Returns:
        The model, or null if not present.
      • getModel

        public <T,​P> T getModel​(java.lang.Class<T> modelType,
                                      java.lang.Class<P> parameterType,
                                      org.gradle.api.Action<? super P> parameterInitializer)
                               throws UnsupportedVersionException
        Description copied from interface: BuildController
        Fetches a snapshot of the model of the given type using the given parameter.

        See BuildController.getModel(Model, Class, Class, Action) for more details.

        Specified by:
        getModel in interface BuildController
        Type Parameters:
        T - The model type.
        P - The parameter type.
        Parameters:
        modelType - The model type.
        parameterType - The parameter type.
        parameterInitializer - Action to configure the parameter
        Returns:
        The model.
        Throws:
        UnknownModelException - When the target project does not support the requested model.
        UnsupportedVersionException - When the target project does not support the requested model or Gradle version does not support parameterized models.
      • findModel

        public <T,​P> T findModel​(java.lang.Class<T> modelType,
                                       java.lang.Class<P> parameterType,
                                       org.gradle.api.Action<? super P> parameterInitializer)
        Description copied from interface: BuildController
        Fetches a snapshot of the model of the given type using the given parameter, if available.

        See BuildController.getModel(Model, Class, Class, Action) for more details.

        Specified by:
        findModel in interface BuildController
        Type Parameters:
        T - The model type.
        P - The parameter type.
        Parameters:
        modelType - The model type.
        parameterType - The parameter type.
        parameterInitializer - Action to configure the parameter
        Returns:
        The model.
      • findModel

        public <T,​P> T findModel​(Model target,
                                       java.lang.Class<T> modelType,
                                       java.lang.Class<P> parameterType,
                                       org.gradle.api.Action<? super P> parameterInitializer)
        Description copied from interface: BuildController
        Fetches a snapshot of the model of the given type for the given element using the given parameter, if available.

        See BuildController.getModel(Model, Class, Class, Action) for more details.

        Specified by:
        findModel in interface BuildController
        Type Parameters:
        T - The model type.
        P - The parameter type.
        Parameters:
        target - The target element, usually a project.
        modelType - The model type.
        parameterType - The parameter type.
        parameterInitializer - Action to configure the parameter
        Returns:
        The model.
      • getModel

        public <T,​P> T getModel​(Model target,
                                      java.lang.Class<T> modelType,
                                      java.lang.Class<P> parameterType,
                                      org.gradle.api.Action<? super P> parameterInitializer)
                               throws UnsupportedVersionException,
                                      UnknownModelException
        Description copied from interface: BuildController
        Fetches a snapshot of the model of the given type for the given element using the given parameter.

        The parameter type must be an interface only with getters and setters and no nesting is supported. The Tooling API will create a proxy instance of this interface and use the initializer to run against that instance to configure it and then pass to the model builder.

        See BuildController.getModel(Class) for more details.

        Specified by:
        getModel in interface BuildController
        Type Parameters:
        T - The model type.
        P - The parameter type.
        Parameters:
        target - The target element, usually a project.
        modelType - The model type.
        parameterType - The parameter type.
        parameterInitializer - Action to configure the parameter
        Returns:
        The model.
        Throws:
        UnknownModelException - When the target project does not support the requested model.
        UnsupportedVersionException - When the target project does not support the requested model or Gradle version does not support parameterized models.