plugins { alias catalog.plugins.kotlin.jvm apply false alias catalog.plugins.sambal alias catalog.plugins.lombok apply false } import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile allprojects { subproject -> group = 'net.woggioni' if(project.currentTag.isPresent()) { version = project.currentTag.map { it[0] }.get() } else { version = project.gitRevision.map { gitRevision -> "${getProperty('gbcs.version')}.${gitRevision[0..10]}" }.get() } repositories { maven { url = getProperty('gitea.maven.url') content { includeModule 'net.woggioni', 'jwo' includeModule 'net.woggioni', 'xmemcached' includeGroup 'com.lys' } } mavenCentral() } pluginManager.withPlugin('java-library') { ext { jpmsModuleName = subproject.group + '.' + subproject.name.replace('-', '.') } java { withSourcesJar() modularity.inferModulePath = true toolchain { languageVersion = JavaLanguageVersion.of(21) vendor = JvmVendorSpec.ORACLE } } dependencies { testImplementation catalog.junit.jupiter.api testImplementation catalog.junit.jupiter.params testRuntimeOnly catalog.junit.jupiter.engine } test { useJUnitPlatform() } tasks.withType(JavaCompile) { modularity.inferModulePath = true options.release = 21 } tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile) { options.compilerArgumentProviders << new CommandLineArgumentProvider() { @Override Iterable asArguments() { return ['--patch-module', subproject.jpmsModuleName + '=' + subproject.sourceSets.main.output.asPath] } } options.javaModuleVersion = version } } pluginManager.withPlugin('jacoco') { test { finalizedBy jacocoTestReport } jacocoTestReport { dependsOn test } } pluginManager.withPlugin(catalog.plugins.kotlin.jvm.get().pluginId) { tasks.withType(KotlinCompile.class) { compilerOptions.jvmTarget = JvmTarget.JVM_21 } } pluginManager.withPlugin(catalog.plugins.lombok.get().pluginId) { lombok { version = catalog.versions.lombok } } pluginManager.withPlugin('maven-publish') { publishing { repositories { maven { name = "Gitea" url = uri(getProperty('gitea.maven.url')) credentials(HttpHeaderCredentials) { name = "Authorization" value = "token ${System.getenv()["PUBLISHER_TOKEN"]}" } authentication { header(HttpHeaderAuthentication) } } } } } } tasks.register('version') { doLast { println("VERSION=$version") } }