[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,
|
classifierPrefix: String? = null,
|
||||||
sourcesElementsConfigurationName: String = this.sourcesElementsConfigurationName,
|
sourcesElementsConfigurationName: String = this.sourcesElementsConfigurationName,
|
||||||
overrideConfigurationAttributes: AttributeContainer? = null,
|
overrideConfigurationAttributes: AttributeContainer? = null,
|
||||||
|
mavenScope: KotlinUsageContext.MavenScope? = null,
|
||||||
): DefaultKotlinUsageContext? {
|
): DefaultKotlinUsageContext? {
|
||||||
// We want to create task anyway, even if sources are not going to be published by KGP
|
// 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
|
// So users or other plugins can still use it
|
||||||
@@ -160,6 +161,7 @@ abstract class AbstractKotlinTarget(
|
|||||||
compilation = producingCompilation,
|
compilation = producingCompilation,
|
||||||
dependencyConfigurationName = sourcesElementsConfigurationName,
|
dependencyConfigurationName = sourcesElementsConfigurationName,
|
||||||
overrideConfigurationAttributes = overrideConfigurationAttributes,
|
overrideConfigurationAttributes = overrideConfigurationAttributes,
|
||||||
|
mavenScope = mavenScope,
|
||||||
includeIntoProjectStructureMetadata = false,
|
includeIntoProjectStructureMetadata = false,
|
||||||
publishOnlyIf = { isSourcesPublishable }
|
publishOnlyIf = { isSourcesPublishable }
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-1
@@ -86,7 +86,8 @@ constructor(
|
|||||||
createSourcesJarAndUsageContextIfPublishable(
|
createSourcesJarAndUsageContextIfPublishable(
|
||||||
mainCompilation,
|
mainCompilation,
|
||||||
componentName,
|
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.plugin.mpp.internal
|
||||||
import org.jetbrains.kotlin.gradle.util.addBuildEventsListenerRegistryMock
|
import org.jetbrains.kotlin.gradle.util.addBuildEventsListenerRegistryMock
|
||||||
import org.jetbrains.kotlin.gradle.util.disableLegacyWarning
|
import org.jetbrains.kotlin.gradle.util.disableLegacyWarning
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
class MppPublicationTest {
|
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
|
@Test
|
||||||
fun `sourcesJar task should be available during configuration time`() {
|
fun `sourcesJar task should be available during configuration time`() {
|
||||||
|
|||||||
Reference in New Issue
Block a user