gosu-lang / gradle-gosu-plugin

BSD 3-Clause "New" or "Revised" License
5 stars 7 forks source link

Make the sourceset recognized by IDE. #51

Open rcw3bb opened 4 years ago

rcw3bb commented 4 years ago

On my first initial trial to use the original one on this branch with IntelliJ. The gosu sourceset was not recognized but the gradle does. This one makes IntelliJ happy.

I've added some a group name to all the tasks related to this plugin.

Also fixed some unit tests.

Any comments on this to be merged will be greatly appreciated.

sadheeshv commented 4 years ago

Hi Ron, First off, Thank you and Appreciate your work on this. I'd like to give you little bit background on what I'm trying to do here and understand what's your goal as well. I'm working on to upgrade this plugin to support gradle 6.0.1 and make it work on it on Gradle 6.0.1. When have gone thru your changes, I got the following questions

  1. Make the sourceset recognized by IDE: Could you explain the problem clearly what exactly you are facing with IDE. https://github.com/gosu-lang/gradle-gosu-plugin/pull/51/commits/8c3164449452496c5ea77088787935fb30a704cf Here it was changed javaBasePlugin to JavaPlugin, would like to understand the reason? After all this "javaBasePlugin" instance variable have not been used in the current code. It was used for older versions of gradle,( please look at the else block).
  2. Line #77 sourceSet.getJava().srcDir(gosuSourceSet.getGosu()); How this change helps. Could you spell it out.
  3. Group name can be added.
  4. If you need a plugin that works on Gradle 5.1.1 Please use the 0.3.14
rcw3bb commented 4 years ago

Hi @sadheeshv,

Thank you for checking my PR.

For item 1,

When I use the plugin with IntelliJ the src/main/gosu and src/test/gosu were not recognized as a sourceset. To overcome it I still need to use the idea plugin just to make those recognized as a source set.

For the JavaBasePlugin, it seems to me that we are registering 2 java plugins (i.e. JavaPlugin and JavaBasePlugin). Where in reality we can just use the JavaPlugin itself just register it first in the GosuPlugin.

For item 2,

That line of code actually made IntelliJ recognized the src/main/gosu and src/test/gosu as a sourceset coming from gradle without using the idea plugin as a support. I tried a lot of different ways to make it work until this one.

Can you try the plugin without this PR with IntelliJ and observe the src/main/gosu and src/test/gosu? Then use this PR with IntelliJ - If you have time.

DPUkyle commented 4 years ago

Recently I learned about this plugin: JetBrains/gradle-idea-ext-plugin

This should allow cleaner importation of projects using the "native" Tooling API.

rcw3bb commented 4 years ago

Hi @DPUkyle, that is the idea plugin that I am talking about on my response to @sadheeshv. For me, why do I need a support plugin (i.e. like the idea plugin). If I can already make my plugin do it, it just showing the completeness of the plugin. Just like what the v0.3.10, it doesn't require any supplementary plugin to be used. I'm just returning its independence.

Does the PR breaks any behavior of the plugin? Or any test brokes? Is there a better way to return the independence of the plugin (i.e. without using any supplementary plugin as v0.3.10)?