[hibernate-commits] Hibernate SVN: r19792 - core/branches/gradle2.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Wed Jun 23 03:29:02 EDT 2010
Author: steve.ebersole at jboss.com
Date: 2010-06-23 03:29:02 -0400 (Wed, 23 Jun 2010)
New Revision: 19792
Modified:
core/branches/gradle2/build.gradle
Log:
added infrastructure for integration testing
Modified: core/branches/gradle2/build.gradle
===================================================================
--- core/branches/gradle2/build.gradle 2010-06-23 07:27:38 UTC (rev 19791)
+++ core/branches/gradle2/build.gradle 2010-06-23 07:29:02 UTC (rev 19792)
@@ -15,6 +15,59 @@
javaVersion = "1.5"
}
+// build a map of the dependency artifacts to use. Allows centralized definition of the version of artifacts to
+// use. In that respect it serves a role similar to <dependencyManagement> in Maven
+slf4jVersion = '1.5.8'
+
+libraries = [
+ // Ant
+ ant: 'ant:ant:1.6.5',
+
+ // Antlr
+ antlr: 'antlr:antlr:2.7.7',
+
+ // Annotations
+ commons_annotations:
+ 'org.hibernate:hibernate-commons-annotations:3.2.0.Final',
+
+ // CGLIB
+ cglib: 'cglib:cglib:2.2',
+
+ // Jakarta commons-collections; todo : get rid of commons-collections dependency
+ commons_collections:
+ 'commons-collections:commons-collections:3.1',
+
+ // Dom4J
+ dom4j: 'dom4j:dom4j:1.6.1 at jar',
+
+ // h2
+ h2: 'com.h2database:h2:1.2.134',
+
+ // Javassist
+ javassist: 'javassist:javassist:3.12.0.GA',
+
+ // javax
+ jpa: 'org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.0.Final',
+ jta: 'javax.transaction:jta:1.1',
+ validation: 'javax.validation:validation-api:1.0.0.GA',
+ validator: 'org.hibernate:hibernate-validator:4.0.2.GA',
+ jacc: 'org.jboss.javaee:jboss-jacc-api:1.1.0.GA',
+
+ // logging
+ slf4j_api: 'org.slf4j:slf4j-api:' + slf4jVersion,
+ slf4j_log4j: 'org.slf4j:slf4j-log4j12:' + slf4jVersion,
+ jcl_slf4j: 'org.slf4j:jcl-over-slf4j:' + slf4jVersion,
+ jcl_api: 'commons-logging:commons-logging-api:99.0-does-not-exist',
+ jcl: 'commons-logging:commons-logging:99.0-does-not-exist',
+
+ // testing
+ junit: 'junit:junit:3.8.2',
+ testng: 'org.testng:testng:5.8:jdk15',
+ jpa_modelgen: 'org.hibernate:hibernate-jpamodelgen:1.0.0.Final',
+ shrinkwrap_api: 'org.jboss.shrinkwrap:shrinkwrap-api:1.0.0-alpha-6',
+ shrinkwrap: 'org.jboss.shrinkwrap:shrinkwrap-impl-base:1.0.0-alpha-6'
+]
+
subprojects { subProject ->
group = 'org.hibernate.gradlePoC'
version = '1.0.0-SNAPSHOT'
@@ -34,8 +87,10 @@
}
else {
apply plugin: 'java'
- defaultTasks 'classes'
+ apply plugin: 'maven' // for install task as well as deploy dependencies
+ defaultTasks 'build'
+
configurations {
provided {
// todo : need to make sure these are non-exported
@@ -43,39 +98,22 @@
}
}
+ // appropriately inject the common dependencies into each sub-project
dependencies {
- slf4jVersion = '1.5.8'
- dom4jVersion = '1.6.1'
- antlrVersion = '2.7.7'
- annotationsCommonsVersion = '3.2.0.Final'
- jpaVersion = '1.0.0.Final'
- jtaVersion = '1.1'
- javassistVersion = '3.12.0.GA'
- cglibVersion = '2.2'
- javaxValidationVersion = '1.0.0.GA'
- hibernateValidatorVersion = '4.0.2.GA'
-
- junitVersion = '3.8.2'
- testngVersion = '5.8'
-
- h2Version = '1.2.134'
-
- compile(
- group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
- )
- testCompile(
- [group: 'junit', name: 'junit', version: junitVersion]
- )
- testRuntime(
- [group: 'org.slf4j', name: 'jcl-over-slf4j', version: slf4jVersion],
- [group: 'org.slf4j', name: 'slf4j-log4j12', version: slf4jVersion],
- [group: 'com.h2database', name: 'h2', version: h2Version]
- )
+ compile( libraries.slf4j_api )
+ testCompile( libraries.junit )
+ testRuntime( libraries.slf4j_log4j ) {
+ transitive = true
+ }
+ testRuntime( libraries.jcl_slf4j )
+ testRuntime( libraries.jcl_api )
+ testRuntime( libraries.jcl )
+ testRuntime( libraries.h2 )
}
sourceSets {
main {
- compileClasspath = compileClasspath + configurations.provided
+ compileClasspath += configurations.provided
}
}
@@ -88,31 +126,77 @@
)
compileJava {
- if (hasProperty('jdk15_home')) { options.fork(executable: "$jdk15_home/bin/javac") }
+ // by default, use jdk 1.5
+ options.fork( executable: subProject.java5Home.getJavacExecutable() )
}
compileTestJava {
- if (hasProperty('jdk15_home')) { options.fork(executable: "$jdk15_home/bin/javac") }
+ // by default, use jdk 1.5
+ options.fork( executable: subProject.java5Home.getJavacExecutable() )
}
test {
- ignoreFailures = true
+// ignoreFailures = true
+ executable = subProject.java5Home.getJavaExecutable()
+ environment['hibernate.test.validatefailureexpected'] = true
+ maxHeapSize = "1024m"
}
+ processTestResources.doLast(
+ {
+ copy {
+ from( sourceSets.test.java.srcDirs ) {
+ include '**/*.properties'
+ include '**/*.xml'
+ }
+ into sourceSets.test.classesDir
+ }
+ }
+ )
+
+ assemble.doLast( { install } )
+ uploadArchives.dependsOn install
+
// by default, compile to 1.5 compatibility
targetCompatibility = "1.5"
sourceCompatibility = "1.5"
ideaModule {
downloadJavadoc = false
- scopes.COMPILE.plus.add(configurations.provided)
+ scopes.COMPILE.plus.add( configurations.provided )
+ outputDir = subProject.sourceSets.main.classesDir
+ testOutputDir = subProject.sourceSets.test.classesDir
+ whenConfigured { module ->
+ module.dependencies*.exported = true
+ }
}
}
}
dependsOnChildren()
+// Work around for http://jira.codehaus.org/browse/GRADLE-990
+gradle.beforeProject { project ->
+ if ( 'hibernate-core' != project.name ) {
+ project.evaluationDependsOn( ':hibernate-core' )
+ }
+}
+gradle.afterProject { project ->
+ // if the sub-project contains integration tests, inject dependencies into those configurations too
+ if ( project.plugins.findPlugin( org.hibernate.gradle.util.IntegrationTestPlugin.class ) ) {
+ project.dependencies {
+ intgTestCompile( libraries.junit )
+ intgTestRuntime( libraries.slf4j_log4j ) {
+ transitive = true
+ }
+ intgTestRuntime( libraries.jcl_slf4j )
+ intgTestRuntime( libraries.jcl_api )
+ intgTestRuntime( libraries.jcl )
+ }
+ }
+}
+
task wrapper(type: Wrapper) {
gradleVersion = '0.9-preview-3'
jarPath = 'gradle'
More information about the hibernate-commits
mailing list