dev.gradleplugins.internal.plugins.RemoveGradleApiProjectDependency 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.plugins;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.internal.artifacts.dependencies.SelfResolvingDependencyInternal;
import org.gradle.api.plugins.AppliedPlugin;
final class RemoveGradleApiProjectDependency implements Action {
private final Project project;
RemoveGradleApiProjectDependency(Project project) {
this.project = project;
}
@Override
public void execute(AppliedPlugin ignored) {
// Surgical procedure of removing the Gradle API and replacing it with dev.gradleplugins:gradle-api
project.getConfigurations().getByName("api").getDependencies().removeIf(it -> {
if (it instanceof SelfResolvingDependencyInternal) {
return ((SelfResolvingDependencyInternal) it).getTargetComponentId().getDisplayName().equals("Gradle API");
}
return false;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy