forked from nuecho/rivr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
170 lines (143 loc) · 6.43 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
group = "com.nuecho"
version = "1.0.6"
// Configure the java projects release.
def javaProjects = [project(':rivr-core'), project(':rivr-voicexml')]
configure(javaProjects) {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'checkstyle'
dependencies { checkstyle 'com.puppycrawl.tools:checkstyle:5.5' }
checkstyle.configFile = rootProject.file('checkstyle/checkstyle.xml')
sourceCompatibility = '1.6'
// Fix for Unable to get class information
checkstyleMain { classpath += configurations.compile }
checkstyleTest { classpath += configurations.compile }
eclipse {
project {
natures 'net.sf.eclipsecs.core.CheckstyleNature'
buildCommand 'net.sf.eclipsecs.core.CheckstyleBuilder'
}
classpath {
defaultOutputDir = file("${project.projectDir}/build/classes")
// This should probably be submitted as a patch to the eclipse plugin.
containers.clear()
containers.add("org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6")
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.java
classifier 'sources'
}
// Required for Maven central
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// Maven central release use the "old" uploadArchives mechanism since maven-publish doesn't support signing yet.
artifacts {
archives javadocJar
archives sourcesJar
}
artifacts { archives jar }
}
subprojects {
apply plugin: 'eclipse'
apply plugin: 'ivy-publish' // ivy publishing is for fallback if maven doesn't work.
apply plugin: 'maven'
apply plugin: 'signing'
group = rootProject.group
version = rootProject.version
repositories { mavenCentral() }
signing {
required { gradle.taskGraph.hasTask("uploadArchives") } // Only sign during release.
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer(name: 'mavenCentral') {
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
// Add credentials only if they are present in the project.
// Avoid build failure if not trying to release and user doesn't have proper credentials.
if(project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')){
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// All these are required for maven central release.
// See https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-6.CentralSyncRequirement
pom.project {
name 'rivr'
description 'Rivr is a lightweight open-source dialogue engine enabling flexible VoiceXML web application development for the agile Java developer and enterprise.'
url 'http://rivr.nuecho.com/'
scm {
url 'scm:[email protected]:nuecho/rivr.git'
connection 'scm:[email protected]:nuecho/rivr.git'
developerConnection 'scm:[email protected]:nuecho/rivr.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.html'
distribution 'repo'
}
}
developers {
developer {
id 'nuecho'
name 'Nu Echo inc.'
email '[email protected]'
}
}
}
}
}
}
}
configure(javaProjects) {
uploadArchives{
repositories {
mavenCentral{
pom.project{ packaging 'jar' }
}
}
}
}
task globalJavadoc(type: Javadoc) {
source javaProjects.collect {project -> project.sourceSets.main.allJava }
destinationDir = new java.io.File(buildDir, 'javadoc')
classpath = files(javaProjects.collect {project -> project.sourceSets.main.compileClasspath})
// To use Java 7 Javadoc:
// gradlew -DjavadocExecutable=/usr/java/jdk7/bin/javadoc globalJavadoc
if(System.getProperty("javadocExecutable") != null) {
executable = System.getProperty("javadocExecutable")
}
configure(options) {
splitIndex true
linkSource true
windowTitle "Rivr API documentation"
docTitle "Rivr documentation ($project.version)"
bottom 'Copyright © 2013 <a href="http://www.nuecho.com">Nu Echo Inc.</a>.'
use = true
noTimestamp = true
group("Rivr Core Packages", "com.nuecho.rivr.core*")
group("Rivr VoiceXML Packages", "com.nuecho.rivr.voicexml*")
footer "To report errors, inconsistencies and omissions in the Rivr API documentation, please <a href=\"https://github.com/nuecho/rivr/issues/new\" target=\"_blank\">open an issue</a>."
links "http://download.oracle.com/javase/6/docs/api/"
links "http://download.oracle.com/javaee/6/api/"
links "http://slf4j.org/api/"
links "https://json-processing-spec.java.net/nonav/releases/1.0/fcs/javadocs/"
overview = "${projectDir}/doc/javadoc-extra/overview.html"
stylesheetFile = file 'doc/javadoc-extra/rivr-javadoc.css'
docTitle "<a href=\"http://rivr.nuecho.com/\" target=\"_blank\"><img src=\"http://rivr.nuecho.com/img/logo.png\" /></a><br/>API documentation of <a href=\"http://rivr.nuecho.com/\" target=\"_blank\">Rivr</a> $project.version"
}
}
task wrapper(type: Wrapper) { gradleVersion = '1.9' }
void createVersionFile(File resourceDir, String fileName) {
File versionFile = new File(resourceDir, fileName)
versionFile.getParentFile().mkdirs()
Writer writer = new OutputStreamWriter(new FileOutputStream(versionFile), "utf-8")
writer.write("version=")
writer.write(version)
writer.write("\n")
writer.close()
}