Start incorporating some of my pre-existing code into a stand-alone Gradle plugin
Keeping notes for later, will need to use this approach in order to get the DSL usable from within the `.gradle` files <http://mrhaki.blogspot.com/2013/05/gradle-goodness-extending-dsl.html>
This commit is contained in:
parent
86e3106bfa
commit
51a89b3115
21
build.gradle
21
build.gradle
|
@ -3,17 +3,36 @@ plugins {
|
|||
}
|
||||
|
||||
apply plugin: 'groovy'
|
||||
apply plugin: 'maven'
|
||||
|
||||
|
||||
group = 'com.github.rtyler'
|
||||
version = '0.1.0'
|
||||
description = ''
|
||||
|
||||
sourceCompatibility = '1.6'
|
||||
targetCompatibility = '1.6'
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
|
||||
compile 'org.codehaus.groovy:groovy-all:2.3.6'
|
||||
compile gradleApi()
|
||||
|
||||
testCompile('org.spockframework:spock-core:0.7-groovy-2.0') {
|
||||
exclude module: 'groovy-all'
|
||||
}
|
||||
testCompile 'cglib:cglib-nodep:2.2.+'
|
||||
}
|
||||
|
||||
test {
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed", "standardOut", "standardError"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bintray {
|
||||
user = project.bintrayUser
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.github.rtyler
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
|
||||
class LocaldocsPlugin implements Plugin<Project> {
|
||||
void apply(Project project) {
|
||||
project.configurations.create('localJavadocs')
|
||||
|
||||
project.task('generateLocalJavadoc', type: Javadoc) {
|
||||
destinationDir = project.file("${project.buildDir}/local-javadocs")
|
||||
|
||||
source = project.configurations.localJavadocs.files.collect { sourceArtifact ->
|
||||
zipTree(sourceArtifact).findAll {
|
||||
it.name.endsWith('java')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
implementation-class=com.github.rtyler.LocaldocsPlugin
|
|
@ -0,0 +1,22 @@
|
|||
package com.github.rtyler
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.testfixtures.ProjectBuilder
|
||||
import spock.lang.*
|
||||
|
||||
class LocaldocsPluginSpec extends Specification {
|
||||
private project
|
||||
|
||||
def setup() {
|
||||
project = ProjectBuilder.builder().build()
|
||||
project.apply plugin: 'com.github.rtyler.localdocs'
|
||||
}
|
||||
|
||||
def "can create the plugin"() {
|
||||
when:
|
||||
def plugin = new LocaldocsPlugin()
|
||||
|
||||
then:
|
||||
plugin instanceof LocaldocsPlugin
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue