Fix the K/N stdlib leaking into other common source sets

The Kotlin/Native stdlib was added to the shared-native source sets
in order for the IDE to import the stdlib dependency.

However, it was added to the '*Implementation' configuration, from
where it was also collected for the dependency source set
visibility inference algorithm. The current implementation of source
sets visibility inference only works for module dependencies and is
not quite suitable for local file dependencies. The implementation
should likely be fixed, but for now, it's enough to add the dependency
directly to the place where the visibility inference results are
taken from by the IDE during import, i.e. to the
'*ImplementationDependenciesMetadata' configurations.

Also, since all tests were flawed by the leakin K/N stdlib, the
K2Metadata/Klib compiler mistakenly didn't include its own built-ins
to the module dependencies (and everything worked because the K/N
built-ins were there). Now that the K/N doesn't leak, the compiler
must add its own built-ins.
This commit is contained in:
Sergey Igushkin
2020-01-24 17:56:18 +03:00
parent 970ee4539b
commit d1826374a6
4 changed files with 22 additions and 4 deletions
@@ -52,7 +52,7 @@ internal class K2MetadataKlibSerializer(private val metadataVersion: BuiltInsBin
LockBasedStorageManager("K2MetadataKlibSerializer")
)
val analyzer = runCommonAnalysisForSerialization(environment, false, dependencyContainer)
val analyzer = runCommonAnalysisForSerialization(environment, true, dependencyContainer)
if (analyzer == null || analyzer.hasErrors()) return