If a target has no main compilation, don't create a sources JAR
Currently, Android libraries are not published as a part of an MPP library, and building no sources JAR for them is OK. Issue #KT-26390
This commit is contained in:
committed by
Ilya Matveev
parent
779030da1b
commit
699cff27a7
+2
-1
@@ -139,7 +139,8 @@ class KotlinMultiplatformPlugin(
|
|||||||
|
|
||||||
private fun configureSourceJars(project: Project) = with(project.kotlinExtension as KotlinMultiplatformExtension) {
|
private fun configureSourceJars(project: Project) = with(project.kotlinExtension as KotlinMultiplatformExtension) {
|
||||||
targets.all { target ->
|
targets.all { target ->
|
||||||
val mainCompilation = target.compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME)
|
val mainCompilation = target.compilations.findByName(KotlinCompilation.MAIN_COMPILATION_NAME)
|
||||||
|
// If a target has no `main` compilation (e.g. Android), don't create the source JAR
|
||||||
?: return@all
|
?: return@all
|
||||||
|
|
||||||
val sourcesJar = project.tasks.create(target.sourcesJarTaskName, Jar::class.java) { sourcesJar ->
|
val sourcesJar = project.tasks.create(target.sourcesJarTaskName, Jar::class.java) { sourcesJar ->
|
||||||
|
|||||||
Reference in New Issue
Block a user