Can I create a plugin that calls internal Gradle methods?

I’d like to write a plugin similar to the CUnit and GoogleTest plugins, for invoking a custom native test tool. I have this in my build.gradle:

dependencies {
    compile gradleApi()
    compile localGroovy()

This allows me to import and use things in the org.gradle.api package. But imports like this fail:

import static org.gradle.nativeplatform.test.internal.NativeTestSuites.createNativeTestSuiteBinaries;

Is there any way to set my dependencies such that I can access “internal” methods like this, or is that just not possible for a plugin?

Internal classes are typically accessible (although usage is discouraged). This class in particular was added recently and is only available in Gradle 2.10. You’ll need to build with the latest release candidate. This also means your plugin will only work in Gradle 2.10 or later. And will likely break in the future if/when we make changes to this internal class :wink:

Fair enough, thanks for the clarification :smile:

Any particular guidelines for whether new unit test tools can/will be added to the official project? I’m specifically looking at Cpputest, which is used by some teams here. I’d be happy to write an “official” plugin, if that type of thing is encouraged (though I’m sure you don’t want to bloat the project with every framework under the sun). I can take this to the gradle-dev group too if that’s a more appropriate forum.