dev.gradleplugins.internal.GradlePluginDevelopmentTestSuiteInternal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-plugin-development Show documentation
Show all versions of gradle-plugin-development Show documentation
Gradle plugin development plugins.
package dev.gradleplugins.internal;
import dev.gradleplugins.*;
import lombok.Getter;
import org.gradle.api.Action;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.ConfigurationContainer;
import org.gradle.api.artifacts.ModuleDependency;
import org.gradle.api.artifacts.dsl.DependencyHandler;
import org.gradle.api.component.SoftwareComponent;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.plugins.PluginManager;
import org.gradle.api.provider.Provider;
import org.gradle.api.provider.ProviderFactory;
import org.gradle.api.provider.SetProperty;
import org.gradle.api.reflect.HasPublicType;
import org.gradle.api.reflect.TypeOf;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.TaskContainer;
import org.gradle.api.tasks.testing.Test;
import org.gradle.internal.Actions;
import org.gradle.plugin.devel.tasks.PluginUnderTestMetadata;
import org.gradle.util.GradleVersion;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.stream.StreamSupport;
import static dev.gradleplugins.internal.DefaultDependencyVersions.SPOCK_FRAMEWORK_VERSION;
public abstract class GradlePluginDevelopmentTestSuiteInternal implements GradlePluginDevelopmentTestSuite, SoftwareComponent, HasPublicType, FinalizableComponent {
private final GradlePluginTestingStrategyFactory strategyFactory;
private final Dependencies dependencies;
private final String name;
@Getter private final List> testTaskActions = new ArrayList<>();
private final Action finalizeAction;
private final TestTaskView testTasks;
private boolean finalized = false;
@Inject
protected abstract ObjectFactory getObjects();
@Inject
protected abstract TaskContainer getTasks();
@Inject
public GradlePluginDevelopmentTestSuiteInternal(String name, TaskContainer tasks, ObjectFactory objects, PluginManager pluginManager, ProviderFactory providers, Provider minimumGradleVersion) {
this.strategyFactory = new GradlePluginTestingStrategyFactoryInternal(minimumGradleVersion);
this.name = name;
this.dependencies = getObjects().newInstance(Dependencies.class, getSourceSet(), pluginManager, minimumGradleVersion.orElse(GradleVersion.current().getVersion()).map(GradleRuntimeCompatibility::groovyVersionOf));
getTasks().withType(PluginUnderTestMetadata.class).configureEach(task -> {
if (task.getName().equals("pluginUnderTestMetadata")) {
task.getPluginClasspath().from((Callable
© 2015 - 2024 Weber Informatics LLC | Privacy Policy