forked from riotfamily/riot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
202 lines (177 loc) · 5.92 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
libraries = [
jpa: 'org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.0.Final',
jta: 'javax.transaction:jta:1.1',
c3p0: 'c3p0:c3p0:0.9.1.2',
slf4j: 'org.slf4j:slf4j-api:1.6.1',
slf4j_log4j: 'org.slf4j:slf4j-log4j12:1.6.1',
log4j: 'log4j:log4j:1.2.14',
jcl_over_slf4j: 'org.slf4j:jcl-over-slf4j:1.6.1',
junit: 'junit:junit:4.8.1',
jetty: 'org.mortbay.jetty:jetty:6.1.22',
servlet_api: 'javax.servlet:servlet-api:2.5',
hibernate: 'org.hibernate:hibernate-core:3.6.0.Final',
hibernate_ehcache: 'org.hibernate:hibernate-ehcache:3.6.0.Final',
javassist: 'javassist:javassist:3.8.0.GA',
cglib: 'cglib:cglib-nodep:2.2',
ehcache: 'net.sf.ehcache:ehcache-core:1.7.2',
freemarker: 'org.freemarker:freemarker:2.3.18',
javax_mail: 'javax.mail:mail:1.4.1',
quartz: 'org.opensymphony.quartz:quartz:1.6.6',
dom4j: 'dom4j:dom4j:1.6.1',
json_lib: 'net.sf.json-lib:json-lib:2.2.3:jdk15',
commons_fileupload: 'commons-fileupload:commons-fileupload:1.2.1',
commons_io: 'commons-io:commons-io:1.4',
commons_httpclient: 'commons-httpclient:commons-httpclient:3.1',
xstream: 'com.thoughtworks.xstream:xstream:1.3.1',
dwr: 'org.directwebremoting:dwr:3.0.0.161.dev',
yuicompressor: 'com.yahoo.platform.yui:yuicompressor:2.4.2',
htmlparser: 'org.htmlparser:htmlparser:1.6',
hsqldb: 'org.hsqldb:hsqldb:1.8.0.10',
apache_poi: 'org.apache.poi:poi:3.5-FINAL'
] + modules('lucene', 'org.apache.lucene:lucene-$name:2.4.1',
'core', 'highlighter', 'analyzers', 'snowball') +
modules('spring', 'org.springframework:spring-$name:3.0.5.RELEASE',
'core', 'expression', 'beans', 'aop', 'context', 'context-support',
'tx', 'jdbc', 'orm', 'oxm', 'web', 'webmvc', 'test');
excludes = [
[group: 'javax.jms'],
[group: 'com.sun.jmx'],
[group: 'com.sun.jdmk'],
[group: 'org.mortbay.jetty', module: 'servlet-api']
]
apply plugin: 'java'
apply plugin: 'eclipse'
dependsOnChildren()
allprojects {
group = 'org.riotfamily'
version = '9.1.0'
repositories {
mavenRepo url: 'http://repository.riotfamily.org/external'
mavenRepo url: 'http://repository.riotfamily.org/cache'
}
excludes.each {
configurations.all*.exclude it
}
task release
}
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
release.dependsOn(uploadArchives)
sourceCompatibility = 1.5
targetCompatibility = 1.5
configurations.compile.transitive = true
configurations.testCompile.transitive = true
sourceSets {
main {
// No separate 'resources' dir - we keep everything under src
resources.srcDirs = java.srcDirs = ['src']
}
test {
// If the module contains web-tests, there is an extra 'src'
// and a 'webapp' dir under /test. Otherwise the sources are
// located directly under /test.
resources.srcDirs = java.srcDirs = [file('test/src').exists() ? 'test/src' : 'test']
}
}
// Add META-INF directory
metaInf << fileTree('META-INF')
// Add project-name and version to the manifest
manifest.mainAttributes(
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'riotfamily.org'
)
// Create source artifacts for Java projects
if (isJavaProject(project)) {
dependencies {
testCompile libs(['junit', 'spring_test'])
}
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives sourceJar {
type = 'sources'
}
}
}
if (rootProject.hasProperty('artifactory.publish.username') && rootProject.hasProperty('artifactory.publish.password')) {
uploadArchives {
repositories {
mavenDeployer {
//repository(url: "file://$System.env.HOME/.m2/repository")
repository(url: "http://repository.riotfamily.org/releases") {
authentication(userName: project.'artifactory.publish.username', password: project.'artifactory.publish.password')
}
snapshotRepository(url: "http://repository.riotfamily.org/snapshots") {
authentication(userName: project.'artifactory.publish.username', password: project.'artifactory.publish.password')
}
}
}
}
}
}
// The root project uses the Java plugin (allthough it's actually a meta
// project) in order to generate a merged .classpath file for Eclipse.
// We disable the 'jar' and 'classes' targets so that no 'build' folder
// gets created.
classes.enabled = false
jar.enabled = false
eclipse.project.natures << 'org.springframework.ide.eclipse.core.springnature'
eclipse.classpath.file {
whenMerged { classpath ->
classpath.entries.each { entry ->
if (entry.kind == 'src') {
entry.output = entry.path.replaceAll('(.+?)/.*', '$1/build/eclipse')
}
}
}
}
gradle.taskGraph.whenReady {taskGraph ->
if (taskGraph.hasTask(':eclipseClasspath')) {
subprojects.each {
// Collect source folders
project.sourceSets.main.java.srcDirs(it.sourceSets*.java.srcDirs.flatten())
// Collect all external dependencies from the testRuntime configuration
it.configurations.findByName('testRuntime')?.getAllDependencies().withType(ExternalDependency.class).each {
project.configurations.compile.getDependencies().add(it)
}
}
}
if (!taskGraph.hasTask(':release')) {
allprojects {
version += "-SNAPSHOT"
}
}
}
/**
* Creates the gradlew wrapper scripts
*/
task wrapper(type: Wrapper) {
jarFile = '.gradlew/gradle-wrapper.jar'
gradleVersion = '1.0-milestone-8'
}
// ---------------------------------------------------------------------------
// Utility methods
//----------------------------------------------------------------------------
def isJavaProject(Project project) {
project?.name != 'jslibs'
}
def modules(String key, String pattern, String... names) {
libs = [:]
template = new groovy.text.GStringTemplateEngine().createTemplate(pattern)
names.each{ name ->
libs[key + '_' + name.replace('-', '_')] = template.make([name: name]).toString()
}
libs
}
def lib(String name) {
dep = libraries[name]
assert dep != null, "No such library: ${name}"
dep
}
def libs(Collection names) {
names.collect{ lib(it.toString()) }
}