Search in sources :

Example 6 with BuildEnvironment

use of org.gradle.tooling.model.build.BuildEnvironment in project intellij-community by JetBrains.

the class GradleExecutionHelper method getBuildEnvironment.

@Nullable
public static BuildEnvironment getBuildEnvironment(@NotNull ProjectConnection connection) {
    try {
        final BuildEnvironment buildEnvironment = connection.getModel(BuildEnvironment.class);
        if (LOG.isDebugEnabled()) {
            try {
                LOG.debug("Gradle version: " + buildEnvironment.getGradle().getGradleVersion());
                LOG.debug("Gradle java home: " + buildEnvironment.getJava().getJavaHome());
                LOG.debug("Gradle jvm arguments: " + buildEnvironment.getJava().getJvmArguments());
            } catch (Throwable t) {
                LOG.debug(t);
            }
        }
        return buildEnvironment;
    } catch (Exception e) {
        LOG.warn("can not get BuildEnvironment model", e);
        return null;
    }
}
Also used : BuildEnvironment(org.gradle.tooling.model.build.BuildEnvironment) ExternalSystemException(com.intellij.openapi.externalSystem.model.ExternalSystemException) IOException(java.io.IOException) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

BuildEnvironment (org.gradle.tooling.model.build.BuildEnvironment)6 Nullable (org.jetbrains.annotations.Nullable)3 File (java.io.File)2 GradleBuild (org.gradle.tooling.model.gradle.GradleBuild)2 BasicIdeaProject (org.gradle.tooling.model.idea.BasicIdeaProject)2 IdeaModule (org.gradle.tooling.model.idea.IdeaModule)2 IdeaProject (org.gradle.tooling.model.idea.IdeaProject)2 GradleVersion (org.gradle.util.GradleVersion)2 ParametersList (com.intellij.execution.configurations.ParametersList)1 JavaProjectData (com.intellij.externalSystem.JavaProjectData)1 Application (com.intellij.openapi.application.Application)1 DataNode (com.intellij.openapi.externalSystem.model.DataNode)1 ExternalSystemException (com.intellij.openapi.externalSystem.model.ExternalSystemException)1 ExternalSystemTaskNotificationEvent (com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationEvent)1 Pair (com.intellij.openapi.util.Pair)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1 GradleSourceSetData (org.jetbrains.plugins.gradle.model.data.GradleSourceSetData)1 UnsupportedCancellationToken (org.jetbrains.plugins.gradle.service.execution.UnsupportedCancellationToken)1