com.ullink.gradle.nunit.NUnitBasePlugin.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-nunit-plugin Show documentation
Show all versions of gradle-nunit-plugin Show documentation
gradle-nunit-plugin is a Gradle plugin that enables NUnit testing
package com.ullink.gradle.nunit
import org.gradle.api.Plugin
import org.gradle.api.Project
class NUnitBasePlugin implements Plugin {
void apply(Project project) {
project.apply plugin: 'de.undercouch.download'
project.tasks.withType(NUnit).whenTaskAdded { NUnit task ->
applyNunitConventions(task, project)
task.metaClass.mixin NUnit2Mixins
}
}
def applyNunitConventions(NUnit task, Project project) {
task.conventionMapping.map "nunitDownloadUrl", { "https://github.com/nunit/${task.gitHubRepoName}/releases/download" }
task.conventionMapping.map "nunitVersion", { '2.6.4' }
task.conventionMapping.map "nunitHome", {
if (System.getenv()['NUNIT_HOME']) {
return System.getenv()['NUNIT_HOME']
}
}
if (project.plugins.hasPlugin('msbuild')) {
task.dependsOn project.tasks.msbuild
task.conventionMapping.map "testAssemblies", {
project.tasks.msbuild.projects.findAll {
it.key =~ 'test'
}
.collect {
it.value.getDotnetAssemblyFile()
}
}
}
}
}