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

apply plugin: 'java'
apply plugin: 'eclipse'

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

group = 'com.example'

sourceCompatibility = 1.8
targetCompatibility = 1.8

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

ext['spring-restdocs.version'] = '2.0.7.BUILD-SNAPSHOT'

configurations {
	asciidoctorExtensions
}

dependencies {
	asciidoctorExtensions "org.springframework.restdocs:spring-restdocs-asciidoctor:${project.ext['spring-restdocs.version']}"

	implementation 'io.projectreactor.netty:reactor-netty-http:1.0.15'
	implementation 'org.springframework:spring-context:5.3.14'
	implementation 'org.springframework:spring-webflux:5.3.14'

	testImplementation 'junit:junit:4.13.1'
	testImplementation 'org.springframework:spring-test:5.3.14'
	testImplementation "org.springframework.restdocs:spring-restdocs-webtestclient:${project.ext['spring-restdocs.version']}"
}

test {
	outputs.dir snippetsDir
}

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

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

eclipseJdt.onlyIf { false }
cleanEclipseJdt.onlyIf { false }
