[GRADLE-1533] Tooling API should return info on what Gradle distribution is being used by a given project Created: 12/May/11  Updated: 04/Jan/13  Resolved: 17/Apr/12

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.0-milestone-8a

Type: Improvement
Reporter: Kris De Volder Assignee: Szczepan Faber
Resolution: Fixed Votes: 0


 Description   

The IDE needs to be able to check what Gradled distribution and version a project is using implicitly (as specified in Gradle wrapper).

The purpose of having such information is

  • so it can be displayed to the user
  • so IDE can check whether version number matches a supported range and allert users if it does not.


 Comments   
Comment by Szczepan Faber [ 25/May/11 ]

Kris, how about this API:

EclipseProject project = connection.getModel(EclipseProject.class);
String ver = project.getGradleVersion().getVersion();
Comment by Kris De Volder [ 26/May/11 ]

Ok.. at first sight this looks good... but... some comments:

1) One motivating use case here is that I want to be able to determine whether a project is supported by the tooling API. But... it would seem that if the project uses a gradle version that is too low for the tooling API... then I wouldn't be able to get the project model. So, I guess we really need something that is a little more robust. I gather determining the version doesn't really require building the project model, or does it? (I gather you will determine the version of Gradle to use before you build the model

Bad thing with this API is I can't ask for the project's version unless I first build the project model and this can fail for a number of reasons, which have nothing to do with determining the version.

2) I assume that I will also be able to use the object returned by "getGradleVersion" directly, e.g. to compare GradleVersions to one another. (E.g. if I wanted to verify that the version is at least 1.0.M3

Kris

PS: General comment... hanging all the operations of off the "model" does tend to make it necessary to build the model, which is costly and can fail for a number of reasons. This tends to give us an API which very often fails dramatically because of some small problem with a project. This may be ok in a commandline style tool, but is very bad for an IDE. (E.g. do you expect your IDE to stop working because you have a compile error in one of your source files?).

Comment by Szczepan Faber [ 17/Apr/12 ]

Hey Kris,

I believe we implemented that feature in M8. Take a look at the BuildEnvironmentModel. The gradle version information is available for any version of target gradle. More info here: http://gradle.org/docs/nightly/javadoc/org/gradle/tooling/model/build/BuildEnvironment.html

Please reopen the ticket if needed!

Generated at Wed Jun 30 11:57:54 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.