diff --git a/kotlin-native/backend.native/build.gradle b/kotlin-native/backend.native/build.gradle index cb255680552..c11fed4d0a9 100644 --- a/kotlin-native/backend.native/build.gradle +++ b/kotlin-native/backend.native/build.gradle @@ -249,3 +249,8 @@ publishing { } } } + +ArtifactsKt.sourcesJar(project) { + it.from(sourceSets["cli_bc"].allSource) + it.from(sourceSets["compiler"].allSource) +} \ No newline at end of file diff --git a/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/build.gradle.kts b/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/build.gradle.kts index 7c309d3aa1d..51e1cbf4235 100644 --- a/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/build.gradle.kts +++ b/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/build.gradle.kts @@ -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() + from(backendNativeSourcesConfiguration.map { archiveOperations.zipTree(it) }) + dependsOn(backendNativeSourcesConfiguration) + } }