Skip to content

Instantly share code, notes, and snippets.

@shapeoflambda
Last active March 24, 2019 17:51
Show Gist options
  • Save shapeoflambda/9a6519db4c3a35f15d9f5529f0ec71bf to your computer and use it in GitHub Desktop.
Save shapeoflambda/9a6519db4c3a35f15d9f5529f0ec71bf to your computer and use it in GitHub Desktop.

Revisions

  1. shapeoflambda renamed this gist Mar 24, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. shapeoflambda created this gist Mar 24, 2019.
    24 changes: 24 additions & 0 deletions groovy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    class GreetingPluginExtension {
    String message
    String greeter
    }

    class GreetingPlugin implements Plugin<Project> {
    void apply(Project project) {
    def extension = project.extensions.create('greeting', GreetingPluginExtension)
    project.task('hello') {
    doLast {
    println "${extension.message} from ${extension.greeter}"
    }
    }
    }
    }

    apply plugin: GreetingPlugin

    // Configure the extension using a DSL block
    greeting {
    message = 'Hi'
    greeter = 'Gradle'
    }