plugins {
	id "java"
}

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

group = 'com.example'

sourceCompatibility = 17
targetCompatibility = 17

ext {
	restdocsVersion = '3.0.0-SNAPSHOT'
	snippetsDir = file('build/generated-snippets')
}

ext['spring-restdocs.version'] = '3.0.0-SNAPSHOT'

dependencies {
	implementation "com.fasterxml.jackson.core:jackson-databind:2.12.5"
	implementation "jakarta.servlet:jakarta.servlet-api:5.0.0"
	implementation "org.hibernate.validator:hibernate-validator:7.0.0.Final"
	implementation "org.hibernate:hibernate-core-jakarta:5.5.7.Final"
	implementation "org.springframework:spring-webmvc:6.0.0-SNAPSHOT"
	implementation "org.springframework.data:spring-data-jpa:3.0.0-SNAPSHOT"
	implementation "org.springframework.data:spring-data-rest-webmvc:4.0.0-SNAPSHOT"

	runtimeOnly 'com.h2database:h2:1.4.200'
	runtimeOnly 'org.atteo:evo-inflector:1.2.1'

	testImplementation 'com.jayway.jsonpath:json-path:2.6.0'
	testImplementation 'junit:junit:4.12'
	testImplementation 'org.assertj:assertj-core:3.21.0'
	testImplementation 'org.hamcrest:hamcrest-library:2.2'
	testImplementation "org.springframework.restdocs:spring-restdocs-mockmvc:$restdocsVersion"

	testRuntimeOnly 'org.glassfish:jakarta.el:4.0.2'
}

test {
	outputs.dir snippetsDir
}

task(bundleInstall, type: Exec) {
	workingDir file('slate')
	executable 'bundle'
	args 'install'
}

task(slate, type: Exec) {
	dependsOn 'bundleInstall', 'test'
	workingDir file('slate')
	executable 'bundle'
	args 'exec', 'middleman', 'build'
}

build {
	dependsOn 'slate'
}
