plugins {
	id "java-gradle-plugin"
	id "java"
}

sourceCompatibility = JavaVersion.VERSION_17

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

ext {
	def propertiesFile = new File(new File("$projectDir").parentFile, "gradle.properties")
	propertiesFile.withInputStream {
		def properties = new Properties()
		properties.load(it)
		set("springBootVersion", properties["springBootVersion"])
		set("nativeBuildToolsVersion", properties["nativeBuildToolsVersion"])
	}
}

dependencies {
	implementation(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}"))
	implementation "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
	implementation("org.springframework:spring-core")
	implementation 'org.asciidoctor:asciidoctor-gradle-jvm:3.3.2'
	implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:4.29.0'
	implementation "org.graalvm.buildtools:native-gradle-plugin:${nativeBuildToolsVersion}"
}

gradlePlugin {
	plugins {
		modulePlugin {
			id = "org.springframework.shell.module"
			implementationClass = "org.springframework.shell.gradle.ModulePlugin"
		}
		starterPlugin {
			id = "org.springframework.shell.starter"
			implementationClass = "org.springframework.shell.gradle.StarterPlugin"
		}
		bomPlugin {
			id = "org.springframework.shell.bom"
			implementationClass = "org.springframework.shell.gradle.BomPlugin"
		}
		docsPlugin {
			id = "org.springframework.shell.docs"
			implementationClass = "org.springframework.shell.gradle.DocsPlugin"
		}
		distPlugin {
			id = "org.springframework.shell.root"
			implementationClass = "org.springframework.shell.gradle.RootPlugin"
		}
		samplePlugin {
			id = "org.springframework.shell.sample"
			implementationClass = "org.springframework.shell.gradle.SamplePlugin"
		}
	}
}
