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

jp.tomorrowkey.gradle.notifier.NotifierPlugin.groovy Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package jp.tomorrowkey.gradle.notifier

import org.gradle.api.Plugin
import org.gradle.api.Project

// see http://www.gradle.org/docs/current/userguide/custom_plugins.html

public class NotifierPlugin implements Plugin {

    def notifiers = []

    @Override
    void apply(Project project) {
        notifiers = NotifiersFactory.create(project)

        project.gradle.taskGraph.afterTask { task, state ->
            def tasks = project.gradle.taskGraph.allTasks

            if (tasks.isEmpty()) {
                return;
            }

            def lastTask = tasks.last()
            if (!lastTask.equals(task)) {
                return;
            }

            performNotify(task, state)
        }
    }

    void performNotify(task, state){
        notifiers.each() { notifier ->
            notifier.performNotify(task, state)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy