plugins {
	id 'java-library'
}
ext.artifactId = project.artifactIdTestLib
version = rootProject.spotlessChangelog.versionNext
apply from: rootProject.file('gradle/java-setup.gradle')

dependencies {
	api projects.lib
	api files(project(projects.lib.path).sourceSets.sortPom.output.classesDirs)
	api "com.diffplug.durian:durian-core:${VER_DURIAN}"
	api "com.diffplug.durian:durian-testlib:${VER_DURIAN}"
	api "org.junit.jupiter:junit-jupiter:${VER_JUNIT}"
	api "org.assertj:assertj-core:${VER_ASSERTJ}"
	api "org.mockito:mockito-core:$VER_MOCKITO"
	api "com.diffplug.selfie:selfie-lib:${VER_SELFIE}"
	api "com.diffplug.selfie:selfie-runner-junit5:${VER_SELFIE}"
	runtimeOnly "org.junit.platform:junit-platform-launcher"

	implementation "com.diffplug.durian:durian-io:${VER_DURIAN}"
	implementation "com.diffplug.durian:durian-collect:${VER_DURIAN}"
	implementation "org.eclipse.jgit:org.eclipse.jgit:${VER_JGIT}"
	implementation gradleTestKit()
}

// we'll hold the testlib to a low standard (prize brevity)
spotbugs {
	// LOW|MEDIUM|DEFAULT|HIGH (low = sensitive to even minor mistakes).
	reportLevel = com.github.spotbugs.snom.Confidence.valueOf('HIGH')
}

apply from: rootProject.file('gradle/special-tests.gradle')
tasks.withType(Test).configureEach {
	if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) {
		// for Antlr4FormatterStepTest, KtfmtStepTest, and KtLintStepTest
		def args = [
			'--add-opens=java.base/java.lang=ALL-UNNAMED',
			'--add-opens=java.base/java.util=ALL-UNNAMED',
		]
		jvmArgs args
	}
}

javadoc {
	options.addStringOption('Xdoclint:none', '-quiet')
	options.addStringOption('Xwerror', '-quiet')
}

