[Gradle] Rename publishableSources to isSourcesPublishable
^KT-55881 Verification Pending
This commit is contained in:
committed by
Space Team
parent
5b0a9c7a55
commit
f8e1b51f04
+4
-4
@@ -67,9 +67,9 @@ abstract class AbstractKotlinTarget(
|
||||
override val publishable: Boolean
|
||||
get() = true
|
||||
|
||||
override var publishableSources: Boolean = true
|
||||
override var isSourcesPublishable: Boolean = true
|
||||
override fun withSourcesJar(publish: Boolean) {
|
||||
publishableSources = publish
|
||||
isSourcesPublishable = publish
|
||||
}
|
||||
|
||||
@InternalKotlinGradlePluginApi
|
||||
@@ -146,7 +146,7 @@ abstract class AbstractKotlinTarget(
|
||||
// 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
|
||||
val sourcesJarTask = sourcesJarTask(producingCompilation, componentName, artifactNameAppendix)
|
||||
if (!publishableSources) return null
|
||||
if (!isSourcesPublishable) return null
|
||||
|
||||
// If sourcesElements configuration not found, don't create artifact.
|
||||
// This can happen in pure JVM plugin where source publication is delegated to Java Gradle Plugin.
|
||||
@@ -161,7 +161,7 @@ abstract class AbstractKotlinTarget(
|
||||
dependencyConfigurationName = sourcesElementsConfigurationName,
|
||||
overrideConfigurationAttributes = overrideConfigurationAttributes,
|
||||
includeIntoProjectStructureMetadata = false,
|
||||
publishOnlyIf = { publishableSources }
|
||||
publishOnlyIf = { isSourcesPublishable }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinTargetComponent
|
||||
import org.jetbrains.kotlin.tooling.core.HasMutableExtras
|
||||
|
||||
internal interface InternalKotlinTarget : KotlinTarget, HasMutableExtras {
|
||||
var publishableSources: Boolean
|
||||
var isSourcesPublishable: Boolean
|
||||
val kotlinComponents: Set<KotlinTargetComponent>
|
||||
fun onPublicationCreated(publication: MavenPublication)
|
||||
}
|
||||
|
||||
+2
-2
@@ -84,13 +84,13 @@ abstract class KotlinSoftwareComponent(
|
||||
}
|
||||
|
||||
val sourcesElements = metadataTarget.sourcesElementsConfigurationName
|
||||
if (metadataTarget.publishableSources) {
|
||||
if (metadataTarget.isSourcesPublishable) {
|
||||
addSourcesJarArtifactToConfiguration(sourcesElements)
|
||||
this += DefaultKotlinUsageContext(
|
||||
compilation = metadataTarget.compilations.getByName(MAIN_COMPILATION_NAME),
|
||||
dependencyConfigurationName = sourcesElements,
|
||||
includeIntoProjectStructureMetadata = false,
|
||||
publishOnlyIf = { metadataTarget.publishableSources }
|
||||
publishOnlyIf = { metadataTarget.isSourcesPublishable }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -72,7 +72,6 @@ private fun createTargetPublications(project: Project, publishing: PublishingExt
|
||||
project.whenEvaluated { kotlinTarget.createMavenPublications(publishing.publications) }
|
||||
else
|
||||
kotlinTarget.createMavenPublications(publishing.publications)
|
||||
// project.whenEvaluated { kotlinTarget.createMavenPublications(publishing.publications) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -58,10 +58,10 @@ internal class ExternalKotlinTargetImpl internal constructor(
|
||||
artifactsTaskLocator.locate(this)
|
||||
}
|
||||
|
||||
override var publishableSources: Boolean = true
|
||||
override var isSourcesPublishable: Boolean = true
|
||||
|
||||
override fun withSourcesJar(publish: Boolean) {
|
||||
publishableSources = publish
|
||||
isSourcesPublishable = publish
|
||||
}
|
||||
|
||||
override val artifactsTaskName: String
|
||||
|
||||
+3
-3
@@ -153,7 +153,7 @@ class MppPublicationTest {
|
||||
kotlin.withSourcesJar(publish = false)
|
||||
|
||||
for (target in kotlin.targets) {
|
||||
assertFalse(target.internal.publishableSources)
|
||||
assertFalse(target.internal.isSourcesPublishable)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,9 +165,9 @@ class MppPublicationTest {
|
||||
|
||||
for (target in kotlin.targets) {
|
||||
if (target.name == "linux") {
|
||||
assertFalse(target.internal.publishableSources)
|
||||
assertFalse(target.internal.isSourcesPublishable)
|
||||
} else {
|
||||
assertTrue(target.internal.publishableSources)
|
||||
assertTrue(target.internal.isSourcesPublishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user