Commit Graph

97934 Commits

Author SHA1 Message Date
Anton Lakotka d33c9d7912 [Gradle] resolveIdeDependencies should depend on transformation tasks
^KT-49933
2023-01-20 20:15:24 +00:00
Anton Lakotka 1777fc58e7 [Gradle] Use transformDependenciesMetadata task name directly
Using internal TRANSFORM_ALL_SOURCESETS_DEPENDENCIES_METADATA doesn't
work well with K2 compiler

^KT-49933
2023-01-20 20:15:23 +00:00
Anton Lakotka be3e3332d5 [Gradle] Don't create another transformation task for commonMain source set
when compatibility variant enabled. commonMain have to be compiled
at least two times. One time to klib and second time to legacy metadata.
In both cases it should have correct classpath.

^KT-49933
2023-01-20 20:15:23 +00:00
Anton Lakotka 007a2411cc [Gradle] Break cycles when iterating over all dependencies
Gradle DependencyResult can have cycles in its dependencies. So
keep track of visited dependencies.

^KT-49933
2023-01-20 20:15:23 +00:00
Anton Lakotka 32cb38e0d4 [Gradle] Disable KPM tests that is faling due to changes about GCC+HMPP
^KT-49933
2023-01-20 20:15:22 +00:00
Anton Lakotka b689c07b01 [Gradle] Fix tests after supporting GCC for HMPP
^KT-49933
2023-01-20 20:15:22 +00:00
Anton Lakotka 02e97dcbc1 [Gradle] Update ConfigurationCacheIT tests after supporting GCC for HMPP
^KT-49933
2023-01-20 20:15:22 +00:00
Anton Lakotka 1f895e5a36 [Gradle] Prettify result of ComponentIdentifier.uniqueKey for projects
^KT-49933
2023-01-20 20:15:21 +00:00
Anton Lakotka 357e14dc04 [Gradle] Add support Configuration Cache for MetadataDependencyTransformationTask
* Write transformedLibraries to a file after Task execution
* Write visible source sets to a file after Task execution
* Rearrange task properties, inputs outputs in the way that task state
  is serializable to configuration cache.
* Introduce transformDependenciesMetadata task to be an umbrella for
  other transform tasks. This will be convinient for tests and other
  development purposes

^KT-49933
2023-01-20 20:15:21 +00:00
Anton Lakotka 4941e8b7de [Gradle] Provide transformed libraries from transformation task itself
Remove `createMetadataDependencyTransformationClasspath` that were using
`ResolvedMetadataFilesProvider` which is no longer used by
GranularMetadataTransformation. The transformed files
can be requested directly from resolution results.

^KT-49933
2023-01-20 20:15:21 +00:00
Anton Lakotka 72f8c8399d [Gradle] Decouple GranularMetadataTransformation from Gradle Project
Introduce GranularMetadataTransformation.Params that can be serialized
to Configuration Cache, and it contains all required data for
Metadata Transformations.

^KT-49933
2023-01-20 20:15:20 +00:00
Anton Lakotka 84287557d7 [Gradle] Remove applyToConfiguration
After removing scoped metadata configurations
method GranularMetadataTransformation.applyToConfiguration is no longer
used.

^KT-49933
2023-01-20 20:15:20 +00:00
Anton Lakotka 7290947fe8 [Gradle] Add PreExtractedProjectMetadataProvider
It is decoupled from Gradle Project and can be stored in
Gradle Configuration cache safely.

^KT-49933
2023-01-20 20:15:20 +00:00
Anton Lakotka 84d7139a12 [Gradle] Add MppDependency[PSM]Factory
Since ProjectMppDependency[PMS]Extractor is decoupled
from Project it is possible to create MppDependency[PSM]Extractor just
from `ResolvedArtifactResult` using its ComponentIdentifier and file.

^KT-49933
2023-01-20 20:15:19 +00:00
Anton Lakotka ceefc4f1ee [Gradle] Decouple ProjectMppDependency[PSM]Extractor from Gradle Project
^KT-49933
2023-01-20 20:15:19 +00:00
Anton Lakotka 6b2111c2a5 [Gradle] Decouple SourceSetVisibilityProvider from Gradle Project
And related ResolvedMppVariantsProvider.

* Introduce PlatformCompilationData that is Configuration Cache friendly
  And contain all needed data to infer visible source sets
* Add factory-methods that can collect PlatformCompilationData from
  project that has Multiplatform Extension.
* hostSpecificMetadataConfiguration collection has parity with related
  ResolvedMppVariantsProvider.resolveArtifacts() part where attributes
  are changed to KOTLIN_METADATA.

ResolvedMppVariantsProvider will be deprecated and removed shortly

^KT-49933
2023-01-20 20:15:19 +00:00
Anton Lakotka 504ee1fbb1 [Gradle] Enhance LazyResolvedConfiguration API
* Add configurationName and provide `toString()` implementation for
  better debugging experience;
* Update `dependencyArtifacts` and `moduleArtifacts` API to work in the
  same way as original Gradle's counterparts
* Add helper extension functions `allResolvedDependencies`
  and `dependencyArtifactsOrNull` for better developer experience

^KT-49933
2023-01-20 20:15:18 +00:00
Anton Lakotka bf8ef74b37 [Gradle] Rename ResolvedDependencyGraph to LazyResolvedConfiguration
This give better understanding of the purpose of the class

^KT-49933
2023-01-20 20:15:18 +00:00
Anton Lakotka 396ed3642e [Gradle] Pass only parent's visible source sets instead of entire...
...GranularMetadataTransformation object

^KT-49933
2023-01-20 20:15:18 +00:00
Ilya Chernikov 7ec72b568d Fix assertion in light tree diagnostic reporter
happened then two diagnostics are reported on the same element.
#KT-55924 fixed
2023-01-20 17:57:15 +00:00
Pavel Kirpichenkov 3b9aac067a Mark API for direct access to declared project properties with opt-in
KT-55891
2023-01-20 17:42:52 +00:00
Pavel Kirpichenkov 26e160d4ce [MPP] Add a flag to disable warnings about deprecated HMPP properties
KT-55891
2023-01-20 17:42:52 +00:00
Pavel Kirpichenkov ec5f56584c [MPP] Report deprecation warnings for HMPP-related Gradle properties
KT-55891
2023-01-20 17:42:51 +00:00
Ilya Goncharov 4e13b7a202 [Gradle, JS] Add nullable custom fields
^KT-42395 fixed
2023-01-20 17:40:05 +00:00
Troels Bjerre Lund 7854b01473 [K/N] custom-alloc: handle finalizers
This commit adds finalizers to the custom allocator. Compared to the
existing solution:

* The finalizer queue is replaced by an AtomicStack<ExtraObjectData>.
* All objects with finalizers get meta objects attached. This was not
  previously the case for CleanerImpl, but is now needed to link objects
  together in the finalization queue.
* The finalizer queue is built during SweepExtraObjects, instead of
  during regular sweeping.
* Cleaners are executed by the finalizer thread, and no longer by a
  separate worker thread.

Co-authored-by: Troels Lund <troels@google.com>

Merge-request: KOTLIN-MR-592
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
2023-01-20 16:47:06 +00:00
Sergey Bogolepov 5bd405856f [IR] Pass input value to AbstractNamedCompilerPhase.runAfter
It is needed for the K/N dynamic compiler driver where phase input
might be required for actions performed after its execution.
2023-01-20 13:33:07 +00:00
Sergey Bogolepov c22285f824 [IR] Remove unused Ir.irModule property
It is required for the Native backend refactoring
where `Context` does not contain a reference for any
particular IrModuleFragment.
2023-01-20 13:33:06 +00:00
Sergey Bogolepov 3355f04fa1 [IR] Drop all usages of Ir.irModule 2023-01-20 13:33:06 +00:00
Yahor Berdnikau a90664574c Fix jvm target validation does not work for MPP JVM withJava target
Related KotlinCompile to JavaCompile wiring is happening on
KotlinJvmTarget initialization before 'withJava' configuration runs. At
that point linked JavaCompile task is null. Fix delays wiring to
execution phase when such task should be available.

^KT-55119 Fixed
2023-01-20 13:13:58 +00:00
Sergej Jaskiewicz 1f76d39e66 [IR] Make IrTypeArgument a sealed interface 2023-01-20 10:58:28 +00:00
Yahor Berdnikau c65b689fa0 Provide approximate stacktrace to freeCompilerArgs modification
Will help users to understand where exactly 'kotlinOptions
.freeCompilerArgs' were modified on execution phase.

^KT-55544 Fixed
2023-01-20 10:01:04 +00:00
Nikolay Lunyak ff96033e95 [FIR] KT-55666: Support labels to local functions
^KT-55666 Fixed
2023-01-20 08:09:08 +00:00
Ilya Goncharov f4cda71d9e [Gradle, JS] Add possibility to not add js compiler attribute on publish 2023-01-19 22:11:01 +00:00
Dmitrii Gridin 4fa338ccf4 [LC] skip some tests in IDE 2023-01-19 19:25:04 +00:00
Pavel Kunyavskiy 0560b2b068 [K/N] Don't generate initializer function when it is empty 2023-01-19 16:41:47 +00:00
Ilmir Usmanov 945cdc8884 Minor. Ignore tests in JS_IR_ES6, regenerate tests 2023-01-19 17:04:31 +01:00
Nikolay Krasko 7fa45e8af9 Add information to verification metadata about libraries used during publication to sonatype 2023-01-19 15:07:28 +00:00
Ilya Goncharov d7c31f79a8 Do not suppress NPM related tasks, but be aware about checking of them in task graph 2023-01-19 13:43:57 +00:00
Nikita Bobko 887547c445 Drop MetadataComparisonTest & drop build-tools -> util-klib dependency
Review: https://jetbrains.team/p/kt/reviews/8360

MetadataComparisonTest was the only one in build-tools module who
depended on util-klib, that's why we can drop build-tools -> util-klib
dependency

MetadataComparisonTest is no longer needed, that's why we can drop it.

The dependency drop is a one step forward in dropping
`kotlin.srcDir("../compiler/util-klib/src")` line in
`buildSrc/build.gradle.kts`. Adding source roots in `buildSrc` is hacky
and can lead to frustrations (e.g. KT-55874). That's why it's desirable
to drop buildSrc -> util-klib hacky dependency.

Unfortunatelly, I couldn't drop buildSrc -> util-klib dependency,
because:
1. buildSrc depends on kotlin-native/shared/src/library/kotlin +
   buildSrc depends on kotlin-native/tools/kotlin-native-gradle-plugin +
   maybe smth else
2. kotlin-native/shared/src/library/kotlin depends on util-klib +
   kotlin-native/tools/kotlin-native-gradle-plugin depends on util-klib +
   maybe smth else
2023-01-19 12:55:56 +00:00
Anna Kozlova 07525fef51 [AA] extract source psi from delegated wrapper when exists 2023-01-19 11:38:32 +00:00
hungvietnguyen f172c50f27 New IC: Ignore LookupSymbols that refer to file facades (#5069)
A LookupSymbol should only refer to either a class, a class member, or a
package member.

When a LookupSymbol refers to a file facade (e.g.,
LookupSymbol(name="FooKt", scope="com.example")), it is redundant as it
doesn't impact the IC analysis to find files to recompile.

Previously, the new IC (ClasspathChangesComputer) would fail when
detecting that IncrementalJvmCache reported these redundant
LookupSymbols. With this change, the new IC will just ignore them.

Note: A better approach would be to fix IncrementalJvmCache to not
report these LookupSymbols, but it will require some significant
cleanup/refactoring work, so we can consider it later.

Test: New KotlinOnlyClasspathChangesComputerTest.testRenameFileFacade
^KT-55021 Fixed
2023-01-19 12:21:29 +01:00
Leonid Startsev dc0cd61b6f Handle @Serializable classes that implement interfaces by delegation
by filtering out delegated properties that end up in irClass.properties() list

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2157
2023-01-19 11:12:31 +00:00
Denis.Zharkov 490970e65e Adjust KotlinJavaPsiFacade::knownClassNamesInPackage for empty scope
The method must return an empty set in that case, instead of null
that would mean we can't compute it.

The problem was found when running FirLoadCompiledKotlinGenerated
2023-01-19 10:57:44 +00:00
Denis.Zharkov 9c988fd8d8 K2: Introduce FirCachingCompositeSymbolProvider
The main idea is pre-computing the sets of names that might be
met there, that helps to decrease the sizes of the backing maps
(by avoiding irrelevant keys)

Totally, this branch with previous commits speeds up MT Full Kotlin
approximately on 3 seconds (~5%)
2023-01-19 10:57:43 +00:00
Denis.Zharkov 6705d211a6 K2: Get rid of FirDependenciesSymbolProviderImpl
Its usages will be safely replaced
with FirCachingCompositeSymbolProvider

But here, in the commit plain FirCompositeSymbolProvider used temporary
2023-01-19 10:57:43 +00:00
Denis.Zharkov 9302fe3cb5 K2: Get rid of redundant FirDependenciesSymbolProvider class 2023-01-19 10:57:42 +00:00
Denis.Zharkov dab50daf56 K2: Add ability identify DI components by string key instead of KClass
It allows having several the same typed-component in the container
2023-01-19 10:57:42 +00:00
Denis.Zharkov 58c1b5dd1f K2: Optimize AbstractFirDeserializedSymbolProvider
Avoid filling caches with keys that are definitely empty
(if it's cheap to compute that), to decrease the size of backing maps.

The strategy is pre-computing the sets of names that might be met.
NB: the size of the sets is way fewer than a size of all queried names.
2023-01-19 10:57:42 +00:00
Dmitrii Gridin e2e87bd107 [FIR] CustomAnnotationTypeAttribute: drop redundant type specification
^KTIJ-23547
^KTIJ-24141
2023-01-19 10:53:05 +00:00
Dmitrii Gridin a49b72b05e [AA] update testData
^KTIJ-23547
^KTIJ-24141
2023-01-19 10:53:05 +00:00