-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.gradle
263 lines (230 loc) · 7.22 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'idea'
apply plugin: 'eclipse'
buildDir= "$rootDir/output"
version = "1.7-SNAPSHOT"
ext.githubProjectName = rootProject.name
group = "com.alvazan"
repositories { mavenCentral() }
configurations {
antlr3
antcp
provided
compile.extendsFrom provided
}
dependencies {
compile group: 'org.antlr', name: 'ST4', version: '4.0.4'
provided (group: 'com.netflix.astyanax', name: 'astyanax', version: '1.56.42') {
exclude group: 'org.slf4j'
exclude group: 'log4j'
exclude group: 'org.jboss.netty'
}
compile (group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '1.0.5') {
exclude group: 'org.slf4j'
exclude group: 'log4j'
exclude group: 'org.codehaus.jackson'
exclude group: 'org.apache.cassandra'
}
compile group: 'org.javassist', name: 'javassist', version: '3.16.1-GA'
compile group: 'com.google.inject', name: 'guice', version: '3.0'
compile group: 'args4j', name: 'args4j', version: '2.0.16'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.1'
compile group: 'org.jboss', name: 'jboss-vfs', version: '3.1.0.Final'
compile group: 'com.eaio.uuid', name: 'uuid', version: '3.2'
compile group: 'joda-time', name: 'joda-time', version: '2.0'
provided group: 'org.mongodb', name: 'mongo-java-driver', version: '2.10.1'
provided group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.7.5'
provided (group: 'org.apache.hbase', name: 'hbase', version: '0.94.7') {
exclude group: 'tomcat'
exclude group: 'org.codehaus.jackson'
exclude group: 'org.apache.maven'
exclude group: 'org.apache.maven.scm'
exclude group: 'org.slf4j'
exclude group: 'log4j'
exclude group: 'org.jboss.netty'
}
provided (group: 'org.apache.hadoop', name: 'hadoop-core', version: '1.0.4')
compile 'org.antlr:antlr-runtime:3.2'
compile fileTree(dir: "${projectDir}/src/resources/jar", include: "*.jar")
antlr3 'org.antlr:antlr:3.2'
antcp "ant-contrib:ant-contrib:1.0b3"
antcp "com.google.code.findbugs:bcel:2.0.1"
testCompile group: 'junit', name: 'junit', version: '4.9'
}
conf2ScopeMappings.addMapping(1, configurations.provided, "provided")
install {
repositories.mavenInstaller {
customizePom(pom, project)
}
}
def customizePom(pom, gradleProject) {
pom.whenConfigured { generatedPom ->
// eliminate test-scoped dependencies (no need in maven central poms)
generatedPom.dependencies.removeAll { dep ->
dep.scope == 'test'
}
}
}
sourceSets {
main {
java {
srcDir "${projectDir}/output/generated/java"
}
}
}
task generateparser(dependsOn: 'clean', type: JavaExec) {
def antlrSource = 'src/main/antlr'
def destinationDir = "${projectDir}/output/generated/"
inputs.dir file(antlrSource)
def grammars = fileTree(antlrSource).include('**/*.g')
main = 'org.antlr.Tool'
classpath = configurations.antlr3
args = ["-o", "${destinationDir}/java/com/alvazan/orm/parser/antlr", grammars.files].flatten()
}
compileJava {
dependsOn generateparser
}
compileTestJava.dependsOn 'copyToLib', 'srcbin', 'verifyPackageDesign'
eclipseClasspath.dependsOn 'generateparser'
ideaModule.dependsOn 'generateparser'
task sourcesJar(type: Jar, dependsOn:classes) {
from sourceSets.main.allSource
from "license.txt"
exclude ("logback.xml")
classifier 'sources'
extension 'jar'
}
task javadocJar(type: Jar, dependsOn:javadoc) {
from javadoc.destinationDir
from "license.txt"
classifier 'javadoc'
extension 'jar'
}
javadoc {
failOnError false
}
task srcbin(type: Jar, dependsOn:javadoc) {
from sourceSets.main.allSource
from "license.txt"
from 'output/classes/main'
exclude ("logback.xml")
classifier 'srcbin'
}
test {
classpath = classpath + files("${projectDir}/src/conf/logback.xml")
}
configurations.create('sources')
configurations.create('javadoc')
configurations.archives {
extendsFrom configurations.sources
extendsFrom configurations.javadoc
}
task copyToLib (dependsOn: 'createfile', type: Copy ) {
into "$buildDir/jardist"
from configurations.runtime
}
jar {
exclude('**/t*/d*')
from "license.txt"
}
task createfile << {
def jardistloc = file(new File('$buildDir/jardist'))
jardistloc.mkdir()
}
checkstyleMain {
configFile = rootProject.file('gradle/checkstyle.xml')
source = sourceSets.main.allJava.matching {
exclude '**/com/alvazan/orm/parser/antlr/*'
}
}
checkstyleMain.dependsOn 'verifyPackageDesign'
checkstyleTest {
configFile = rootProject.file('gradle/checkstyle.xml')
}
task verifyPackageDesign(dependsOn: compileJava) << {
ant.taskdef(name: 'verifyDesign', classname: 'net.sf.antcontrib.design.VerifyDesign', classpath: configurations.antcp.asPath)
ant.verifyDesign(design: 'gradle/configDesign.xml') {
ant.path() {
ant.fileset(dir: "$rootDir/output/classes") {
ant.include(name: '**/*.class')
}
}
}
}
def localFile = new File('local.gradle')
if (localFile.exists()) {
apply from: "$rootDir/local.gradle"
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
required { gradle.taskGraph.hasTask(uploadMavenCentral) }
sign configurations.archives
}
signArchives.dependsOn 'dist'
task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
configuration = configurations.archives
doFirst {
repositories.mavenDeployer {
beforeDeployment { org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: rootProject.sonatypeUsername, password: rootProject.sonatypePassword)
}
uniqueVersion = true
pom.project {
name "${project.name}"
description "${project.name} developed by Alvazan"
modelVersion '4.0.0'
groupId 'com.alvazan'
artifactId 'playorm'
url 'http://alvazan.com'
developers {
developer {
id 'd'
name 'DH'
}
}
licenses {
license {
name 'Mozilla Public License Version 2.0'
url 'http://www.mozilla.org/MPL/2.0/'
distribution 'repo'
}
}
scm {
url 'https://github.com/deanhiller/playorm.git'
connection 'scm:git:[email protected]:deanhiller/playorm.git'
developerConnection 'scm:git:[email protected]:deanhiller/playorm.git'
}
}
}
}
}
task dist(type:Zip) {
into('plugin') {
from 'src/resources/play2plugin'
}
into('javadoc') {
from 'output/docs/javadoc'
}
into('lib') {
from 'output/libs/'
from configurations.runtime
}
into('examples') {
from 'examples/'
}
into('bin') {
from 'tools/'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.6'
}
task compile(dependsOn: 'compileJava') { }