buildscript {
	repositories {
		maven { url "https://repo.spring.io/plugins-release" }
	}
	dependencies {
		classpath 'io.spring.gradle:dependency-management-plugin:1.0.0.RC2'
		classpath("com.bmuschko:gradle-tomcat-plugin:2.2.5")
		classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
		classpath("io.spring.gradle:spring-io-plugin:0.0.6.RELEASE")
		classpath('me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1')
		classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
		classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0'
	}
}

plugins {
	id "org.sonarqube" version "2.1"
	id "io.spring.dependency-management" version "1.0.0.RC2"
}

group = 'org.springframework.session'

ext.springBootVersion = '2.0.0.BUILD-SNAPSHOT'
ext.IDE_GRADLE = "$rootDir/gradle/ide.gradle"
ext.JAVA_GRADLE = "$rootDir/gradle/java.gradle"
ext.SPRING3_GRADLE = "$rootDir/gradle/spring3.gradle"
ext.MAVEN_GRADLE = "$rootDir/gradle/publish-maven.gradle"
ext.BOM_GRADLE = "$rootDir/gradle/bom.gradle"
ext.SAMPLE_GRADLE = "$rootDir/gradle/sample.gradle"
ext.TOMCAT_GRADLE = "$rootDir/gradle/tomcat.gradle"
ext.TOMCAT_6_GRADLE = "$rootDir/gradle/tomcat6.gradle"
ext.TOMCAT_7_GRADLE = "$rootDir/gradle/tomcat7.gradle"

ext.releaseBuild = version.endsWith('RELEASE')
ext.snapshotBuild = version.endsWith('SNAPSHOT')
ext.milestoneBuild = !(releaseBuild || snapshotBuild)

apply plugin: 'base'
apply from: JAVA_GRADLE

dependencyManagement {
	imports {
		mavenBom "org.springframework.data:spring-data-releasetrain:$springDataReleaseTrainVersion"
	}
}

def managedVersions = dependencyManagement.managedVersions

//println "ManagedVersions Count: " + managedVersions.size()
//managedVersions.each { entry -> println entry }

ext.springDataGemFireVersion = managedVersions['org.springframework.data:spring-data-gemfire']
ext.springDataMongoDBVersion = managedVersions['org.springframework.data:spring-data-mongodb']
ext.springDataRedisVersion = managedVersions['org.springframework.data:spring-data-redis']

sonarqube {
	properties {
		property "sonar.java.coveragePlugin", "jacoco"
		property "sonar.projectName", "Spring Session"
		property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
		property "sonar.links.homepage", 'https://github.com/spring-projects/spring-session'
		property "sonar.links.ci", 'https://build.spring.io/browse/SESSION'
		property "sonar.links.issue", 'https://github.com/spring-projects/spring-session/issues'
		property "sonar.links.scm", 'https://github.com/spring-projects/spring-session'
		property "sonar.links.scm_dev", 'https://github.com/spring-projects/spring-session.git'
		property "sonar.java.coveragePlugin", "jacoco"
	}
}

task configDocsZip(dependsOn: [':docs:asciidoctor',':spring-session:javadoc']) {
	doLast {
		project.tasks.docsZip.from(project(':docs').asciidoctor) {
			into('reference')
		}
		project.tasks.docsZip.from(project(':spring-session').javadoc) {
			into('api')
		}
	}
}


task docsZip(type: Zip, dependsOn: 'configDocsZip') {
	group = "Distribution"
	baseName = "spring-session"
	classifier = "docs"
	description = "Builds -${classifier} archive containing api and reference " +
			"for deployment."
}

artifacts {
	archives docsZip
}
