diff --git a/src/functTest/groovy/com/verificationgentleman/gradle/hdvl/svunit/SVUnitPluginSpec.groovy b/src/functTest/groovy/com/verificationgentleman/gradle/hdvl/svunit/SVUnitPluginSpec.groovy index c2c95e3..5b01ce0 100644 --- a/src/functTest/groovy/com/verificationgentleman/gradle/hdvl/svunit/SVUnitPluginSpec.groovy +++ b/src/functTest/groovy/com/verificationgentleman/gradle/hdvl/svunit/SVUnitPluginSpec.groovy @@ -368,6 +368,23 @@ class SVUnitPluginSpec extends Specification { dummyLog.text.contains "-f ${testProjectDir.root}/build/full_test_xrun_args.f" } + def "'check' task executes test tasks"() { + File testSv = testProjectDir.newFolder('src', 'test', 'sv') + new File(testSv, 'dummy_test.sv').createNewFile() + + when: + def result = newGradleRunnerWithFakeRunSVunit() + .withProjectDir(testProjectDir.root) + .withPluginClasspath() + .withArguments('check') + .build() + + then: + result.task(":check").outcome == SUCCESS + result.task(":testWithXrun").outcome == SUCCESS + result.task(":testWithQrun").outcome == SUCCESS + } + def newGradleRunnerWithFakeRunSVunit() { def runSVUnitFake = new File(getClass().getResource('/runSVUnit').toURI()) def env = System.getenv() diff --git a/src/main/java/com/verificationgentleman/gradle/hdvl/HDVLBasePlugin.java b/src/main/java/com/verificationgentleman/gradle/hdvl/HDVLBasePlugin.java index e843627..5638fd0 100644 --- a/src/main/java/com/verificationgentleman/gradle/hdvl/HDVLBasePlugin.java +++ b/src/main/java/com/verificationgentleman/gradle/hdvl/HDVLBasePlugin.java @@ -33,6 +33,8 @@ public class HDVLBasePlugin implements Plugin { @Override public void apply(Project project) { + project.getPluginManager().apply("base"); + final DefaultHDVLPluginExtension extension = new DefaultHDVLPluginExtension(project); project.getExtensions().add("hdvl", extension); project.getExtensions().add("sourceSets", extension.getSourceSets()); diff --git a/src/main/java/com/verificationgentleman/gradle/hdvl/svunit/SVUnitPlugin.java b/src/main/java/com/verificationgentleman/gradle/hdvl/svunit/SVUnitPlugin.java index 73a5aa7..7ce5747 100644 --- a/src/main/java/com/verificationgentleman/gradle/hdvl/svunit/SVUnitPlugin.java +++ b/src/main/java/com/verificationgentleman/gradle/hdvl/svunit/SVUnitPlugin.java @@ -32,6 +32,8 @@ import org.gradle.api.artifacts.Dependency; import org.gradle.api.internal.HasConvention; import org.gradle.api.reflect.TypeOf; +import org.gradle.api.tasks.TaskProvider; +import org.gradle.language.base.plugins.LifecycleBasePlugin; import org.gradle.util.GUtil; import java.io.File; @@ -130,9 +132,10 @@ private void configureTestTask(Project project, SourceSet mainSourceSet, SourceS GenFullArgsFile genFullTestArgsFile = (GenFullArgsFile) project.getTasks().getByName(testSourceSet.getGenFullArgsFileTaskName(toolName)); Configuration svUnitRoot = project.getConfigurations().getByName("svUnitRoot"); - project.getTasks().register(Names.getTestTaskName(toolName), TestTask.class, new Action() { + TaskProvider testTask = project.getTasks().register(Names.getTestTaskName(toolName), TestTask.class, new Action() { @Override public void execute(TestTask testTask) { + testTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP); testTask.setDescription("Runs the unit tests using SVUnit."); testTask.getToolName().set(toolName.toLowerCase()); testTask.getMainArgsFile().set(genFullArgsFile.getDestination()); @@ -143,6 +146,7 @@ public void execute(TestTask testTask) { testTask.getExtraArgs().set(toolChains.getRunSVUnit().getArgs()); } }); + project.getTasks().getByName("check").dependsOn(testTask); } }