diff --git a/developer-plugin/src/main/kotlin/com/github/minigdx/gradle/plugin/MiniGdxDeveloperPlugin.kt b/developer-plugin/src/main/kotlin/com/github/minigdx/gradle/plugin/MiniGdxDeveloperPlugin.kt index 6dd5ca5..368798c 100644 --- a/developer-plugin/src/main/kotlin/com/github/minigdx/gradle/plugin/MiniGdxDeveloperPlugin.kt +++ b/developer-plugin/src/main/kotlin/com/github/minigdx/gradle/plugin/MiniGdxDeveloperPlugin.kt @@ -15,6 +15,7 @@ import org.gradle.api.publish.maven.tasks.PublishToMavenRepository import org.gradle.jvm.tasks.Jar import org.gradle.plugins.signing.SigningExtension import org.gradle.util.GradleVersion +import org.jetbrains.dokka.gradle.DokkaTask import java.io.File import java.net.URI @@ -72,7 +73,8 @@ class MiniGdxDeveloperPlugin : Plugin { project.extensions.configure(PublishingExtension::class.java) { // Configure publication (what to publish) it.publications.withType(MavenPublication::class.java).configureEach { - if(it.name != "pluginMaven") { + if (it.name != "pluginMaven") { + // TODO: [CACHE] Create variable. Push it outside lambda it.artifact(project.tasks.getByName("javadocJar")) } @@ -112,6 +114,7 @@ class MiniGdxDeveloperPlugin : Plugin { publication.onlyIf { // publish on sonatype only if the username is configured. (publication.name.startsWith("sonatype") && + // TODO: [CACHE] Might need to do something about that. project.properties["sonatype.username"]?.toString()?.isNotBlank() == true) || !publication.name.startsWith("sonatype") } @@ -120,12 +123,21 @@ class MiniGdxDeveloperPlugin : Plugin { } private fun configureDokka(project: Project) { + // TODO - [CACHE] Dokka doesn't support Configuration Cache yet + // See: https://github.com/Kotlin/dokka/issues/2231 project.apply { it.plugin("org.jetbrains.dokka") } project.tasks.register("javadocJar", Jar::class.java) { it.dependsOn(project.tasks.getByName("dokkaHtml")) it.archiveClassifier.set("javadoc") it.from(project.buildDir.resolve("dokka")) } + + project.tasks.withType(DokkaTask::class.java).whenTaskAdded { dokka -> + dokka.notCompatibleWithConfigurationCache( + "The dokka tasks are not compatible yet " + + "with the configuration cache." + ) + } } private fun configureProjectRepository(project: Project) { @@ -145,6 +157,7 @@ class MiniGdxDeveloperPlugin : Plugin { project.apply { it.plugin("org.jlleitschuh.gradle.ktlint") } } + // TODO: [CACHE] Don't pass project any more to the method private fun copy(project: Project, filename: String, target: File) { val content = classLoader.getResourceAsStream(filename) ?: throw MiniGdxException.create( severity = Severity.GRAVE, @@ -169,6 +182,7 @@ class MiniGdxDeveloperPlugin : Plugin { it.group = "minigdx-dev" it.description = "Copy default Github workflows inside this project." it.doLast { + // TODO: [CACHE] Move target outside lambda val target = it.project.projectDir.resolve(".github/workflows") if (!target.exists()) { it.project.mkdir(".github/workflows") @@ -189,6 +203,7 @@ class MiniGdxDeveloperPlugin : Plugin { it.group = "minigdx-dev" it.description = "Copy default Makefile inside this project." it.doLast { + // TODO: [CACHE] move target out of lambda val target = it.project.projectDir copy(project, "Makefile", target) } diff --git a/developer-plugin/src/main/kotlin/com/github/minigdx/gradle/plugin/MiniGdxKotlinJvmPlugin.kt b/developer-plugin/src/main/kotlin/com/github/minigdx/gradle/plugin/MiniGdxKotlinJvmPlugin.kt index 4f0814f..6cae6b4 100644 --- a/developer-plugin/src/main/kotlin/com/github/minigdx/gradle/plugin/MiniGdxKotlinJvmPlugin.kt +++ b/developer-plugin/src/main/kotlin/com/github/minigdx/gradle/plugin/MiniGdxKotlinJvmPlugin.kt @@ -6,6 +6,7 @@ import org.gradle.api.Project import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.jvm.tasks.Jar import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.jvm.toolchain.JavaToolchainService import org.jetbrains.kotlin.gradle.dsl.KotlinCompile @@ -36,6 +37,20 @@ class MiniGdxKotlinJvmPlugin : Plugin { it.javaCompiler.set(javaCompiler) } } + + project.tasks.withType(Jar::class.java).whenTaskAdded { + val projectName = project.name + val projectVersion = project.version.toString() + + project.tasks.withType(Jar::class.java) { + it.manifest { + it.attributes(mapOf( + "Implementation-Title" to projectName, + "Implementation-Version" to projectVersion + )) + } + } + } } private fun configurePublication(project: Project) {