Commit Graph

3745 Commits

Author SHA1 Message Date
Alexander.Likhachev a19bd2ed2e [Build] Migrate most of the build logic from Project.buildDir usage
It's going to be deprecated in Gradle 8.3

There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242
^KTI-1473 In Progress
2023-12-07 18:31:06 +00:00
Andrei Klunnyi 0a57c661fd Comment for LazyScriptDefinitionProvider's property
Relates to KTIJ-27951.
2023-12-07 16:37:35 +00:00
Dmitrii Gridin c5cba4c053 [FIR] builder: provide containingDeclarationSymbol
We cannot use only non-local declarations as anchors due to the same
resolution logic between member declarations of local classes, so we
have to support such cases as well

^KT-63042
2023-12-07 12:26:39 +00:00
Yan Zhulanow 7129bcc2b1 [Pill] Support production-on-test dependencies 2023-12-07 08:53:35 +00:00
Yan Zhulanow a7f6029076 [Pill] Delete obsolete run configurations 2023-12-07 08:53:35 +00:00
Yan Zhulanow d9a33b53ce [Pill] Update Kotlin source set fetching 2023-12-07 08:53:35 +00:00
Yan Zhulanow e4da639e1c [Pill] Remove 'jps-compatible' plugin from the root Kotlin project
'excludedDirs' definition is not needed anymore, so the plugin usage
is not really useful.
2023-12-07 08:53:35 +00:00
Yan Zhulanow d4153c1458 [Pill] Remove 'excludedDirs' usage from Pill extension
As it was the last usage of the Pill extension, it is going to be
removed in subsequent commits.
2023-12-07 08:53:35 +00:00
Yan Zhulanow e87ef36ef8 [Pill] Remove variant support from Pill, always import BASE modules
Pill variant configurations in build.gradle(.kts) files will be removed
in subsequent commits.
2023-12-07 08:53:35 +00:00
Yan Zhulanow 63379b2c03 [Pill] Only add the 'jvmJar' artifact for the main source set 2023-12-07 08:53:34 +00:00
Yan Zhulanow 4e8a5eec7f [Pill] Support KMP 'jvmJar' task convention 2023-12-07 08:53:34 +00:00
Yan Zhulanow a508a650a5 [Pill] Include embedded dependencies together with the module itself 2023-12-07 08:53:34 +00:00
Yan Zhulanow a703fc0f17 [Pill] Remove obsolete IDE plugin artifact creation 2023-12-07 08:53:34 +00:00
Yan Zhulanow 680db7c317 [Pill] Allow kotlin_dom_api_compat artifact 2023-12-07 08:53:34 +00:00
Dmitriy Novozhilov 139e1223ea [Serialization] Workaround registering static writeSelf method in metadata
`IrGeneratedDeclarationsRegistrar` assumes that all generated functions
  are correct from a Kotlin point of view. But `writeSelf` method on JVM
  is a static method outside any object/companion object

So to properly calculate containing class for this method we should
  generate a dispatch receiver parameter, register the method in metadata,
  and then remove the parameter (to make function static)
2023-12-05 10:21:40 +02:00
Dmitriy Novozhilov 51dcd7c076 [Serialization] Introduce utility for generation of IR annotation calls 2023-12-05 10:21:40 +02:00
Dmitriy Novozhilov c70c8f927e [FIR] Remove FirDeclarationsForMetadataProviderExtension extension
`IrGeneratedDeclarationsRegistrar` should be now used instead to register
  IR declarations in resulting metadata
2023-12-05 10:21:40 +02:00
Dmitriy Novozhilov d94ce4dcb8 [Serialization] Migrate to IrGeneratedDeclarationsRegistrar API
^KT-63591 Fixed
2023-12-05 10:21:39 +02:00
Dmitriy Novozhilov 159bc1b435 [IR] Introduce API to register generated IR declaration to be present in metatada
KT-63881
2023-12-05 10:21:38 +02:00
Dmitriy Novozhilov 1cdc8361d6 [IR] Rename IrAnnotationsFromPluginRegistrar to IrGeneratedDeclarationsRegistrar
In further commits, this service will be used not only for registering
  annotations, but newly generated IR declarations too
2023-12-05 10:21:27 +02:00
Roman Golyshev 776926518d KT-59732 [FIR] Add testdata to check incorrect imports with test compiler plugins 2023-12-04 16:51:46 +00:00
Leonid Startsev a035533316 Rename JvmMetadataVersion.CURRENT to JvmMetadataVersion.LATEST_STABLE_SUPPORTED. 2023-12-01 17:43:12 +00:00
Leonid Startsev 721af75f40 Provide a separate class for representing metadata version in kotlinx-metadata
Separate class allows encapsulating comparison, equality, and structure of version parts.
It also makes more sense from API standpoint than plain `IntArray`.
2023-12-01 17:43:11 +00:00
Leonid Startsev f101e5a336 Unify write() method and make it a member of KotlinClassMetadata
To make sure that the correct version and flags are preserved during metadata transformation,
they are now stored inside KotlinClassMetadata.
Such change also makes it possible to make write() a member function of KotlinClassMetadata, further simplifying API.
Also, it allows tracking whether readStrict or readLenient was used to read metadata and prohibit writing accordingly.

Also provide transform() method as a shortcut for readStrict+write.

Related to: #KT-59441
2023-12-01 17:43:11 +00:00
Leonid Startsev 36703ff9ae Implement strict and lenient modes for Kotlin metadata reading
In strict mode, an exception will be thrown when inconsistent metadata is encountered. In lenient mode, the reader will attempt to handle the inconsistent metadata by ignoring certain inconsistencies. This is a solution to a problem of reading metadata 'from the future' that is not allowed by default, but desired in certain cases. See updated ReadMe for details.

Also fix problem with Strict Semantics flag.

#KT-57922 Fixed
#KT-59441 Fixed
2023-12-01 17:43:11 +00:00
Nikolay Krasko 5e5e5b8b9f Revert "[FIR] Remove the redundant isFunctionType check"
This reverts commit 1f97c268e1.
2023-12-01 11:27:39 +01:00
Nikita Nazarov 1f97c268e1 [FIR] Remove the redundant isFunctionType check
^KT-63865 fixed
2023-11-30 14:17:01 +00:00
Ilya Goncharov 08e3cb300a [JS] Migrate tests onto IR compiler with outputDir API instead of outputFile
^KT-61117 fixed
2023-11-29 11:21:56 +00:00
Leonid Startsev 662bff7351 Make $serializer generic constructor public
If a serializable class has generic type parameters, its serializer is not an object
and has a specialized constructor. This constructor was public in K1 and should
be public in K2 so it can be called from other serializable classes
(in case class is e.g., part of sealed hierarchy).

#KT-63402 Fixed
2023-11-28 13:31:08 +00:00
Leonid Startsev 51e3e9af94 Use a correct type for SERIALIZER_TYPE_INCOMPATIBLE diagnostic.
This diagnostic used an incorrect type for rendering (outer class type instead of a property type)
and didn't expand type argument of `KSerializer`.

Also add an additional test case for generic parameters.

#KT-63570 Fixed
2023-11-28 13:30:45 +00:00
Mikhail Glukhikh 1260d03561 Drop erroneous FirJavaConstructorBuilder.visibility
Related to KT-62961
2023-11-28 13:30:26 +00:00
Leonid Startsev f7d87f6d70 Use type parameters' source information for kotlinx.serialization diagnostics
To be more consistent with K1, certain diagnostics should be reported
not on the whole properties' types, but on type arguments inside them.

Note that there is still a difference with K2 because K2 reports on a type argument
including its annotations, while K1 used KtTypeReference.typeElement.

IMO, K2 conveys the same or better meaning here, so I am willing to leave this
difference instead of providing PositioningStrategy.

#KT-53861 Fixed
2023-11-27 13:32:44 +00:00
Dmitriy Novozhilov ffe5b4c40d [Test] Update some IR dumps after previous changes
Now IR dump handlers receiver actualized IR with removed expected
  declarations, so corresponding tests should be updated accordingly
2023-11-27 10:17:54 +00:00
Ilmir Usmanov 37417f7919 KAPT: Use reflection to access code, changed in JDK 21
#KT-57389 Fixed
2023-11-22 14:58:55 +00:00
Ilmir Usmanov 4f7c96ae43 KAPT: Always print parens on empty annotation parameters
Since JDK 17+ pretty-printer does not print parens on empty annotation
parameters, print them anyway. Otherwise, tests with annotations differ
on different JDKs.
 #KT-57389
2023-11-22 14:58:55 +00:00
Ilmir Usmanov 87aed4bf47 KAPT: Run tests on JDK 21
Previously, some tests have also been disabled on JDK 11+, since
we did not filter out empty filesets, which led to failed assertion
inside JDK.
 #KT-57389
2023-11-22 14:58:55 +00:00
strangepleasures a35191706f [KAPT] Minor. Fix the signature of printField method
Merge-request: KT-MR-13154
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-11-21 17:55:51 +00:00
strangepleasures f32fd314f8 [KAPT] Adhere to the call conventions when instantiating and using KtAnalysisSession
Merge-request: KT-MR-13098
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-11-21 13:21:19 +00:00
strangepleasures 03ed1d1d31 KT-62560 [SLC] Fix handling of empty varargs in annotations 2023-11-20 20:57:21 +00:00
Vyacheslav Gerasimov fbc35975ab Build: Fix kotlinx-serialization-compiler-plugin compat artifacts
To avoid adding unexpected files we should add single file into
artifacts instead of directory.
 #KTI-1394
2023-11-20 14:37:54 +00:00
Pavel Kunyavskiy faaefbd8e7 [IR] Move .parents and .parentsWithSelf to IR utils
^KT-62292
2023-11-20 08:31:41 +00:00
strangepleasures 9c2ce475e2 KT-60821 [KAPT] Generate stubs without KaptTreeMaker
Merge-request: KT-MR-12979
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-11-16 21:14:36 +00:00
Ivan Kochurkin 7ce0284e81 [FIR] Introduce isRealOwnerOf utility function 2023-11-15 17:56:03 +00:00
Nikolay Lunyak 44d6d10233 [FIR] Only check conflicting callables that may clash with declared ones
This change improves performance, as
checking callables via scopes in
`4e587157` turns out to be quite
slow, and it also prevents some redundant
diagnostics.
2023-11-15 07:56:32 +00:00
Iaroslav Postovalov a3b55cf758 [IR] Drastically simplify the hierarchy of IR origins
IrStatementOriginImpl and IrDeclarationOriginImpl were made final
classes to simplify the creation of them (a delegate provider was
added) and to optimize performance when comparing the origins by type
and name
2023-11-13 17:56:09 +00:00
Ilya Chernikov a47ee44e65 Scripting: refactor test infrastructure - add missing stderr handling 2023-11-10 17:24:12 +00:00
Leonid Startsev 4fa121071a Update kotlinx-serialization dependency for serialization compiler plugin tests.
Properly set up dom-api-compat dependency for JS IR tests. Since this dependency is added
automatically for every Kotlin/JS library, it should be present during tests just as stdlib.

As a result, tests for serializable enums were changed since 1.6.0 runtime does not require enums to be explicitly serializable.
2023-11-10 14:14:04 +00:00
Roman Golyshev 500dd20277 KT-63096 [LL] Add test for using annotation from other module for compiler plugin 2023-11-09 23:39:32 +00:00
Brian Norman 0d36462c58 [Parcelize] Align checker and generator on valid Parcelize classes
A previous fix to the generator made the generator and checker
validation of classes which could be parcelized different. The checker
would report error in cases where the generator would not generate
anything. Align these checks, with improved code sharing, so errors are
not reported on classes which will not have parcelize components
generated.

^KT-63086 Fixed
2023-11-08 14:35:28 +00:00
Brian Norman f8ee8adfde [Parcelize] Fully expand type aliases when checking for RawValue
^KT-61432 Fixed
2023-11-08 12:48:36 +00:00