plugins {
	id "eclipse"
	id "java"
	id "org.asciidoctor.jvm.convert" version "3.3.2"
}

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')
}

configurations {
	asciidoctorExtensions
}

dependencies {
	asciidoctorExtensions "org.springframework.restdocs:spring-restdocs-asciidoctor:$restdocsVersion"

	implementation "org.springframework:spring-webmvc:6.0.0-SNAPSHOT"

	testImplementation "org.springframework.restdocs:spring-restdocs-mockmvc:$restdocsVersion"
	testImplementation "org.testng:testng:6.9.10"
}

test {
	useTestNG()
	outputs.dir snippetsDir
}

asciidoctor {
	configurations "asciidoctorExtensions"
	inputs.dir snippetsDir
	dependsOn test
}

jar {
	dependsOn asciidoctor
	from ("${asciidoctor.outputDir}/html5") {
		into 'static/docs'
	}
}
