Tests invoking javac APIs were flaky because ClasspathAnalyzerTest
was using Gradle's ProjectBuilder, which appends tools.jar to
the system class loader. Other tests do not do that, and they
invoke javac APIs directly.
In some executions, this causes some javac classes to be loaded
from the system class loader (the one patched by Gradle), while
some of them will be loaded by UrlClassLoader which points to tools.jar
in java.home. Having javac classes from different class loaders causes
java.lang.IllegalAccessError as package private access across class loaders
is not allowed. https://bugs.openjdk.java.net/browse/JDK-8068152 has more
information on this issue.
This change fixes the issue by fully removing usage of ProjectBuilder.
Test: ClasspathAnalyzerTest
Android Gradle plugin resolves the *Classpath configurations in an
artifact view with an artifactType attribute set, which should
give a resolved variant with a different `org.gradle.category`
attribute. With `org.gradle.category=library` set by the Kotlin
Gradle plugin, that couldn't work.
To fix this, don't set the `org.gradle.category` attribute on the
Android resolvable configurations.
TODO: Add integration tests!
When HMPP is enabled by default it is still printing warnings about
enableDependencyPropagation and enableGranularSourceSetsMetadata flags
#KT-48818 Fixed
* Introduce a new org.gradle.usage value: kotlin-cinterop
* Add compatibility+disambiguation rules to ensure that kotlin-cinterop
consumers can also fall back to ordinary (kotlin-api) published
variants, but not vice versa
* This ensures that ordinary kotlin-api consumers don't encounter
equally-compatible candidates where one is the normal API elements
and the other is C interop API elements
* Set org.gradle.usage = kotlin-cinterop in the C interop API elements
configurations and dependency-consuming configurations
Issue #KT-48709
* Don't set the localToProject attribute anymore, as it prevents proper
disambiguation if not set properly on all configurations, while all
the intentionally-public configurations
should already have the same value.
* Disambiguate o.j.k.platform.type Android vs JVM preferring JVM, as
Android should have other attributes which make pure-Android consumers
match the Android MPP variants.
* With Gradle 7.0+, set the attribute
`org.gradle.api.attributes.java.TargetJvmEnvironment` on the JVM &
Android elements configurations, which helps pure-Android consumers
to match the Android, not JVM variants. This fixes KT-30961 for
Gradle 7.0+ and AGP 7.0+
Issues: KT-49189, KT-30961
Now -Xdev-mode-overwriting-strategy=older compiler argument is handled on Gradle side to detect incremental changes to increase performance
#KT-35640 Fixed
Calculations of compilation outputs implicitly requires compile task configuration to execute `clean` task. This implicit configuration works unstable in parallel builds. We probably fine with the fact that outputs that are configured to be outside of build directory will not be cleaned by `clean` task
#KT-48046 Fixed
It happens Gradle has low performance on passing 'Array<Byte>' or
'List<Byte>' via properties api. In this change, task outputs approach
was changed to snapshot pre-execution state by coping outputs to the new
directory and coping them back on incremental compilation error.
^KT-46406 Fixed
When storing mapping from moduleName to module information, ensure
that values from kotlinOptions DSL objects are taken into
consideration.
Fixes #KT-49066
Test: KotlinAndroid70GradleIT.testCustomModuleName
to avoid unnecessarily loading unchanged ones.
Duplicate classes will make this a bit tricky. This commit outlines the
algorithm to handle them, the full implementation will follow later.
Also handle removed classes when computing classpath changes.
Test: New tests in ClasspathChangesComputerTest