I want to apply the plugin I am developing in the build script of the plugin. Currently I can imagine doing one of the following:
Release version 1.0, than apply this released version to version 1.1-SNAPSHOT (I have seen this in some plugins in github) - develop the plugin in buildSrc, put src/ in .gitignore, copy everything from buildSrc/src to src as first step of the build (This seems to be very ugly)
Are there any other options? What is the preferred and suggested way?
I would recommend to publish an initial version of your plugin and then apply that plugin in your buildscript block of your gradle build script (your 1st described approach I guess)
Now I can apply my plugin in the main build.gradle. OK, now my classes get compiled twice (just as with my previous 2nd approach above), but at least now I always get my latest plugin version applied.
But what this does is not changing the location of your sources from src/main/groovy to …/src/main/groovy but adding the directory to the preconfigured ones. Often that doesn’t matter, as the former directory (src/main/groovy) in this case is empty. But sometimes this causes side effects in your build.gradle scripts or your custom plugins. usually the snippet above, can be replaced by