-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
147 lines (125 loc) · 3.74 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
plugins {
id 'groovy'
id 'idea'
id 'maven'
id 'signing'
}
sourceCompatibility=1.7
targetCompatibility=1.7
version = '0.7.1'
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.5.0'
testCompile 'junit:junit:4.10'
testCompile( 'org.apache.ant:ant-junit:1.8.4' ) {
exclude(group: 'junit', module: 'junit')
}
testCompile 'org.spockframework:spock-core:1.1-groovy-2.4'
testCompile fileTree( dir:'build/libs/', includes:[ "groovy-common-extensions-${version}.jar".toString() ] )
testRuntime 'net.sourceforge.nekohtml:nekohtml:1.9.14'
}
group = 'com.bloidonia'
task generateModule() {
doLast {
def extensionFiles = sourceSets.main.groovy.with { g ->
g.findAll {
it.parentFile.name == 'extensions' && it.name.endsWith( 'groovy' )
}.collect {
it.toString().replaceAll( '\\' + File.separator, '.' )
}.collect {
it - ( g.srcDirs as List )[0].toString().replaceAll( '\\' + File.separator, '.' )
}.collect {
it[ 1..-8 ]
}.join( ',' )
}
new File( "$buildDir/resources/main/META-INF/services" ).with { f ->
f.mkdirs()
new File( f, 'org.codehaus.groovy.runtime.ExtensionModule' ).withWriter { w ->
w.writeLine 'moduleName=groovy-common-extensions'
w.writeLine "moduleVersion=$version"
w.writeLine "extensionClasses=$extensionFiles"
w.writeLine 'staticExtensionClasses='
}
}
}
}
// Hook up dependencies
jar.dependsOn( generateModule )
test.dependsOn( jar )
uploadArchives.dependsOn( test )
groovydoc {
use = true
destinationDir = new File( "${project.buildDir.path}/groovydoc", project.version )
header = '<a href="https://github.com/timyates/groovy-common-extensions">groovy-common-extensions</a>'
footer = null
link 'http://download.oracle.com/javase/6/docs/api/', 'java.'
link 'http://groovy.codehaus.org/api/', 'groovy.', 'org.codehaus.groovy.'
}
task groovydocJar(type: Jar, dependsOn: groovydoc) {
classifier 'javadoc'
from groovydoc.destinationDir
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives jar
archives sourcesJar
archives groovydocJar
}
if( !hasProperty( 'sonatypeUsername' ) ) {
ext.sonatypeUsername = ''
}
if( !hasProperty( 'sonatypePassword' ) ) {
ext.sonatypePassword = ''
}
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'Groovy Common Extensions'
packaging 'jar'
description 'A collection of extensions to Groovy 2+.'
url 'https://github.com/timyates/groovy-common-extensions'
inceptionYear '2012'
scm {
url 'https://github.com/timyates/groovy-common-extensions'
connection 'scm:https://github.com/timyates/groovy-common-extensions.git'
developerConnection 'scm:git://github.com/timyates/groovy-common-extensions.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 '[email protected]'
}
}
}
}
}
}
test {
testLogging {
quiet {
events 'failed'
exceptionFormat 'short'
}
}
}