[Gradle] Add mavenScope parameter to createSourcesJarAndUsageContextIfPublishable
^KT-55881 Verification Pending
This commit is contained in:
committed by
Space Team
parent
f8e1b51f04
commit
1dd9751f99
+2
@@ -142,6 +142,7 @@ abstract class AbstractKotlinTarget(
|
||||
classifierPrefix: String? = null,
|
||||
sourcesElementsConfigurationName: String = this.sourcesElementsConfigurationName,
|
||||
overrideConfigurationAttributes: AttributeContainer? = null,
|
||||
mavenScope: KotlinUsageContext.MavenScope? = null,
|
||||
): DefaultKotlinUsageContext? {
|
||||
// We want to create task anyway, even if sources are not going to be published by KGP
|
||||
// So users or other plugins can still use it
|
||||
@@ -160,6 +161,7 @@ abstract class AbstractKotlinTarget(
|
||||
compilation = producingCompilation,
|
||||
dependencyConfigurationName = sourcesElementsConfigurationName,
|
||||
overrideConfigurationAttributes = overrideConfigurationAttributes,
|
||||
mavenScope = mavenScope,
|
||||
includeIntoProjectStructureMetadata = false,
|
||||
publishOnlyIf = { isSourcesPublishable }
|
||||
)
|
||||
|
||||
+2
-1
@@ -86,7 +86,8 @@ constructor(
|
||||
createSourcesJarAndUsageContextIfPublishable(
|
||||
mainCompilation,
|
||||
componentName,
|
||||
dashSeparatedName(targetName.toLowerCaseAsciiOnly())
|
||||
dashSeparatedName(targetName.toLowerCaseAsciiOnly()),
|
||||
mavenScope = KotlinUsageContext.MavenScope.RUNTIME
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+11
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.internal
|
||||
import org.jetbrains.kotlin.gradle.util.addBuildEventsListenerRegistryMock
|
||||
import org.jetbrains.kotlin.gradle.util.disableLegacyWarning
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||
import kotlin.test.*
|
||||
|
||||
class MppPublicationTest {
|
||||
@@ -128,6 +129,16 @@ class MppPublicationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `sources elements should not have any dependencies`() {
|
||||
project.evaluate()
|
||||
project.configurations
|
||||
.filter { it.name.toLowerCaseAsciiOnly().contains("sourceselements") }
|
||||
.forEach { configuration ->
|
||||
if (configuration.dependencies.isNotEmpty()) fail("Configuration $configuration should not have dependencies")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun `sourcesJar task should be available during configuration time`() {
|
||||
|
||||
Reference in New Issue
Block a user