SourceSets in Gradle Plugin

I am writing a custom gradle plugin. The project description requires that the users have syntax recognition (in Intellij). This was done by moving all the necessary files to the build file, then using sourceSets to make it a source file.
However, now I am trying to move that task to the plugin, so the sourceSets block will be hidden from the user. The user will apply the plugin, and the plugin will automatically move the files over, then make that file a source file. Is this possible? I can’t seem to figure it out-- using project.sourceSets{test{groovy{srcDir … }}} did not work. Thanks!