I am trying to write an IDEA plugin to support Gradle. My primary concern is to support debugging. The issue I'm running into is mapping build files to classes in the VM. In a multi-project build, there are many files named build.gradle. Each of these is turned into a class called build_gradle. This is not unqiue enough for me. There are two scenario's that need to be supported (these are opposite cases):
1) When a breakpoint is placed in a gradle build file, I need to determine what class to set up for the breakpoint. This is currently easy (I'm actually creating an instance of FileScriptSource and calling the getClassName() method so that if the algorithm changes, the plugin still works). 2) When a breakpoint is reached, I need to take the class and figure out the file that should be displayed. This is currently a problem, as I don't know to which of the many build.gradle files this build_gradle class maps. I would love to have a method in Gradle to call for this purpose as well. Then the plugin really could work with any (future) version of Gradle. I've had several thoughts, but none of them are working out. I thought about putting the "project path" as the package structure for the build files, but that doesn't seem to work. I can determine what Gradle project I should be dealing with, but that doesn't help me find the build file (I should note that I don't want the plugin to have to "run" gradle as that seems fragile and complicated). I thought about putting a well known static final constant in the build class when it is compiled that points to the file, but if the file and cache are moved, that would break (it also seems kinda wrong, somehow). Does anyone have any ideas how to change Gradle so that build files can be matched up to running classes? P.S. If anyone cares, I'm writing this by looking at the Gant support in the JetGroovy plugin that is bundled with IDEA. I'm hoping to get this back into IDEA as a part of that plugin (or a separately bundled plugin). -- John Murph Automated Logic Research Team
