forked from thehiflyer/Fettle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·152 lines (126 loc) · 4.28 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
148
149
150
151
152
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'signing'
sourceCompatibility = 1.6
group = 'se.fearless'
version = '0.8.1'
defaultTasks 'build'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit-dep', version: '4.11'
testCompile group: 'se.mockachino', name: 'mockachino', version: '0.6.0'
compile group: 'com.google.guava', name: 'guava', version: '14.0.1'
}
task gwtJar(type: Jar, dependsOn: classes) {
classifier = 'gwt'
from sourceSets.main.getOutput().classesDir
exclude("**/export/DotExporter*")
into('se/fearless/fettle/super') {
from sourceSets.main.allJava
}
into('se/fearless/fettle') {
from sourceSets.main.resources
exclude("**/export*")
}
}
jar {
exclude("**/*.xml")
}
checkstyleMain {
doLast {
ant.xslt(in: "$buildDir/reports/checkstyle/main.xml",
style:"config/checkstyle/checkstyle.xsl",
out:"$buildDir/reports/checkstyle/checkstyle.html"
)
}
}
checkstyleTest {
ignoreFailures = true
}
task checkstyleReport << {
if (file("$buildDir/reports/checkstyle/${checkType}.xml").exists()) {
}
}
jacocoTestReport {
reports {
html.enabled = true
csv.enabled = false
xml.enabled = false
}
additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
}
// custom tasks for creating source jar
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
// custom tasks for creating javadoc jar
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
if(hasProperty('sonatypeUsername') && hasProperty('sonatypePassword')) {
sign configurations.archives
}
}
uploadArchives {
if(hasProperty('sonatypeUsername') && hasProperty('sonatypePassword')) {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'Fettle'
packaging 'jar'
description 'Fettle is a state machine framework for java'
url 'http://http://thehiflyer.github.com/Fettle/'
scm {
url 'scm:[email protected]:thehiflyer/Fettle.git'
connection 'scm:[email protected]:thehiflyer/Fettle.git'
developerConnection 'scm:[email protected]:thehiflyer/Fettle.git'
}
licenses {
license {
name 'MIT License'
url 'http://www.opensource.org/licenses/mit-license.php'
distribution 'repo'
}
}
developers {
developer {
id 'thehiflyer'
name 'Per Malmén'
}
}
}
//mess with the generated pom to set the 'packaging' tag
pom.withXml { XmlProvider xmlProvider ->
def xml = xmlProvider.asString()
def pomXml = new XmlParser().parse(new ByteArrayInputStream(xml.toString().bytes))
pomXml.version[0] + { packaging('jar') }
def newXml = new StringWriter()
def printer = new XmlNodePrinter(new PrintWriter(newXml))
printer.preserveWhitespace = true
printer.print(pomXml)
xml.setLength(0)
xml.append(newXml.toString())
}
}
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.6'
}