[Gradle] Put stdlib in K/Native classpath in first position

And stop doing so on Compiler Side.

^KT-61430 Verification Pending
^KT-61559 Verification Pending
This commit is contained in:
Anton Lakotka
2024-01-23 09:26:30 +01:00
committed by Space Team
parent 71a03a7c7d
commit e4b760370f
2 changed files with 10 additions and 9 deletions
@@ -54,13 +54,9 @@ object FirNativeSessionFactory : FirAbstractSessionFactory() {
bindSession(session)
}
val resolvedKotlinLibraries = resolvedLibraries.map { it.library }
// KT-61645: stdlib-native must appear before stdlib-common metadata in the dependency list
// TODO: Consider not reordering libraries after KT-61430 is fixed, and Gradle plugin determines full order of dependencies.
val (stdlib, otherDeps) = resolvedKotlinLibraries.partition { it.isNativeStdlib }
val kotlinLibraries = stdlib + otherDeps
listOfNotNull(
KlibBasedSymbolProvider(session, moduleDataProvider, kotlinScopeProvider, kotlinLibraries),
NativeForwardDeclarationsSymbolProvider(session, forwardDeclarationsModuleData, kotlinScopeProvider, kotlinLibraries),
KlibBasedSymbolProvider(session, moduleDataProvider, kotlinScopeProvider, resolvedKotlinLibraries),
NativeForwardDeclarationsSymbolProvider(session, forwardDeclarationsModuleData, kotlinScopeProvider, resolvedKotlinLibraries),
FirBuiltinSyntheticFunctionInterfaceProvider(session, builtinsModuleData, kotlinScopeProvider),
syntheticFunctionInterfaceProvider,
)
@@ -30,10 +30,15 @@ internal val SetupKotlinNativePlatformDependenciesAndStdlib =
// Commonizer target must not be null for AbstractKotlinNativeCompilation, but we are graceful here and just return
val commonizerTarget = compilation.commonizerTarget.await() ?: return@KotlinCompilationSideEffectCoroutine
val nativeDistributionDependencies = project.getNativeDistributionDependencies(commonizerTarget)
compilation.compileDependencyFiles += nativeDistributionDependencies
val stdlib = project.files(project.konanDistribution.stdlib)
compilation.compileDependencyFiles += stdlib
val updatedCompileDependencyFiles = project.files().from(
stdlib,
nativeDistributionDependencies,
compilation.compileDependencyFiles
)
compilation.compileDependencyFiles = updatedCompileDependencyFiles
}
internal val ExcludeDefaultPlatformDependenciesFromKotlinNativeCompileTasks = KotlinProjectSetupAction {