KPM: Add the JVM JAR artifact to the projects archives configuration
This automatically sets up the dependency between the `assemble` task and the task building the JAR
This commit is contained in:
+5
-2
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.plugin.mpp.pm20
|
||||
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.disambiguateName
|
||||
import org.jetbrains.kotlin.gradle.tasks.locateOrRegisterTask
|
||||
@@ -14,10 +15,12 @@ import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
||||
* Registers a [Jar] task with the variant's compilation outputs and attaches this artifact to the given configuration.
|
||||
*/
|
||||
val KotlinFragmentCompilationOutputsJarArtifact = FragmentArtifacts<KotlinGradleVariant> {
|
||||
artifact(project.locateOrRegisterTask<Jar>(fragment.outputsJarTaskName) {
|
||||
val jar = project.locateOrRegisterTask<Jar>(fragment.outputsJarTaskName) {
|
||||
it.from(fragment.compilationOutputs.allOutputs)
|
||||
it.archiveClassifier.set(dashSeparatedName(fragment.name, fragment.containingModule.moduleClassifier))
|
||||
})
|
||||
}
|
||||
artifact(jar)
|
||||
fragment.project.artifacts.add(Dependency.ARCHIVES_CONFIGURATION, jar)
|
||||
}
|
||||
|
||||
internal val KotlinGradleVariant.outputsJarTaskName: String
|
||||
|
||||
Reference in New Issue
Block a user