// Copyright 2017 the original author or authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

[[announce_plugin]]
== The Announce Plugin

The Gradle announce plugin allows you to send custom announcements during a build. The following notification systems are supported:

* http://twitter.com[Twitter]
* http://manpages.ubuntu.com/manpages/gutsy/man1/notify-send.1.html[notify-send] (Ubuntu)
* https://sites.google.com/site/snarlapp/home[Snarl] (Windows)
* http://growl.info/[Growl] (Mac OS X)
 


[[sec:announce_usage]]
=== Usage

To use the announce plugin, apply it to your build script:

++++
<sample id="useAnnouncePlugin" dir="announce" title="Using the announce plugin">
            <sourcefile file="build.gradle" snippet="use-plugin"/>
        </sample>
++++

Next, configure your notification service(s) of choice (see table below for which configuration properties are available):

++++
<sample id="useAnnouncePlugin" dir="announce" title="Configure the announce plugin">
            <sourcefile file="build.gradle" snippet="announce-plugin-conf"/>
        </sample>
++++

Finally, send announcements with the `announce` method:

++++
<sample id="useAnnouncePlugin" dir="announce" title="Using the announce plugin">
            <sourcefile file="build.gradle" snippet="announce-usage"/>
        </sample>
++++

The `announce` method takes two String arguments: The message to be sent, and the notification service to be used. The following table lists supported notification services and their configuration properties.

.Announce Plugin Notification Services
[cols="a,a,a,a", options="header"]
|===
| Notification Service
| Operating System
| Configuration Properties
| Further Information

| twitter
| Any
| username, password
| 

| snarl
| Windows
| 
| 

| growl
| Mac OS X
| 
| 

| notify-send
| Ubuntu
| 
| Requires the notify-send package to be installed. Use `sudo apt-get install libnotify-bin` to install it.

| local
| Windows, Mac OS X, Ubuntu
| 
| Automatically chooses between snarl, growl, and notify-send depending on the current operating system.
|===


[[sec:announce_configuration]]
=== Configuration

See the api:org.gradle.api.plugins.announce.AnnouncePluginExtension[] class in the API documentation.