Search in sources :

Example 1 with PluginUnderTestMetadata

use of org.gradle.plugin.devel.tasks.PluginUnderTestMetadata in project gradle by gradle.

the class JavaGradlePluginPlugin method configureTestKit.

private void configureTestKit(Project project, GradlePluginDevelopmentExtension extension) {
    PluginUnderTestMetadata pluginUnderTestMetadataTask = createAndConfigurePluginUnderTestMetadataTask(project, extension);
    establishTestKitAndPluginClasspathDependencies(project, extension, pluginUnderTestMetadataTask);
}
Also used : PluginUnderTestMetadata(org.gradle.plugin.devel.tasks.PluginUnderTestMetadata)

Example 2 with PluginUnderTestMetadata

use of org.gradle.plugin.devel.tasks.PluginUnderTestMetadata in project gradle by gradle.

the class JavaGradlePluginPlugin method createAndConfigurePluginUnderTestMetadataTask.

private PluginUnderTestMetadata createAndConfigurePluginUnderTestMetadataTask(final Project project, final GradlePluginDevelopmentExtension extension) {
    final PluginUnderTestMetadata pluginUnderTestMetadataTask = project.getTasks().create(PLUGIN_UNDER_TEST_METADATA_TASK_NAME, PluginUnderTestMetadata.class);
    pluginUnderTestMetadataTask.setGroup(PLUGIN_DEVELOPMENT_GROUP);
    pluginUnderTestMetadataTask.setDescription(PLUGIN_UNDER_TEST_METADATA_TASK_DESCRIPTION);
    final Configuration gradlePluginConfiguration = project.getConfigurations().detachedConfiguration(project.getDependencies().gradleApi());
    ConventionMapping conventionMapping = new DslObject(pluginUnderTestMetadataTask).getConventionMapping();
    conventionMapping.map("pluginClasspath", new Callable<Object>() {

        public Object call() {
            FileCollection gradleApi = gradlePluginConfiguration.getIncoming().getFiles();
            return extension.getPluginSourceSet().getRuntimeClasspath().minus(gradleApi);
        }
    });
    conventionMapping.map("outputDirectory", new Callable<Object>() {

        public Object call() {
            return new File(project.getBuildDir(), pluginUnderTestMetadataTask.getName());
        }
    });
    return pluginUnderTestMetadataTask;
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) PluginUnderTestMetadata(org.gradle.plugin.devel.tasks.PluginUnderTestMetadata) DslObject(org.gradle.api.internal.plugins.DslObject) DslObject(org.gradle.api.internal.plugins.DslObject) FileCollection(org.gradle.api.file.FileCollection) ConventionMapping(org.gradle.api.internal.ConventionMapping) File(java.io.File)

Aggregations

PluginUnderTestMetadata (org.gradle.plugin.devel.tasks.PluginUnderTestMetadata)2 File (java.io.File)1 Configuration (org.gradle.api.artifacts.Configuration)1 FileCollection (org.gradle.api.file.FileCollection)1 ConventionMapping (org.gradle.api.internal.ConventionMapping)1 DslObject (org.gradle.api.internal.plugins.DslObject)1