Permalink
Fetching contributors…
Cannot retrieve contributors at this time
199 lines (171 sloc) 5.56 KB
buildscript {
repositories {
jcenter()
maven { url 'http://dl.bintray.com/content/noamt/gradle-plugins' }
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.3'
classpath 'org._10ne.gradle:rest-gradle-plugin:0.1.1'
classpath 'net.saliman:gradle-cobertura-plugin:2.0.0' // coveralls plugin depends on cobertura plugin
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:0.2.1'
}
}
apply plugin: 'groovy'
apply plugin: 'bintray'
apply plugin: 'maven-publish'
apply plugin: 'idea'
apply plugin: 'rest'
apply plugin: 'cobertura'
apply plugin: 'coveralls'
group = 'com.bloidonia'
version = '0.9.0'
sourceCompatibility = 1.6
targetCompatibility = 1.6
compileJava.options.compilerArgs << "-Xlint:unchecked"
// In this section you declare where to find the dependencies of your project
repositories {
// Use 'maven central' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
jcenter()
}
// In this section you declare the dependencies for your production and test code
dependencies {
compile 'org.codehaus.groovy:groovy:2.3.8'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
testCompile "junit:junit:4.11"
testCompile( "org.apache.ant:ant-junit:1.9.2" ) {
exclude(group: 'junit', module: 'junit')
}
testRuntime fileTree( dir:'build/libs/', includes:[ "groovy-stream-${version}.jar".toString() ] )
}
def metaServices = new File( 'src/main/groovy/META-INF/services' )
task generateModule << {
metaServices.mkdirs()
new File( metaServices, 'org.codehaus.groovy.runtime.ExtensionModule' ).withWriter { w ->
w.writeLine 'moduleName=groovy-stream'
w.writeLine "moduleVersion=$version"
w.writeLine 'extensionClasses=groovy.stream.StreamExtension'
w.writeLine 'staticExtensionClasses='
}
}
task javadocCopy( type: Copy ) {
from( javadoc ) {
include '**/*.html'
filter { line -> line.contains( 'Generated by javadoc' ) ? '' : line }
}
from( javadoc ) {
include '**/*.js'
include '**/*.css'
include '**/*.gif'
}
into 'docs/assets/javadoc'
}
cobertura.coverageFormats = ['html', 'xml'] // coveralls plugin depends on xml format report
task coverageCopy( type: Copy ) {
from "${project.buildDir}/reports/cobertura"
into 'docs/assets/coverage'
}
coverageCopy.dependsOn( 'cobertura' )
task jbake( type:Exec ) {
commandLine 'jbake', 'docs', 'docs/output'
}
jbake.dependsOn( javadocCopy )
jbake.dependsOn( coverageCopy )
compileGroovy.dependsOn( generateModule )
test.dependsOn( jar )
uploadArchives.dependsOn( test )
jar {
from( metaServices ) {
include 'org.codehaus.groovy.runtime.ExtensionModule' into( 'META-INF/services' )
}
}
javadoc {
options.links = [ 'http://groovy.codehaus.org/api/', 'http://docs.oracle.com/javase/6/docs/api/' ]
}
task javadocJar( type: Jar, dependsOn: javadoc ) {
classifier 'javadoc'
from javadoc.destinationDir
}
task sourcesJar( type: Jar ) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
if( !hasProperty( 'bintrayUsername' ) ) {
ext.bintrayUsername = ''
}
if( !hasProperty( 'bintrayKey' ) ) {
ext.bintrayKey = ''
}
if( !hasProperty( 'keyPhrase' ) ) {
ext.keyPhrase = ''
}
def pomConfig = {
scm {
url 'https://github.com/timyates/groovy-stream'
connection 'scm:https://github.com/timyates/groovy-stream.git'
developerConnection 'scm:git://github.com/timyates/groovy-stream.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'tim_yates'
name 'Tim Yates'
email 'tim.yates@gmail.com'
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
pom.withXml {
def root = asNode()
root.appendNode( 'name', 'Groovy Stream' )
root.appendNode( 'description', 'A collection of classes to give a fluent builder for Streams (Lazy Groovy Generators).' )
root.appendNode( 'url', 'http://timyates.github.com/groovy-stream/' )
root.appendNode( 'inceptionYear', '2012' )
root.children().last() + pomConfig
}
}
}
}
bintray {
user = bintrayUsername
key = bintrayKey
publications = ['mavenJava'] // When uploading Maven-based publication files
pkg {
repo = 'groovy-stream'
name = 'groovy-stream'
desc = 'A collection of classes to give a fluent builder for Streams (Lazy Groovy Generators).'
licenses = ['Apache-2.0']
labels = ['groovy','lazy','iterators','stream']
}
dryRun = false
}
assemble.dependsOn( test )
bintrayUpload.dependsOn( assemble )
task push( type:org._10ne.gradle.rest.RestTask, dependsOn: bintrayUpload ) {
description 'Test, Assemble, Push to bintray, and sign it.'
httpMethod = 'post'
uri = "https://api.bintray.com/gpg/timyates/groovy-stream/groovy-stream/versions/$version?passphrase=$keyPhrase"
username = bintrayUsername
password = bintrayKey
}