org.ajoberstar.grgit.gradle.GrgitServicePlugin Maven / Gradle / Ivy
package org.ajoberstar.grgit.gradle;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.provider.Provider;
public class GrgitServicePlugin implements Plugin {
@Override
public void apply(Project project) {
GrgitServiceExtension extension = project.getExtensions().create("grgitService", GrgitServiceExtension.class);
Provider serviceProvider = project.getGradle().getSharedServices().registerIfAbsent("grgit", GrgitService.class, spec -> {
spec.getParameters().getCurrentDirectory().set(project.getLayout().getProjectDirectory());
spec.getParameters().getInitIfNotExists().set(false);
spec.getMaxParallelUsages().set(1);
});
extension.getService().set(serviceProvider);
}
}