package dev.caskeleton.buildlogic.strictlane; import org.gradle.api.Action; import org.gradle.api.GradleException; import org.gradle.api.NamedDomainObjectContainer; public class StrictTestLaneExtension { private final NamedDomainObjectContainer lanes; public StrictTestLaneExtension(NamedDomainObjectContainer lanes) { this.lanes = lanes; } public NamedDomainObjectContainer getLanes() { return lanes; } public void lane(String name, Action configuration) { // Configured before it is added, so the plugin's `lanes.all` action sees the declared source // set (it decides whether the lane is its JVM test suite's own task). if (lanes.findByName(name) != null) { throw new GradleException("strict test lane '" + name + "' is declared twice"); } StrictTestLaneSpec lane = new StrictTestLaneSpec(name); configuration.execute(lane); lanes.add(lane); } }