plugins {
	id "java-gradle-plugin"
	id "java"
	id "groovy"
	id 'com.apollographql.apollo' version '2.4.5'
}

sourceCompatibility = JavaVersion.VERSION_17

repositories {
	gradlePluginPortal()
	mavenCentral()
	maven { url 'https://repo.spring.io/plugins-release/' }
}

sourceSets {
	main {
		java {
			srcDirs = []
		}
		groovy {
			srcDirs += ["src/main/java"]
		}
	}
}

gradlePlugin {
	plugins {
		checkAntoraVersion {
			id = "org.springframework.antora.check-version"
			implementationClass = "org.springframework.gradle.antora.AntoraVersionPlugin"
		}
		trang {
			id = "trang"
			implementationClass = "trang.TrangPlugin"
		}
		locks {
			id = "locks"
			implementationClass = "lock.GlobalLockPlugin"
		}
		managementConfiguration {
			id = "io.spring.convention.management-configuration"
			implementationClass = "io.spring.gradle.convention.ManagementConfigurationPlugin"
		}
		updateDependencies {
			id = "org.springframework.security.update-dependencies"
			implementationClass = "org.springframework.security.convention.versions.UpdateDependenciesPlugin"
		}
		updateProjectVersion {
			id = "org.springframework.security.update-version"
			implementationClass = "org.springframework.security.convention.versions.UpdateProjectVersionPlugin"
		}
		sagan {
			id = "org.springframework.security.sagan"
			implementationClass = "org.springframework.gradle.sagan.SaganPlugin"
		}
		githubMilestone {
			id = "org.springframework.github.milestone"
			implementationClass = "org.springframework.gradle.github.milestones.GitHubMilestonePlugin"
		}
		githubChangelog {
			id = "org.springframework.github.changelog"
			implementationClass = "org.springframework.gradle.github.changelog.GitHubChangelogPlugin"
		}
		githubRelease {
			id = "org.springframework.github.release"
			implementationClass = "org.springframework.gradle.github.release.GitHubReleasePlugin"
		}
		s101 {
			id = "s101"
			implementationClass = "s101.S101Plugin"
		}
	}
}

configurations {
	implementation {
		exclude module: 'groovy-all'
	}
}

dependencies {
	implementation 'com.google.code.gson:gson:2.8.6'
	implementation 'com.thaiopensource:trang:20091111'
	implementation 'net.sourceforge.saxon:saxon:9.1.0.8'
	implementation 'org.yaml:snakeyaml:1.30'
	implementation localGroovy()

	implementation 'io.github.gradle-nexus:publish-plugin:1.1.0'
	implementation 'io.projectreactor:reactor-core:3.5.0-M6'
	implementation 'org.gretty:gretty:4.0.3'
	implementation 'com.apollographql.apollo:apollo-runtime:2.4.5'
	implementation 'com.github.ben-manes:gradle-versions-plugin:0.38.0'
	implementation 'com.github.spullara.mustache.java:compiler:0.9.4'
	implementation 'io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.15'
	implementation 'io.spring.nohttp:nohttp-gradle:0.0.10'
	implementation 'net.sourceforge.htmlunit:htmlunit:2.37.0'
	implementation 'org.hidetake:gradle-ssh-plugin:2.10.1'
	implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:4.29.0'
	implementation 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1'

	testImplementation platform('org.junit:junit-bom:5.9.1')
	testImplementation "org.junit.jupiter:junit-jupiter-api"
	testImplementation "org.junit.jupiter:junit-jupiter-params"
	testImplementation "org.junit.jupiter:junit-jupiter-engine"
	testImplementation 'org.apache.commons:commons-io:1.3.2'
	testImplementation 'org.assertj:assertj-core:3.13.2'
	testImplementation 'org.mockito:mockito-core:3.12.4'
	testImplementation 'org.mockito:mockito-junit-jupiter:3.12.4'
	testImplementation "com.squareup.okhttp3:mockwebserver:3.14.9"
}


tasks.named('test', Test).configure {
	onlyIf { !project.hasProperty("buildSrc.skipTests") }
	useJUnitPlatform()
	jvmArgs(
			'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
			'--add-opens', 'java.base/java.util=ALL-UNNAMED'
	)
}
