buildscript {
	repositories {
		mavenCentral()
		maven { url "https://repo.spring.io/snapshot" }
		maven { url "https://repo.spring.io/milestone" }
	}
}

apply plugin: 'groovy'
apply plugin: 'spring-cloud-contract'
apply plugin: 'maven-publish'

group = 'org.springframework.cloud.testprojects'
sourceCompatibility = 17
targetCompatibility = 17

ext {
	restAssuredVersion = '3.0.7'

	contractsDir = file("repository/mappings")
	stubsOutputDirRoot = file("${project.buildDir}/production/${project.name}-stubs/repository/")
}

repositories {
	mavenCentral()
	mavenLocal()
	maven { url "https://repo.spring.io/snapshot" }
	maven { url "https://repo.spring.io/milestone" }
}

dependencies {
	implementation "org.springframework:spring-web"
	implementation "org.springframework:spring-context-support"
	implementation "org.apache.groovy:groovy-all:${groovyVersion}"
	implementation 'com.jayway.jsonpath:json-path-assert:2.2.0'

	testImplementation "com.github.tomakehurst:wiremock:${wiremockVersion}"
	testImplementation "com.toomuchcoding.jsonassert:jsonassert:${jsonAssertVersion}"
	testImplementation("org.spockframework:spock-spring:1.0-groovy-2.4") {
		exclude(group: 'org.apache.groovy')
	}
	testImplementation "io.restassured:rest-assured:$restAssuredVersion"
	testImplementation "io.restassured:spring-mock-mvc:$restAssuredVersion"
	testImplementation "ch.qos.logback:logback-classic:1.1.2"
	testImplementation "org.springframework.cloud:spring-cloud-contract-verifier:${verifierVersion}"
}

contracts {
	contractsMode = "REMOTE"
	baseClassForTests = 'org.springframework.cloud.contract.verifier.twitter.places.BaseMockMvcSpec'
	basePackageForTests = 'contracts'
	contractsDslDir = contractsDir
//	generatedTestSourcesDir = file("${project.rootDir}/src/test/groovy/")
	stubsOutputDir = stubsOutputDirRoot
	testFramework = 'Spock'
}

project.tasks.named("generateContractTests").get().dependsOn project.tasks.named("generateClientStubs")

test {
	testLogging {
		exceptionFormat = 'full'
	}
}
