apply from: JAVA_GRADLE
apply from: SPRING3_GRADLE
apply from: MAVEN_GRADLE

apply plugin: 'spring-io'

description = "Spring Session"

project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 1, project.configurations.getByName("integrationTestCompile"), Conf2ScopeMappingContainer.TEST)
project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 2, project.configurations.getByName("integrationTestRuntime"), Conf2ScopeMappingContainer.TEST)
check.dependsOn integrationTest

configurations {
	jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo
}

dependencies {
	compile "commons-logging:commons-logging:$commonsLoggingVersion"
	optional "org.springframework.data:spring-data-redis:$springDataRedisVersion",
			"com.hazelcast:hazelcast:$hazelcastVersion",
			"org.springframework.data:spring-data-gemfire:$springDataGemFireVersion",
			"org.springframework:spring-jdbc:$springVersion",
			"org.springframework.data:spring-data-mongodb:$springDataMongoVersion",
			"org.springframework:spring-context:$springVersion",
			"org.springframework:spring-web:$springVersion",
			"org.springframework:spring-messaging:$springVersion",
			"org.springframework:spring-websocket:$springVersion",
			"org.springframework.security:spring-security-core:$springSecurityVersion"
	provided "javax.servlet:javax.servlet-api:$servletApiVersion"
	integrationTestCompile "redis.clients:jedis:$jedisVersion",
			"org.apache.commons:commons-pool2:2.2",
			"com.hazelcast:hazelcast-client:$hazelcastVersion",
			"com.h2database:h2:$h2Version",
			"org.hsqldb:hsqldb:2.3.3",
			"org.apache.derby:derby:10.12.1.1",
			"de.flapdoodle.embed:de.flapdoodle.embed.mongo:1.50.2"

	integrationTestRuntime "org.springframework.shell:spring-shell:1.0.0.RELEASE"

	testCompile "junit:junit:$junitVersion",
			'org.mockito:mockito-core:1.10.19',
			"edu.umd.cs.mtc:multithreadedtc:1.01",
			"org.springframework:spring-test:$springVersion",
			"org.assertj:assertj-core:$assertjVersion",
			"org.springframework.security:spring-security-core:$springSecurityVersion"

	jacoco "org.jacoco:org.jacoco.agent:0.7.2.201409121644:runtime"

}

dependencyManagement {
	springIoTestRuntime {
		imports {
			mavenBom "io.spring.platform:platform-bom:${springIoVersion}"
		}
	}
}

ext.javadocLinks = [
		"http://docs.oracle.com/javase/8/docs/api/",
		"http://docs.oracle.com/javaee/7/api/",
		"http://docs.oracle.com/cd/E13222_01/wls/docs90/javadocs/",  // CommonJ
		"http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.javadoc.doc/web/apidocs/",
		"http://glassfish.java.net/nonav/docs/v3/api/",
		"http://docs.jboss.org/jbossas/javadoc/4.0.5/connector/",
		"http://docs.jboss.org/jbossas/javadoc/7.1.2.Final/",
		"http://commons.apache.org/proper/commons-lang/javadocs/api-2.5/",
		"http://commons.apache.org/proper/commons-codec/apidocs/",
		"http://commons.apache.org/proper/commons-dbcp/apidocs/",
		"http://portals.apache.org/pluto/portlet-2.0-apidocs/",
		"http://tiles.apache.org/tiles-request/apidocs/",
		"http://tiles.apache.org/framework/apidocs/",
		"http://aopalliance.sourceforge.net/doc/",
		"http://www.eclipse.org/aspectj/doc/released/aspectj5rt-api/",
		"http://quartz-scheduler.org/api/2.2.0/",
		"http://fasterxml.github.com/jackson-core/javadoc/2.3.0/",
		"http://fasterxml.github.com/jackson-databind/javadoc/2.3.0/",
		"http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/"
] as String[]

javadoc {
	description = "Generates project-level javadoc for use in -javadoc jar"

	options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
	options.author = true
	options.header = project.name
	options.links(project.ext.javadocLinks)

}

task sourcesJar(type: Jar, dependsOn: classes) {
	classifier = 'sources'
	from sourceSets.main.allSource
	// don't include or exclude anything explicitly by default. See SPR-12085.
}

task javadocJar(type: Jar) {
	classifier = "javadoc"
	from javadoc
}

artifacts {
	archives sourcesJar
	archives javadocJar
}

test {
	jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=${project.group}.*"
}
integrationTest {
	jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=${project.group}.*"
}
