[build] Don't use dependencies on Native backend in KLIB tool
^KT-62340
This commit is contained in:
committed by
Space Team
parent
c1a4c33301
commit
478205e6e8
@@ -169,6 +169,7 @@ dependencies {
|
||||
distPack project(':kotlin-native:utilities:cli-runner')
|
||||
distPack project(':kotlin-native:utilities:basic-utils')
|
||||
distPack project(':kotlin-native:klib')
|
||||
distPack project(path: ':kotlin-native:backend.native', configuration: 'cli_bcApiElements')
|
||||
distPack project(path: ':kotlin-native:endorsedLibraries:kotlinx.cli', configuration: "jvmRuntimeElements")
|
||||
commonSources project(path: ':kotlin-stdlib', configuration: 'metadataSourcesElements')
|
||||
commonSources project(path: ':kotlin-test', configuration: 'metadataSourcesElements')
|
||||
|
||||
@@ -13,8 +13,10 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlinStdlib())
|
||||
implementation(project(":kotlin-native:backend.native", "cli_bcApiElements"))
|
||||
implementation(project(":core:descriptors"))
|
||||
implementation(project(":native:frontend.native"))
|
||||
implementation(project(":compiler:ir.psi2ir"))
|
||||
implementation(project(":compiler:ir.serialization.native"))
|
||||
implementation(project(":kotlin-native:utilities:basic-utils"))
|
||||
implementation(project(":kotlin-util-klib-abi"))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.jetbrains.kotlin.cli.klib
|
||||
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.getPackageFragments
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities.PUBLIC
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities.PROTECTED
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.jetbrains.kotlin.cli.klib
|
||||
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.getPackageFragments
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.cli.klib
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||
|
||||
// Legacy stuff that will be dropped anyway in KT-65380
|
||||
|
||||
// TODO: remove it, KT-65380
|
||||
private fun getPackagesFqNames(module: ModuleDescriptor): Set<FqName> {
|
||||
val result = mutableSetOf<FqName>()
|
||||
val packageFragmentProvider = (module as? ModuleDescriptorImpl)?.packageFragmentProviderForModuleContentWithoutDependencies
|
||||
|
||||
fun getSubPackages(fqName: FqName) {
|
||||
result.add(fqName)
|
||||
val subPackages = packageFragmentProvider?.getSubPackagesOf(fqName) { true }
|
||||
?: module.getSubPackagesOf(fqName) { true }
|
||||
subPackages.forEach { getSubPackages(it) }
|
||||
}
|
||||
|
||||
getSubPackages(FqName.ROOT)
|
||||
return result
|
||||
}
|
||||
|
||||
// TODO: remove it, KT-65380
|
||||
internal fun ModuleDescriptor.getPackageFragments(): List<PackageFragmentDescriptor> =
|
||||
getPackagesFqNames(this).flatMap {
|
||||
getPackage(it).fragments.filter { it.module == this }.toSet()
|
||||
}
|
||||
@@ -49,6 +49,7 @@ dependencies {
|
||||
kotlinNativeEmbedded(project(":kotlin-native:utilities:cli-runner"))
|
||||
kotlinNativeEmbedded(project(":kotlin-native:utilities:basic-utils"))
|
||||
kotlinNativeEmbedded(project(":kotlin-native:klib"))
|
||||
kotlinNativeEmbedded(project(":kotlin-native:backend.native", "cli_bcApiElements"))
|
||||
kotlinNativeEmbedded(project(":kotlin-native:endorsedLibraries:kotlinx.cli", "jvmRuntimeElements"))
|
||||
kotlinNativeEmbedded(project(":kotlin-compiler")) { isTransitive = false }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user