Thinking of what would work best in Eclipse the first two options seem preferable.
I don't believe in the third option. Though I would wish it so, (so you guys do all the work, and my life is easy
, I don't think it will work well.
Eclipse/Greclipse may not be very good in having this annoying 'one classpath' assumption built-in. But it does a pretty good Job at robust parsing and type inference of code that is in a broken state. It does this on the fly with a 'reconcile phase' of hot editor contents. I.e. it does this with code that is not even on disk and that may not even parse because you are in the middle of typing somethin and just entered a '.'
To have this content assist work well (i.e. work most of the time and be fast) this sort of thing is important.
Gradle can't really do this (well I guess it can, anything is possible but we will have to provide some way to tell Gradle about unsaved contents in the editors, and Gradle would need to be able to parse this and tell us about content assist in terms of text postions in these 'hot' editor contents.
In Greclipse most of the machinery to make much of this work is already there. You would be reimplementing it mostly. What I quickly hacked up, for example, can already suggest that "rep" in the toplevel of the build.gradle can be completed to "repositories" and will popup the JavaDoc for the corresponding method in the Gradle API. Also when you then are inside the {} behind the "repositories" keyword it will correctly infer that the type of the 'delegate' in that context is 'RepositoryHandler' and so corresponding code assist suggestions for methods implemented there also get suggested in that particular context but not elsewhere. This requires little work. The key is having a mechanims to attach type info to code/expressions and and having those types on the classpath.
So I would think that the first two options are preferable. But I could imagine we may need to decide what side of the api boundary' the work of defining this mapping would be at. I.e. does the tooling API provide this mapping directly, or does it only provide the information needed for the IDE to define its mapping.
I'm guessing you guys probably understand better what such a mapped project should like (e.g. is 'buildSrc a source folder or a project? I haven't got a clue 
Even if you decide that the code assist should all go behind the API.. then we probably will still need classpath information. This is because if you see an expression / method call in the code. You probably want to be able to support navigation operations such as 'go to the declaration of this thing'. And this thing will be something like a type or a method in a type. To be able to find it the IDE would need to have the type on the classpath. To be able to go to its source code, we would need source code attachements for the jars (if the type comes from an external dependency).
Gradle so far is doing pretty well with giving us this type of classpath info for 'project level' stuff.
Now I think we need some way to extend this to the 'build level stuff' as well.
Hey Kris,
As a first step in improving the editing support for build.gradle files we want to provide:
Please let us know if above would work for you!
- the classpath for the given build file. For this one, we plan an API that takes a File on input (which is the build.gradle you need the classpath for) and returns a collection of ExternalDependency objects.
- the default imports. We haven't talked about the API for that one but I guess the list of strings will do.
Please let us know if above would work for you!