hibernate-orm/build.gradle

364 lines
14 KiB
Groovy
Raw Normal View History

2010-10-08 21:20:10 -04:00
apply plugin: 'eclipse'
apply plugin: 'idea'
allprojects {
repositories {
mavenCentral()
mavenLocal()
mavenRepo name: 'jboss-nexus', url: "https://repository.jboss.org/nexus/content/groups/public/"
mavenRepo name: "jboss-snapshots", url: "http://snapshots.jboss.org/maven2/"
2010-10-08 21:20:10 -04:00
}
}
buildscript {
repositories {
mavenCentral()
mavenLocal()
mavenRepo name: 'jboss-nexus', url: "https://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'
}
}
hibernateTargetVersion = '4.2.0-SNAPSHOT'
idea {
project {
jdkName = "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"
}
2010-10-08 21:20:10 -04:00
}
// 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
2011-06-13 08:31:52 -04:00
slf4jVersion = '1.6.1'
junitVersion = '4.10'
h2Version = '1.2.145'
bytemanVersion = '1.5.2'
2010-10-08 21:20:10 -04:00
libraries = [
// Ant
2011-09-14 02:25:12 -04:00
ant: 'org.apache.ant:ant:1.8.2',
2010-10-08 21:20:10 -04:00
// Antlr
antlr: 'antlr:antlr:2.7.7',
// Annotations
commons_annotations:
'org.hibernate.common:hibernate-commons-annotations:4.0.1.Final@jar',
2011-09-06 02:29:38 -04:00
jandex: 'org.jboss:jandex:1.0.3.Final',
2011-08-04 11:26:12 -04:00
classmate: 'com.fasterxml:classmate:0.5.4',
2010-10-08 21:20:10 -04:00
// Dom4J
dom4j: 'dom4j:dom4j:1.6.1@jar',
// Javassist
javassist: 'org.javassist:javassist:3.15.0-GA',
2010-10-08 21:20:10 -04:00
// javax
jpa: 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Draft-7plus',
2011-09-25 12:29:13 -04:00
jta: 'org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:1.0.0.Final',
2010-10-08 21:20:10 -04:00
validation: 'javax.validation:validation-api:1.0.0.GA',
2011-09-13 04:46:38 -04:00
jacc: 'org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:1.0.0.Final',
2010-10-08 21:20:10 -04:00
// logging
logging: 'org.jboss.logging:jboss-logging:3.1.0.GA',
logging_processor: 'org.jboss.logging:jboss-logging-processor:1.0.0.Final',
// jaxb task
2012-07-16 05:06:29 -04:00
jaxb: 'com.sun.xml.bind:jaxb-xjc:2.2.5',
jaxb2_basics: 'org.jvnet.jaxb2_commons:jaxb2-basics:0.6.3',
jaxb2_ant: 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.3',
jaxb2_jaxb: 'org.jvnet.jaxb2_commons:jaxb2-basics-jaxb:2.2.4-1',
2012-07-16 05:21:59 -04:00
jaxb2_jaxb_xjc: 'org.jvnet.jaxb2_commons:jaxb2-basics-jaxb-xjc:2.2.4-1',
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ testing
// logging for testing
2012-03-07 22:10:40 -05:00
slf4j_api: "org.slf4j:slf4j-api:${slf4jVersion}",
slf4j_log4j12: "org.slf4j:slf4j-log4j12:${slf4jVersion}",
jcl_slf4j: "org.slf4j:jcl-over-slf4j:${slf4jVersion}",
2010-10-08 21:20:10 -04:00
jcl_api: 'commons-logging:commons-logging-api:99.0-does-not-exist',
jcl: 'commons-logging:commons-logging:99.0-does-not-exist',
junit: "junit:junit:${junitVersion}",
byteman: "org.jboss.byteman:byteman:${bytemanVersion}",
byteman_install: "org.jboss.byteman:byteman-install:${bytemanVersion}",
byteman_bmunit: "org.jboss.byteman:byteman-bmunit:${bytemanVersion}",
2012-06-07 17:12:32 -04:00
jpa_modelgen: 'org.hibernate:hibernate-jpamodelgen:1.2.0.Final',
shrinkwrap_api: 'org.jboss.shrinkwrap:shrinkwrap-api:1.0.0-beta-6',
shrinkwrap: 'org.jboss.shrinkwrap:shrinkwrap-impl-base:1.0.0-beta-6',
validator: 'org.hibernate:hibernate-validator:4.2.0.Final',
h2: "com.h2database:h2:${h2Version}"
2010-10-08 21:20:10 -04:00
]
subprojects { subProject ->
apply plugin: 'idea'
apply plugin: 'eclipse'
defaultTasks 'build'
2010-10-08 21:20:10 -04:00
group = 'org.hibernate'
version = rootProject.hibernateTargetVersion
2010-10-08 21:20:10 -04:00
// 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'
2010-10-08 21:20:10 -04:00
apply plugin: 'maven' // for install task as well as deploy dependencies
apply plugin: 'uploadAuth'
2010-10-08 21:20:10 -04:00
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'
}
2010-10-08 21:20:10 -04:00
}
toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar")
2010-10-08 21:20:10 -04:00
// appropriately inject the common dependencies into each sub-project
dependencies {
compile( libraries.logging )
2010-10-08 21:20:10 -04:00
testCompile( libraries.junit )
testCompile( libraries.byteman )
testCompile( libraries.byteman_install )
testCompile( libraries.byteman_bmunit )
testCompile files( toolsJar )
testRuntime( libraries.slf4j_api )
testRuntime( libraries.slf4j_log4j12 )
2010-10-08 21:20:10 -04:00
testRuntime( libraries.jcl_slf4j )
testRuntime( libraries.jcl_api )
testRuntime( libraries.jcl )
testRuntime( libraries.javassist )
2010-10-08 21:20:10 -04:00
testRuntime( libraries.h2 )
jbossLoggingTool( libraries.logging_processor )
hibernateJpaModelGenTool( libraries.jpa_modelgen )
jaxb( libraries.jaxb )
jaxb( libraries.jaxb2_basics )
jaxb( libraries.jaxb2_ant )
2012-07-16 05:06:29 -04:00
jaxb( libraries.jaxb2_jaxb )
jaxb( libraries.jaxb2_jaxb_xjc )
deployerJars "org.apache.maven.wagon:wagon-http:1.0"
2010-10-08 21:20:10 -04:00
}
aptDumpDir = subProject.file( "${buildDir}/tmp/apt" )
sourceSets.main {
compileClasspath += configurations.provided
2010-10-08 21:20:10 -04:00
}
sourceSets.all {
originalJavaSrcDirs = java.srcDirs
generatedLoggingSrcDir = file( "${buildDir}/generated-src/logging/${name}" )
java.srcDir generatedLoggingSrcDir
}
task generateMainLoggingClasses(type: Compile) {
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()
}
}
// 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"])
2010-10-08 21:20:10 -04:00
manifest.mainAttributes(
provider: 'gradle',
'Implementation-Url': 'http://hibernate.org',
'Implementation-Version': version,
'Implementation-Vendor': 'Hibernate.org',
'Implementation-Vendor-Id': 'org.hibernate'
)
tasks.withType(Test) {
System.getProperties().each { Map.Entry entry ->
if ( entry.key.startsWith( 'hibernate.') ) {
systemProperty entry.key, entry.value
}
}
2010-10-08 21:20:10 -04:00
maxHeapSize = "1024m"
}
processTestResources.doLast( {
copy {
from( sourceSets.test.java.srcDirs ) {
include '**/*.properties'
include '**/*.xml'
2010-10-08 21:20:10 -04:00
}
into sourceSets.test.output.classesDir
}
} )
2010-10-08 21:20:10 -04:00
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"))
2012-02-20 03:36:18 -05:00
module.excludeFolders += module.pathFactory.path(file("$buildDir/resources"))
module.excludeFolders -= module.pathFactory.path(file("$buildDir"))
}
}
downloadSources = true
scopes.COMPILE.plus += configurations.provided
2010-10-08 21:20:10 -04:00
}
}
eclipse {
classpath {
plusConfigurations.add( configurations.provided )
}
}
// elements used to customize the generated POM used during upload
def pomConfig = {
2011-06-08 23:39:07 -04:00
name 'A Hibernate Core Module'
2011-06-08 23:43:35 -04:00
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:git@github.com: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 {
2011-06-08 23:39:07 -04:00
developer {
id 'hibernate-team'
name 'The Hibernate Development Team'
organization 'Hibernate.org'
organizationUrl 'http://hibernate.org'
}
}
}
subProject.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
}
2011-06-22 12:24:06 -04:00
uploadArchives.dependsOn sourcesJar
2010-10-08 21:20:10 -04:00
}
2010-10-08 21:20:10 -04:00
}
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) {
2012-02-28 03:47:34 -05:00
gradleVersion = '1.0-milestone-8a'
}