plugins {
	java
	idea
	id("com.github.ben-manes.versions") version "0.51.0"
}

group = "com.elex-project"
version = "1.0-SNAPSHOT"
description = ""//todo

repositories {
	maven {
		name = "Nexus 3 Repository"
		url = uri(project.findProperty("repo.url") as String)
		credentials {
			username = project.findProperty("repo.username") as String
			password = project.findProperty("repo.password") as String
		}
	}
}
idea{
    module {
        isDownloadJavadoc=true
        isDownloadSources=true
    }
}
java {
	//withSourcesJar()
	//withJavadocJar()
	sourceCompatibility = org.gradle.api.JavaVersion.VERSION_17
	targetCompatibility = org.gradle.api.JavaVersion.VERSION_17
	//modularity.inferModulePath.set(false)
}

configurations {
	compileOnly {
		extendsFrom(annotationProcessor.get())
	}
	testCompileOnly {
		extendsFrom(testAnnotationProcessor.get())
	}
}

tasks.jar {
	manifest { // todo
		attributes(mapOf(
				"Implementation-Title" to project.name,
				"Implementation-Version" to project.version,
				"Implementation-Vendor" to "ELEX co.,pte.",
				"Automatic-Module-Name" to "com.elex_project.${project.name}"
		))
	}
}

tasks.compileJava {
	options.encoding = "UTF-8"
	options.javaModuleVersion.set(provider { project.version as String })
}

tasks.compileTestJava {
	options.encoding = "UTF-8"
}

tasks.test {
	useJUnitPlatform()
}

tasks.javadoc {
	if (JavaVersion.current().isJava9Compatible) {
		(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
	}
	(options as StandardJavadocDocletOptions).encoding = "UTF-8"
	(options as StandardJavadocDocletOptions).charSet = "UTF-8"
	(options as StandardJavadocDocletOptions).docEncoding = "UTF-8"

}

dependencies {
	//implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
	implementation("org.slf4j:slf4j-api:2.+")
	implementation("org.jetbrains:annotations:24.+")

	compileOnly("org.projectlombok:lombok:1.18.32")
	annotationProcessor("org.projectlombok:lombok:1.18.32")
	testAnnotationProcessor("org.projectlombok:lombok:1.18.32")

	testImplementation("ch.qos.logback:logback-classic:1.5.3")
	testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
	testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")
}
