[Build] Make K/N backend sources publishing for IDE in a less hacky way

The previous way was too hacky relying on internal API
#KTI-1221 In Progress
This commit is contained in:
Alexander.Likhachev
2023-06-07 18:04:14 +02:00
committed by Space Team
parent 8dd957d371
commit 3affe78ae5
2 changed files with 21 additions and 14 deletions
@@ -249,3 +249,8 @@ publishing {
}
}
}
ArtifactsKt.sourcesJar(project) {
it.from(sourceSets["cli_bc"].allSource)
it.from(sourceSets["compiler"].allSource)
}
@@ -1,4 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.kotlin.dsl.support.serviceOf
plugins {
kotlin("jvm")
@@ -16,6 +17,15 @@ idePluginDependency {
}
}
val embedded by configurations
val backendNativeSourcesConfiguration by configurations.creating {
isVisible = false
isCanBeResolved = true
isCanBeConsumed = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType.SOURCES))
}
}
dependencies {
embedded(project(":kotlin-native:backend.native")) { isTransitive = false }
@@ -24,6 +34,7 @@ idePluginDependency {
proguardLibraryJars(project(":kotlin-native:backend.native", "kotlin_stdlib_jar"))
proguardLibraryJars(project(":kotlin-native:backend.native", "kotlin_reflect_jar"))
proguardLibraryJars(project(":kotlin-native:backend.native", "cli_bcApiElements"))
backendNativeSourcesConfiguration(project(":kotlin-native:backend.native"))
}
noDefaultJar()
@@ -84,18 +95,9 @@ idePluginDependency {
publish()
// includes more sources than left by proguard
org.gradle.api.plugins.internal.JvmPluginsHelper.configureDocumentationVariantWithArtifact(
JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME,
null,
DocsType.SOURCES,
listOf(),
"sourcesJar",
project(":kotlin-native:backend.native").sourceSets["cli_bc"].allSource +
project(":kotlin-native:backend.native").sourceSets["compiler"].allSource,
components["kotlinLibrary"] as AdhocComponentWithVariants,
configurations,
tasks,
objects
)
sourcesJar {
val archiveOperations = serviceOf<ArchiveOperations>()
from(backendNativeSourcesConfiguration.map { archiveOperations.zipTree(it) })
dependsOn(backendNativeSourcesConfiguration)
}
}