All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ullink.gradle.nunit.NUnitBasePlugin.groovy Maven / Gradle / Ivy

There is a newer version: 1.13
Show newest version
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()
                }
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy