plugins {
	id 'java'
	id 'application'
	id 'com.gradleup.shadow' version '9.0.0'
}

group = 'click.kamil.springstatemachineexporter'
version = '1.0.0'

application {
	mainClass = 'click.kamil.springstatemachineexporter.Main'
}

java {
	toolchain {
		languageVersion = JavaLanguageVersion.of(21)
	}
}

repositories {
	mavenCentral()
}

dependencies {
	// Picocli (standard version)
	implementation 'info.picocli:picocli:4.7.6'

	// Logging
	implementation 'org.slf4j:slf4j-api:2.0.12'
	implementation 'org.slf4j:slf4j-simple:2.0.12'

	// deps for parsing java AST
	implementation 'org.eclipse.jdt:org.eclipse.jdt.core:3.36.0'

	// Jackson for JSON support
	implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.1'
	implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.1'
	implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1'
	implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.1'

	compileOnly 'org.projectlombok:lombok:1.18.46'
	annotationProcessor 'org.projectlombok:lombok:1.18.46'

	testImplementation 'org.junit.jupiter:junit-jupiter-api:6.1.0'
	testImplementation 'org.junit.jupiter:junit-jupiter-params:6.1.0'
	testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:6.1.0'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher:6.1.0'
	testImplementation 'org.assertj:assertj-core:3.27.7'

	implementation 'net.sourceforge.plantuml:plantuml:1.2024.3'

	// Library types for JDT binding when analyzing cloned source (never runs the target project's build).
	implementation 'org.springframework.boot:spring-boot-starter:3.2.0'
	implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
}

tasks.named('test') {
	useJUnitPlatform()
	maxParallelForks = Math.max(1, Runtime.runtime.availableProcessors().intdiv(2) ?: 1)
	systemProperty "updateGolden", System.getProperty("updateGolden")
}

task runGolden(type: JavaExec) {
    mainClass = "click.kamil.springstatemachineexporter.GoldenUpdater"
    classpath = sourceSets.test.runtimeClasspath
    workingDir = rootProject.projectDir
}
