Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
142 lines (122 sloc) 3.54 KB
apply plugin: 'groovy'
apply plugin: 'codenarc'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'idea'
apply plugin: 'checkstyle'
defaultTasks 'build'
version = '2.1.2'
group = 'com.eriwen'
ext.artifact = 'groovyrtm'
ext.isSnapshot = version.endsWith("-SNAPSHOT")
repositories {
jcenter()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.11'
compile 'commons-codec:commons-codec:1.6'
testCompile 'junit:junit:4.10'
testCompile 'org.gmock:gmock:0.8.2'
}
checkstyleMain {
ignoreFailures = true
configFile = new File(rootDir, 'checkstyle.xml')
}
codenarcMain {
ignoreFailures = true
reports.html.enabled = false
reports.xml.enabled = true
}
test {
include '**/Test.*'
exclude '**/IntegrationTest.*'
}
idea.module {
ext.gradleCacheVariable = 'GRADLE_CACHE'
ext.downloadJavadoc = true
ext.downloadSource = true
outputDir = file("intellij/out")
testOutputDir = file("intellij/testOut")
}
idea.project.ipr.withXml { provider ->
def node = provider.asNode()
vcsConfig.mapping[0].'@vcs' = 'Git'
// Set gradle home
def gradleSettings = node.appendNode('component', [name: 'GradleSettings'])
gradleSettings.appendNode('option', [name: 'SDK_HOME', value: gradle.gradleHomeDir.absolutePath])
}
jar {
baseName = artifact
}
task sourceJar(type: Jar) {
description = 'An archive of the source code for Maven Central'
classifier = 'sources'
from sourceSets.main.groovy
}
task groovydocJar(type: Jar) {
description = 'An archive of the GroovyDocs for Maven Central'
classifier = 'javadoc'
from groovydoc
}
artifacts {
archives groovydocJar, sourceJar
}
signing {
sign configurations.archives
}
// Only *require* signing if we are uploading a non snapshot version
gradle.taskGraph.whenReady { taskGraph ->
tasks.withType(org.gradle.plugins.signing.Sign).all {
required = taskGraph.hasTask(":uploadArchives") && !isSnapshot
}
}
install.repositories.mavenInstaller {
pom.project(pomConfiguration)
if (signing.signatory) {
beforeDeployment { signing.signPom(it) }
}
}
uploadArchives {
repositories.mavenDeployer {
if (signing.signatory) {
beforeDeployment { signing.signPom(it) }
}
name = 'mavenCentralReleaseDeployer'
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: System.properties['mavenCentralUsername'], password: System.properties['mavenCentralPassword'])
releases(updatePolicy: 'always')
snapshots(updatePolicy: 'always')
}
pom.project(pomConfiguration)
}
}
/**
* Create POM config and return for use by other tasks.
*/
def getPomConfiguration() {
return {
name 'GroovyRTM'
packaging 'jar'
description 'Java/Groovy API library for Remember The Milk'
url 'http://eriwen.github.com/groovyrtm'
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 'eriwen'
name 'Eric Wendelin'
email 'emwendelin@gmail.com'
}
}
scm {
connection 'scm:https://eriwen@github.com/eriwen/groovyrtm'
developerConnection 'scm:git@github.com:eriwen/groovyrtm.git'
url 'https://github.com/eriwen/groovyrtm'
}
}
}