Previously commonCompilationDataPerFragment and
nativeCompilationDataPerFragment were declared as using
`mutableMapOf`, which will not offer the necessary 'compute' function
in IDE analysis.
KT-51386
The `kotlinExtension` check in consumerApiUsage function can be removed
when legacy MPP plugin `kotlin-platform-common` is also removed from
the code base.
Consumer configurations with following set of attributes:
* org.gradle.usage = 'kotlin-api'
* org.jetbrains.kotlin.platform.type = 'common'
are supposed to consume legacy `*.kotlin_metadata` artifacts.
And can be consumed by HMPP project with
"Compatibility Metadata Variant Enabled" flag. For such purpose
`metadataCompileClasspath` configuration is configured with attributes
mentioned above.
There is no sense to consume such artifacts in HMPP projects without
compatibility metadata variant. And in order to prevent
breaking changes in KGP ecosystem, legacy configurations are
reconfigured to consume new KLIB metadata artifacts. Instead of failing
on resolution.
^KT-50925 Verification Pending
This enables using exported Frameworks with `-fmodules-decluse`.
One use-case for this is ensuring that distributed builds are
explicitly providing all required modules; this is important for
reproducibility.
For more background on `use` declarations, see:
https://clang.llvm.org/docs/Modules.html#use-declaration
The easiest way to reproduce this locally is by compiling a framework,
and emitting a pcm file with `swiftc`. Note that this requires a
reference to a pcm for Foundation, which can be found in the clang
ModuleCache.
```
kotlin-native/dist/bin/kotlinc-native ~/test.kt -produce framework -o /tmp/TestFramework.framework
swiftc -emit-pcm -module-name TestFramework -o /tmp/TestFramework.pcm /tmp/TestFramework.framework/Modules/module.modulemap -Xcc -fmodules-decluse -Xcc -fmodule-file=Foundation=$HOME/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1IQ2SWDEIAPH0/Foundation-2FJBXN8U6QRTS.pcm
```
^KT-51627 Fixed
kotlinc will currently read /tmp/build.txt in an attempt to
determine an IDEA version number for IDEA plugin compatibility
checking. If that file exists and does not match the expected
format kotlinc will fail.
Since standalone kotlinc is not IDEA, this change explicitly
sets the system property for the build number to a fallback
value. That avoids reading /tmp/build.txt.
closes https://github.com/JetBrains/kotlin/pull/4763
because the intention of that configuration is to use "slower" class
reading.
In the near future, even though FIR is enabled, which uses experimental
faster jar file system, FIR clients (e.g., FIR UAST or Android Lint) may
still need to use slower class reading. So, we need to handle that
configuration before checking others.