plugins {
	alias(libs.plugins.org.springframework.boot)
	alias(libs.plugins.io.spring.dependency.management)
	id "nebula.integtest" version "8.2.0"
	id 'java'
	id 'org.hibernate.orm' version '7.0.6.Final'
	id "org.graalvm.buildtools.native" version "0.10.2"
}

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

dependencies {
	implementation platform(libs.org.springframework.spring.framework.bom)
	implementation platform(libs.org.springframework.security.spring.security.bom)
	implementation platform(libs.org.springframework.data.spring.data.bom)
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-security'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'org.springframework.security:spring-security-data'
	implementation 'com.h2database:h2'

	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testImplementation 'org.springframework.boot:spring-boot-security-test'
	testImplementation 'org.springframework.security:spring-security-test'
}

group = "org.example"

hibernate {
  enhancement {
    enableAssociationManagement = true
  }
}

tasks.withType(Test).configureEach {
	useJUnitPlatform()
	outputs.upToDateWhen { false }
}

if (plugins.hasPlugin("io.spring.javaformat")) {
	compileJava {
		dependsOn("formatMain")
	}
	tasks.checkFormatMain {
		dependsOn("formatMain")
	}
	compileTestJava {
		dependsOn("formatTest")
	}
	tasks.checkFormatTest {
		dependsOn("formatTest")
	}
}
