use of org.gradle.internal.component.external.model.ProjectTestFixtures in project gradle by gradle.
the class DefaultDependencyHandler method testFixtures.
@Override
public Dependency testFixtures(Object notation) {
Dependency testFixturesDependency = create(notation);
if (testFixturesDependency instanceof ProjectDependency) {
ProjectDependency projectDependency = (ProjectDependency) testFixturesDependency;
projectDependency.capabilities(new ProjectTestFixtures(projectDependency.getDependencyProject()));
} else if (testFixturesDependency instanceof ModuleDependency) {
ModuleDependency moduleDependency = (ModuleDependency) testFixturesDependency;
moduleDependency.capabilities(capabilities -> capabilities.requireCapability(new ImmutableCapability(moduleDependency.getGroup(), moduleDependency.getName() + TEST_FIXTURES_CAPABILITY_APPENDIX, null)));
}
return testFixturesDependency;
}
use of org.gradle.internal.component.external.model.ProjectTestFixtures in project gradle by gradle.
the class JavaTestFixturesPlugin method createImplicitTestFixturesDependencies.
private void createImplicitTestFixturesDependencies(Project project, JavaPluginExtension extension) {
DependencyHandler dependencies = project.getDependencies();
dependencies.add(TEST_FIXTURES_API, dependencies.create(project));
SourceSet testSourceSet = findTestSourceSet(extension);
ProjectDependency testDependency = (ProjectDependency) dependencies.add(testSourceSet.getImplementationConfigurationName(), dependencies.create(project));
testDependency.capabilities(new ProjectTestFixtures(project));
// Overwrite what the Java plugin defines for test, in order to avoid duplicate classes
// see gradle/gradle#10872
ConfigurationContainer configurations = project.getConfigurations();
testSourceSet.setCompileClasspath(project.getObjects().fileCollection().from(configurations.getByName(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME)));
testSourceSet.setRuntimeClasspath(project.getObjects().fileCollection().from(testSourceSet.getOutput(), configurations.getByName(TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME)));
}
Aggregations