plugins {
	id 'org.springframework.boot' version '3.0.6'
	id 'io.spring.dependency-management' version '1.1.0'
	id 'org.graalvm.buildtools.native' version '0.9.20'
	id 'io.spring.build.runtimehints-agent'
	id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

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

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-web'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'

	implementation 'org.springframework:spring-core'
	testImplementation("org.springframework:spring-core-test")

	implementation(platform("org.springframework:spring-framework-bom:6.0.0-RC4"))

	testImplementation("org.springframework:spring-core-test")
	testImplementation("org.assertj:assertj-core:3.23.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.platform:junit-platform-suite-api")
	testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
	testRuntimeOnly("org.junit.platform:junit-platform-launcher")
	testRuntimeOnly("org.junit.platform:junit-platform-suite-engine")
}

tasks.named('test') {
	useJUnitPlatform()
}

tasks.named('bootBuildImage') {
	if (!project.hasProperty('native')) {
		builder = 'paketobuildpacks/builder:tiny'
		environment = ['BP_NATIVE_IMAGE': 'false']
	} else {
		if(project.hasProperty('x86')){
			buildpacks =  ['gcr.io/paketo-buildpacks/bellsoft-liberica:9.9.0-ea', 'gcr.io/paketo-buildpacks/java-native-image']
		} else {
			if(project.hasProperty('aarm')) {
				builder = 'dashaun/java-native-builder-arm64'
			}
		}
	}
}
