hibernate-orm/hibernate-infinispan/hibernate-infinispan.gradle

92 lines
3.1 KiB
Groovy

/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
configurations {
all*.exclude group: 'org.jboss.logging', module: 'jboss-logging-spi'
}
if ( project.hasProperty( 'overrideInfinispanVersionForTesting' ) ) {
println 'Overrriding Infinispan version to test vs Infinispan version: ' + overrideInfinispanVersionForTesting
configurations.testRuntime.resolutionStrategy.force 'org.infinispan:infinispan-core:' + overrideInfinispanVersionForTesting
}
apply plugin: 'java'
project.javaTarget.version '1.8'
dependencies {
compile project( ':hibernate-core' )
compile( libraries.infinispan )
testCompile project( ':hibernate-testing' )
testCompile project( ':hibernate-entitymanager' )
testCompile( libraries.infinispan_test )
testCompile( libraries.jboss_common_core )
testCompile( libraries.jnp_client )
testCompile( libraries.jnp_server )
testCompile( libraries.mockito )
testCompile ('mysql:mysql-connector-java:5.1.17')
}
mavenPom {
name = 'Hibernate/Infinispan Integration'
description = 'Integration for Infinispan into Hibernate as a second-level caching service'
}
def osgiDescription() {
return mavenPom.description
}
classes.doLast {
javaexec {
classpath = project.sourceSets.main.runtimeClasspath
main = "org.infinispan.factories.components.ComponentMetadataPersister"
args = [
project.sourceSets.main.output.classesDir,
project.sourceSets.main.output.resourcesDir.toPath().resolve("hibernate-infinispan-component-metadata.dat").toString()
].toList()
standardOutput = { def f = File.createTempFile('metadata-log', null ); f.deleteOnExit(); f.newOutputStream() }()
}
}
test {
systemProperties['java.net.preferIPv4Stack'] = true
systemProperties['jgroups.ping.timeout'] = 500
systemProperties['jgroups.ping.num_initial_members'] = 1
systemProperties['jgroups.udp.enable_bundling'] = false
systemProperties['jgroups.bind_addr'] = 'localhost'
// Use Infinispan's test JGroups stack that uses TEST_PING
systemProperties['hibernate.cache.infinispan.jgroups_cfg'] = '2lc-test-tcp.xml'
if (project.hasProperty('log4jconfig')) {
systemProperties['log4j.configuration'] = log4jconfig
}
enabled = project.hasProperty('testInfinispan')
if (project.hasProperty('debugInfinispan')) {
jvmArgs += '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005'
enabled = true;
}
// Without this I have trouble running specific test using --tests switch
doFirst {
filter.includePatterns.each {
include "${it.replaceAll('\\.', "\\${File.separator}")}.class"
}
filter.setIncludePatterns('*')
}
}
task packageTests(type: Jar) {
from sourceSets.test.output
classifier = 'tests'
}
task sourcesTestJar(type: Jar, dependsOn:classes) {
from sourceSets.test.allSource
classifier = 'test-sources'
}
artifacts.archives packageTests
artifacts.archives sourcesTestJar