Skip to content

Commit 88cfa78

Browse files
authored
Merge pull request #1 from hibernate/master
Pulling latest from hibernate-orm
2 parents dc44ef9 + b9b956c commit 88cfa78

File tree

2,630 files changed

+133049
-19657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,630 files changed

+133049
-19657
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/build
1212
*/build
1313
testdb
14+
lib
1415

1516
# IntelliJ specific files/directories
1617
out

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Guidelines for Contributing
2+
23
Contributions from the community are essential in keeping Hibernate (any Open Source
34
project really) strong and successful. While we try to keep requirements for
45
contributing to a minimum, there are a few guidelines we ask that you mind.
56

67
## Getting Started
8+
79
If you are just getting started with Git, GitHub and/or contributing to Hibernate via
810
GitHub there are a few pre-requisite steps.
911

@@ -18,13 +20,15 @@ the linked page, this also includes:
1820
or [Eclipse](https://community.jboss.org/wiki/ContributingToHibernateUsingEclipse).
1921

2022
## Create the working (topic) branch
23+
2124
Create a [topic branch](http://git-scm.com/book/en/Git-Branching-Branching-Workflows#Topic-Branches) on which you
2225
will work. The convention is to name the branch using the JIRA issue key. If there is not already a JIRA issue
2326
covering the work you want to do, create one. Assuming you will be working from the master branch and working
2427
on the JIRA HHH-123 : `git checkout -b HHH-123 master`
2528

2629

2730
## Code
31+
2832
Do yo thing!
2933

3034
## Commit
@@ -41,7 +45,8 @@ appreciated btw), please use rebasing rather than merging. Merging creates
4145
"merge commits" that really muck up the project timeline._
4246

4347
## Submit
48+
4449
* If you have not already, sign the [Contributor License Agreement](https://cla.jboss.org).
4550
* Push your changes to the topic branch in your fork of the repository.
46-
* Initiate a [pull request](http://help.github.com/send-pull-requests/)
51+
* Initiate a [pull request](http://help.github.com/articles/creating-a-pull-request)
4752
* Update the JIRA issue, adding a comment including a link to the created pull request

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ to applications and other components/libraries. It is also provides an implemen
66
JPA specification, which is the standardized Java specification for ORM. See
77
[Hibernate.org](http://hibernate.org/orm/) for additional information.
88

9-
[![Build Status](http://ci.hibernate.org/job/hibernate-orm-master-h2/badge/icon)](http://ci.hibernate.org/job/hibernate-orm-master-h2/)
9+
[![Build Status](http://ci.hibernate.org/job/hibernate-orm-master-h2-main/badge/icon)](http://ci.hibernate.org/job/hibernate-orm-master-h2-main/)
1010

1111

1212
Quickstart
@@ -16,7 +16,7 @@ Quickstart
1616
cd hibernate-orm
1717
./gradlew clean build
1818

19-
The build requires a Java 8 JDK as JAVA_HOME, but will ensure Java 6 compatibility.
19+
The build requires a Java 8 JDK as JAVA_HOME.
2020

2121

2222
Resources
@@ -84,7 +84,7 @@ Common Java related tasks
8484
-------------------------
8585

8686
* _build_ - Assembles (jars) and tests this project
87-
* _buildDependents_ - Assembles and tests this project and all projects that depend on it. So think of running this in hibernate-entitymanager, Gradle would assemble and test hibernate-entitymanager as well as hibernate-envers (because envers depends on entitymanager)
87+
* _buildDependents_ - Assembles and tests this project and all projects that depend on it. So think of running this in hibernate-core, Gradle would assemble and test hibernate-core as well as hibernate-envers (because envers depends on core)
8888
* _classes_ - Compiles the main classes
8989
* _testClasses_ - Compiles the test classes
9090
* _compile_ (Hibernate addition) - Performs all compilation tasks including staging resources from both main and test

build.gradle

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ import org.apache.tools.ant.filters.ReplaceTokens
77
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
88
*/
99

10-
apply plugin: 'eclipse'
11-
apply plugin: 'idea'
12-
apply from: "./libraries.gradle"
13-
apply from: "./databases.gradle"
14-
15-
1610
buildscript {
1711
repositories {
1812
mavenCentral()
@@ -37,6 +31,16 @@ buildscript {
3731
}
3832
}
3933

34+
plugins {
35+
id 'com.gradle.build-scan' version '1.3'
36+
id 'me.champeau.buildscan-recipes' version '0.1.7'
37+
}
38+
39+
apply plugin: 'eclipse'
40+
apply plugin: 'idea'
41+
apply from: "./libraries.gradle"
42+
apply from: "./databases.gradle"
43+
4044
allprojects {
4145
repositories {
4246
mavenCentral()
@@ -54,11 +58,16 @@ allprojects {
5458
}
5559

5660
ext {
57-
hibernateTargetVersion = '5.2.0-SNAPSHOT'
58-
expectedGradleVersion = '2.10'
61+
hibernateTargetVersion = '5.2.11-SNAPSHOT'
62+
expectedGradleVersion = '3.2.1'
5963
baselineJavaVersion = '1.8'
6064

6165
osgiExportVersion = hibernateTargetVersion.replaceAll( '-SNAPSHOT', '.SNAPSHOT' )
66+
67+
final String[] versionComponents = hibernateTargetVersion.split( '\\.' );
68+
hibernateFullVersion = hibernateTargetVersion
69+
hibernateMajorMinorVersion = versionComponents[0] + '.' + versionComponents[1]
70+
hibernateMajorVersion = versionComponents[0]
6271
}
6372

6473
idea {
@@ -78,6 +87,8 @@ def osgiDescription() {
7887
return "A module of the Hibernate O/RM project"
7988
}
8089

90+
buildDir = "target"
91+
8192
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8293

8394
subprojects { subProject ->
@@ -98,6 +109,10 @@ subprojects { subProject ->
98109
return;
99110
}
100111

112+
if ( subProject.name.startsWith( 'hibernate-orm-modules' ) ) {
113+
return;
114+
}
115+
101116
// everything below here in the closure applies to java projects
102117
apply plugin: 'java'
103118
apply plugin: 'maven-publish'
@@ -142,13 +157,30 @@ subprojects { subProject ->
142157

143158
testRuntime( libraries.log4j )
144159
testRuntime( libraries.javassist )
160+
testRuntime( libraries.byteBuddy )
161+
testRuntime( libraries.woodstox )
162+
163+
//Databases
145164
testRuntime( libraries.h2 )
146165
testRuntime( libraries.hsqldb )
147166
testRuntime( libraries.postgresql )
148167
testRuntime( libraries.mysql )
149168
testRuntime( libraries.mariadb )
150-
testRuntime( libraries.woodstox )
169+
testRuntime( libraries.mssql )
170+
testRuntime( libraries.informix )
151171

172+
if (db.equalsIgnoreCase("oracle")) {
173+
dependencies {
174+
testRuntime( libraries.oracle ) {
175+
exclude group: 'com.oracle.jdbc', module: 'xmlparserv2'
176+
}
177+
}
178+
}
179+
if (db.equalsIgnoreCase("db2")) {
180+
dependencies {
181+
testRuntime( libraries.db2 )
182+
}
183+
}
152184
// 6.6 gave me some NPE problems from within checkstyle...
153185
checkstyle 'com.puppycrawl.tools:checkstyle:6.5'
154186
}
@@ -165,6 +197,12 @@ subprojects { subProject ->
165197

166198
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167199
// compilation
200+
compileJava.options.encoding = 'UTF-8'
201+
202+
tasks.withType(JavaCompile) {
203+
options.encoding = 'UTF-8'
204+
}
205+
168206
task compile
169207
compile.dependsOn compileJava, processResources, compileTestJava, processTestResources
170208

@@ -226,10 +264,15 @@ subprojects { subProject ->
226264
into sourceSets.test.output.classesDir
227265
}
228266
copy {
229-
ext.targetDir = file( "${buildDir}/resources/test" )
230267
from file('src/test/resources')
231-
into targetDir
232-
filter( ReplaceTokens, tokens: dbBundle[db] );
268+
into file( "${buildDir}/resources/test" )
269+
exclude 'src/test/resources/arquillian.xml'
270+
exclude 'src/test/resources/hibernate.properties'
271+
}
272+
copy {
273+
from file('src/test/resources/hibernate.properties')
274+
into file( "${buildDir}/resources/test" )
275+
filter( ReplaceTokens, tokens: dbBundle[db] )
233276
}
234277
} )
235278
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -328,6 +371,14 @@ subprojects { subProject ->
328371
}
329372
// exclude generated java sources - by explicitly setting the base source dir
330373
checkstyleMain.source = 'src/main/java'
374+
375+
// define a second checkstyle task for checking non-fatal violations
376+
task nonFatalCheckstyle(type:Checkstyle) {
377+
source = subProject.sourceSets.main.java
378+
classpath = subProject.configurations.checkstyle
379+
showViolations = false
380+
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle-non-fatal.xml' )
381+
}
331382

332383
findbugs {
333384
sourceSets = [ subProject.sourceSets.main, subProject.sourceSets.test ]
@@ -396,6 +447,15 @@ task wrapper(type: Wrapper) {
396447
gradleVersion = expectedGradleVersion
397448
}
398449

450+
buildScan {
451+
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
452+
licenseAgree = 'yes'
453+
454+
recipe 'git-commit', baseUrl: 'https://github.com/hibernate/hibernate-orm/tree'
455+
}
456+
457+
458+
399459
def excludeAllLowLevelBugsExcept(String[] bugTypes){
400460
def writer = new StringWriter()
401461
def xml = new groovy.xml.MarkupBuilder(writer);

buildSrc/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ repositories {
2020

2121
apply plugin: "groovy"
2222

23+
buildDir = "target"
24+
2325
dependencies {
2426
compile gradleApi()
2527
compile localGroovy()
2628

2729
compile 'org.hibernate.build.gradle:gradle-animalSniffer-plugin:1.0.1.Final'
30+
compile 'org.hibernate.build.gradle:hibernate-matrix-testing:2.0.0-SNAPSHOT'
2831
}

buildSrc/src/main/groovy/org/hibernate/build/HibernateBuildPlugin.groovy

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,22 @@ import org.gradle.api.GradleException
1010
import org.gradle.api.JavaVersion
1111
import org.gradle.api.Plugin
1212
import org.gradle.api.Project
13+
import org.gradle.api.logging.Logger
14+
import org.gradle.api.logging.Logging
1315
import org.gradle.api.publish.PublishingExtension
1416
import org.gradle.api.publish.maven.MavenPublication
17+
import org.gradle.api.tasks.testing.Test
18+
19+
import org.hibernate.build.gradle.testing.database.DatabaseProfile
20+
import org.hibernate.build.gradle.testing.database.DatabaseProfilePlugin
21+
import org.hibernate.build.gradle.testing.matrix.MatrixTestingPlugin
1522

1623
/**
1724
* @author Steve Ebersole
1825
*/
1926
class HibernateBuildPlugin implements Plugin<Project> {
27+
private static final Logger log = Logging.getLogger( MatrixTestingPlugin.class);
28+
2029
@Override
2130
void apply(Project project) {
2231
if ( !JavaVersion.current().java8Compatible ) {
@@ -27,6 +36,35 @@ class HibernateBuildPlugin implements Plugin<Project> {
2736

2837
project.afterEvaluate {
2938
applyPublishing( publishingExtension, project )
39+
40+
applyMatrixTestTaskDependencies( project )
41+
}
42+
}
43+
44+
def applyMatrixTestTaskDependencies(Project project) {
45+
final MatrixTestingPlugin matrixTestingPlugin = project.plugins.findPlugin( MatrixTestingPlugin )
46+
if ( matrixTestingPlugin == null ) {
47+
// matrix testing was not applied on this project
48+
return;
49+
}
50+
51+
final DatabaseProfilePlugin databaseProfilePlugin = project.rootProject.plugins.apply( DatabaseProfilePlugin );
52+
if ( databaseProfilePlugin.databaseProfiles == null || databaseProfilePlugin.databaseProfiles.isEmpty() ) {
53+
// no db profiles defined -> nothing to do
54+
return;
55+
}
56+
57+
log.debug( "Project [${project.name}] applied matrix-testing and had db-profiles; checking test task for dependencies" )
58+
59+
// for each db profile, find its execution task and transfer any dependencies from test to it
60+
Test testTask = project.tasks.test
61+
if ( testTask.dependsOn.isEmpty() ) {
62+
return;
63+
}
64+
65+
databaseProfilePlugin.databaseProfiles.each { DatabaseProfile profile ->
66+
log.debug( "db-profile [${profile.name}] on project [${project.name}] : transfering dependencies from test task -> ${testTask.dependsOn}" )
67+
project.tasks.getByPath( "matrix_${profile.name}" ).dependsOn( testTask.dependsOn )
3068
}
3169
}
3270

@@ -97,7 +135,7 @@ class HibernateBuildPlugin implements Plugin<Project> {
97135

98136
// TEMPORARY : currently Gradle Publishing feature is exporting dependencies as 'runtime' scope,
99137
// rather than 'compile'; fix that.
100-
if ( asNode().dependencies != null ) {
138+
if ( asNode().dependencies != null && asNode().dependencies.size() > 0 ) {
101139
asNode().dependencies[0].dependency.each {
102140
it.scope[0].value = 'compile'
103141
}

0 commit comments

Comments
 (0)