forked from hibernate/hibernate-orm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
355 lines (308 loc) · 14.1 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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
apply plugin: 'eclipse'
apply plugin: 'idea'
apply from: "./libraries.gradle"
allprojects {
repositories {
mavenCentral()
mavenLocal()
mavenRepo name: 'jboss-nexus', url: "http://repository.jboss.org/nexus/content/groups/public/"
mavenRepo name: "jboss-snapshots", url: "http://snapshots.jboss.org/maven2/"
}
}
buildscript {
repositories {
mavenCentral()
mavenLocal()
mavenRepo name: 'jboss-nexus', url: "http://repository.jboss.org/nexus/content/groups/public/"
mavenRepo name: "jboss-snapshots", url: "http://snapshots.jboss.org/maven2/"
}
dependencies {
classpath 'org.hibernate.build.gradle:gradle-upload-auth-plugin:1.1.1'
}
}
ext.hibernateTargetVersion = '4.3.0-SNAPSHOT'
idea {
project {
languageLevel = '1.6'
ipr {
withXml { provider ->
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
def maxHeapSizeConfig = provider.node.component.find { it.@name == 'JavacSettings' }
if( maxHeapSizeConfig == null ){
def javacSettingsNode = provider.node.appendNode('component',[name: 'JavacSettings'])
javacSettingsNode.appendNode('option', [name:"MAXIMUM_HEAP_SIZE", value:"512"])
}
}
beforeMerged { project ->
project.modulePaths.clear()
}
}
}
module {
name = "hibernate-orm"
}
}
subprojects { subProject ->
apply plugin: 'idea'
apply plugin: 'eclipse'
defaultTasks 'build'
group = 'org.hibernate'
version = rootProject.hibernateTargetVersion
// minimize changes, at least for now (gradle uses 'build' by default)..
buildDir = "target"
if ( ! subProject.name.startsWith( 'release' ) && ! subProject.name.startsWith( 'documentation' ) ) {
apply plugin: 'java'
apply plugin: 'maven' // for install task as well as deploy dependencies
apply plugin: 'uploadAuth'
apply plugin: 'osgi'
apply from: "../utilities.gradle"
configurations {
provided {
// todo : need to make sure these are non-exported
description = 'Non-exported compile-time dependencies.'
}
jbossLoggingTool {
description = "Dependencies for running the JBoss logging AnnotationProcessor tool"
}
hibernateJpaModelGenTool {
description = "Dependencies for running the Hibernate JPA Metamodel Generator AnnotationProcessor tool"
}
deployerJars {
description = 'Jars needed for doing deployment to JBoss Nexus repo'
}
jaxb {
description = 'Dependencies for running ant xjc (jaxb class generation)'
}
configurations {
all*.exclude group: 'xml-apis', module: 'xml-apis'
}
}
ext.toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar")
// appropriately inject the common dependencies into each sub-project
dependencies {
compile( libraries.logging )
testCompile( libraries.junit )
testCompile( libraries.byteman )
testCompile( libraries.byteman_install )
testCompile( libraries.byteman_bmunit )
testRuntime( libraries.slf4j_api )
testRuntime( libraries.slf4j_log4j12 )
testRuntime( libraries.jcl_slf4j )
testRuntime( libraries.jcl_api )
testRuntime( libraries.jcl )
testRuntime( libraries.javassist )
testRuntime( libraries.h2 )
jbossLoggingTool( libraries.logging_processor )
hibernateJpaModelGenTool( libraries.jpa_modelgen )
jaxb( libraries.jaxb ){
exclude group: "javax.xml.stream"
}
jaxb( libraries.jaxb2_basics )
jaxb( libraries.jaxb2_ant )
deployerJars "org.apache.maven.wagon:wagon-http:1.0"
}
if(ext.toolsJar.exists()){
dependencies{
testCompile files( toolsJar )
}
}
sourceSets.main {
compileClasspath += configurations.provided
}
sourceSets.all {
ext.originalJavaSrcDirs = java.srcDirs
ext.generatedLoggingSrcDir = file( "${buildDir}/generated-src/logging/${name}" )
java.srcDir generatedLoggingSrcDir
}
task generateMainLoggingClasses(type: Compile) {
ext.aptDumpDir = subProject.file( "${buildDir}/tmp/apt/logging" )
classpath = compileJava.classpath + configurations.jbossLoggingTool
source = sourceSets.main.originalJavaSrcDirs
destinationDir = aptDumpDir
options.define(
compilerArgs: [
"-nowarn",
"-proc:only",
"-encoding", "UTF-8",
"-processor", "org.jboss.logging.processor.apt.LoggingToolsProcessor",
"-s", "$sourceSets.main.generatedLoggingSrcDir.absolutePath",
"-AloggingVersion=3.0",
"-source", "1.6",
"-target", "1.6",
"-AtranslationFilesPath=${project.rootDir}/src/main/resources"
]
);
outputs.dir sourceSets.main.generatedLoggingSrcDir;
doFirst {
// source = sourceSets.main.originalJavaSrcDirs
sourceSets.main.generatedLoggingSrcDir.mkdirs()
}
doLast {
aptDumpDir.delete()
}
}
// for the time being eat the annoying output from running the annotation processors
generateMainLoggingClasses.logging.captureStandardError(LogLevel.INFO)
compileJava.dependsOn generateMainLoggingClasses
compileJava.options.define(compilerArgs: ["-proc:none", "-encoding", "UTF-8"])
compileTestJava.options.define(compilerArgs: ["-proc:none", "-encoding", "UTF-8"])
jar {
Set<String> exportPackages = new HashSet<String>()
Set<String> privatePackages = new HashSet<String>()
// TODO: Could more of this be pulled into utilities.gradle?
sourceSets.each { SourceSet sourceSet ->
// skip certain source sets
if ( ! ['test','matrix'].contains( sourceSet.name ) ) {
sourceSet.java.each { javaFile ->
// - org.hibernate.boot.registry.classloading.internal
// until EntityManagerFactoryBuilderImpl no longer imports ClassLoaderServiceImpl
// - .util for external module use (especially envers)
final String[] temporaryExports = [
'org.hibernate.boot.registry.classloading.internal',
'org.hibernate.internal.util' ]
final String packageName = determinePackageName( sourceSet.java, javaFile );
if ( ! temporaryExports.contains( packageName )
&& ( packageName.endsWith( ".internal" )
|| packageName.contains( ".internal." )
|| packageName.endsWith( ".test" )
|| packageName.contains( ".test." ) ) ) {
privatePackages.add( packageName );
}
else {
exportPackages.add( packageName );
}
}
}
}
manifest = osgiManifest {
// GRADLE-1411: Even if we override Imports and Exports
// auto-generation with instructions, classesDir and classpath
// need to be here (temporarily).
classesDir = sourceSets.main.output.classesDir
classpath = configurations.runtime
instruction 'Export-Package', exportPackages.toArray(new String[0])
instruction 'Private-Package', privatePackages.toArray(new String[0])
instruction 'Bundle-Vendor', 'Hibernate.org'
instruction 'Implementation-Url', 'http://hibernate.org'
instruction 'Implementation-Version', version
instruction 'Implementation-Vendor', 'Hibernate.org'
instruction 'Implementation-Vendor-Id', 'org.hibernate'
}
}
test {
systemProperties['hibernate.test.validatefailureexpected'] = true
systemProperties += System.properties.findAll { it.key.startsWith( "hibernate.") }
maxHeapSize = "1024m"
}
processTestResources.doLast( {
copy {
from( sourceSets.test.java.srcDirs ) {
include '**/*.properties'
include '**/*.xml'
}
into sourceSets.test.output.classesDir
}
} )
assemble.doLast( { install } )
uploadArchives.dependsOn install
targetCompatibility = "1.6"
sourceCompatibility = "1.6"
idea {
module {
iml {
beforeMerged { module ->
module.dependencies.clear()
module.excludeFolders.clear()
}
whenMerged { module ->
module.dependencies*.exported = true
module.excludeFolders += module.pathFactory.path(file(".gradle"))
module.excludeFolders += module.pathFactory.path(file("$buildDir/bundles"))
module.excludeFolders += module.pathFactory.path(file("$buildDir/classes"))
module.excludeFolders += module.pathFactory.path(file("$buildDir/dependency-cache"))
module.excludeFolders += module.pathFactory.path(file("$buildDir/libs"))
module.excludeFolders += module.pathFactory.path(file("$buildDir/reports"))
module.excludeFolders += module.pathFactory.path(file("$buildDir/test-results"))
module.excludeFolders += module.pathFactory.path(file("$buildDir/tmp"))
module.excludeFolders += module.pathFactory.path(file("$buildDir/matrix"))
module.excludeFolders += module.pathFactory.path(file("$buildDir/resources"))
module.excludeFolders -= module.pathFactory.path(file("$buildDir"))
}
}
downloadSources = true
scopes.COMPILE.plus += configurations.provided
}
}
eclipse {
classpath {
plusConfigurations.add( configurations.provided )
}
}
// elements used to customize the generated POM used during upload
def pomConfig = {
name 'A Hibernate Core Module'
description 'A module of the Hibernate Core project'
url 'http://hibernate.org'
organization {
name 'Hibernate.org'
url 'http://hibernate.org'
}
issueManagement {
system 'jira'
url 'http://opensource.atlassian.com/projects/hibernate/browse/HHH'
}
scm {
url "http://github.com/hibernate/hibernate-core"
connection "scm:git:http://github.com/hibernate/hibernate-core.git"
developerConnection "scm:git:[email protected]:hibernate/hibernate-core.git"
}
licenses {
license {
name 'GNU Lesser General Public License'
url 'http://www.gnu.org/licenses/lgpl-2.1.html'
comments 'See discussion at http://hibernate.org/license for more details.'
distribution 'repo'
}
}
developers {
developer {
id 'hibernate-team'
name 'The Hibernate Development Team'
organization 'Hibernate.org'
organizationUrl 'http://hibernate.org'
}
}
}
subProject.ext.basePomConfig = pomConfig
configure(install.repositories.mavenInstaller) {
pom.project pomConfig
}
uploadArchives {
repositories.mavenDeployer {
name = 'jbossDeployer'
configuration = configurations.deployerJars
pom.project pomConfig
repository(id: "jboss-releases-repository", url: "https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/")
snapshotRepository(id: "jboss-snapshots-repository", url: "https://repository.jboss.org/nexus/content/repositories/snapshots")
}
}
task sourcesJar(type: Jar, dependsOn: compileJava) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives sourcesJar
}
uploadArchives.dependsOn sourcesJar
}
}
dependsOnChildren()
// This is a task that generates the gradlew scripts, allowing users to run gradle without having gradle installed
// on their system.
// This task should be run by "build master" and the resulting output committed to source control. Its outputs include:
// 1) /gradlew which is the *NIX shell script for executing builds
// 2) /gradlew.bat which is the windows bat script for for executing builds
// 3) /wrapper which is a directory named by the "jarPath" config which contains other needed files.
task wrapper(type: Wrapper) {
gradleVersion = '1.1'
}