Commit Graph

70 Commits

Author SHA1 Message Date
Vyacheslav Gerasimov 13d87e8eae Remove as31 bunch files 2019-01-14 21:29:02 +03:00
Igor Chevdar 9fee03ca81 IR: Fixed some parents 2019-01-10 14:35:10 +03:00
Leonid Startsev 662c1b6d4a Make serialization plugin for Maven consistent with all other plugins:
Use correct import handler because old one was not working in IDE
Change maven artifact id to match pattern from other plugins
2018-12-26 18:53:53 +03:00
Marcin Moskala 686cfa6fd2 Fix common misspellings 2018-12-21 16:13:42 +03:00
Leonid Startsev fdf4f02dde Declare real external symbols for overriden by synthetic function
instead of unbound

Unbound symbols were throwing an exception on attempt to analyze them
in the other parts of compiler and are generally incorrect
2018-12-12 17:26:01 +03:00
Leonid Startsev f2e27da5bb Support @SerialInfo annotation for Native 2018-12-05 15:16:17 +03:00
Leonid Startsev 13af036024 Fix problem with encodeUnitElement : Unit instance is not needed in Native IR 2018-12-05 15:16:16 +03:00
Leonid Startsev b775501042 Translate KClass references to built-in types in serialization plugin correctly.
Add overload with ClassDescriptor to `getPrimitiveClass` translation function and increase it visibility to public to be usable from plugin.
2018-12-05 15:16:15 +03:00
Leonid Startsev 5f2cea917f Remove redundant check for 'all parameters are properties' in a case of fully-customized serializer 2018-12-05 15:16:15 +03:00
Leonid Startsev 7e32e2e9b9 Increase priority of @ContextualSerialization annotation on types 2018-12-05 15:16:14 +03:00
Leonid Startsev f13f54d5ad Fix "kotlin.UninitializedPropertyAccessException: lateinit property typeTranslator has not been initialized" in Native IR serialization plugin 2018-12-05 15:16:13 +03:00
Leonid Startsev 7c8b34fe1c Fix unresolved symbol to SerialDescriptor in KSerializer if it was
referenced from user custom serializer code (kotlinx.serialization/290)
2018-12-05 15:16:12 +03:00
Leonid Startsev 58c145210c Support for @UseSerializers annotation 2018-12-05 15:16:11 +03:00
Sergey Rostov 2fac72cd99 Move resources: remove build code that not required anymore 2018-11-30 15:01:02 +03:00
Sergey Rostov df2e4524d7 Move resources from /src to separate /resources directory.
Previously this files was stored in /src directory and was included in
resources mainly by SourceSet.projectDefault from sourceSets.kt:

val processResources = tasks.getByName(processResourcesTaskName) as ProcessResources
processResources.from("resources") { include("**") }
processResources.from("src") { include("META-INF/**", "**/*.properties") }

Also there are some custom rules like this:

resources.srcDir("../idea-analysis/src").apply { include("**/*.properties") }
resources.srcDirs("idea-repl/src").apply { include("META-INF/**") }

All this rules are synthesized in script
https://github.com/snrostov/kotlin-migrate-resources/blob/master/src/main/kotlin/main.kt

This commit created using that script. See README.md for more details on
 script.
2018-11-30 15:01:01 +03:00
Leonid Startsev 2e83ec1551 Restrict auto-implementing serializers methods to certain type of classes 2018-11-21 16:00:04 +03:00
Leonid Startsev 1535426a11 Don't add GeneratedSerializer as a supertype for user-defined serializers 2018-11-21 16:00:03 +03:00
Leonid Startsev a3e34af2f1 Increase priority of overridden serializer on type
Fixes Kotlin/kotlinx.serialization/252
2018-11-21 16:00:02 +03:00
Leonid Startsev 127ceaca34 Fix commented check when generating descriptor initializer:
It was needed before `save` because save references symbol of initializer,
yet we don't need to generate it if user provided its own getter
2018-11-21 16:00:01 +03:00
Leonid Startsev b76116a077 Do not add any .childSerializers() stuff if user explicitly marked custom serializer as KSerializer
todo: better design for user-provided descriptors and and schema hierarchy
2018-11-21 16:00:00 +03:00
Leonid Startsev 80c262ec66 Fix instantiation of generic serializers on JS
(Kotlin/kotlinx.serialization/244, which was fixed already by lookuping descriptor, but still had a bug)
2018-11-21 15:59:59 +03:00
Leonid Startsev a163e62f5f Rebased on master, adopt to new constant values from deserialized
annotations
Fix issue with generating redundant constructors for custom generic
seralizers
2018-11-21 15:59:58 +03:00
Leonid Startsev 2444a6680e .shouldEncodeElementDefault for JVM 2018-11-21 15:59:57 +03:00
Leonid Startsev 662e918a7b Support skipping values equals to defaults in output stream for JS and IR backends 2018-11-21 15:59:56 +03:00
Leonid Startsev dba6396e95 Support enums according to new design 2018-11-21 15:59:55 +03:00
Leonid Startsev f101e17dfa Support reference array and context serializers
Enum serializers are also instantiated, but won't work on native because of lack of KClass<E: Enum<E>>.enumValues()
2018-11-21 15:59:54 +03:00
Leonid Startsev ef42201b05 Fix order of overriding @Serializable(with) on property: check override, than @ContextualSerialization.
This will apply Context serializer event if class annotated @Serializable
2018-11-21 15:59:53 +03:00
Leonid Startsev abb8e5e914 Support @Transient properties initializers and init blocks in IR plugin 2018-11-21 15:59:52 +03:00
Leonid Startsev 104368de3b Better lookup for serializer() function in companion for generic classes because user can define a parameterless shorthand one
Fixes Kotlin/kotlinx.serialization/#228
2018-11-21 15:59:51 +03:00
Leonid Startsev 077f51e2f4 Generics serialization in IR 2018-11-21 15:59:50 +03:00
Leonid Startsev a4a1df0a81 Add information about secondary constructors to synthetic classes.
Before this, descriptors for such constructors were created in-place where they needed by the codegens.
However, presence of symbol table in IR backend requires the single instance of constructor descriptor across all compilation to be able to reference it and create a symbol. This support of generics in kotlinx.serialization on Kotlin/Native.
2018-11-21 15:59:49 +03:00
Leonid Startsev 01d3c7bdc8 Descriptors for IR 2018-11-21 15:59:48 +03:00
Leonid Startsev 3010814327 .childSerializers for JS 2018-11-21 15:59:47 +03:00
Leonid Startsev baf8cb6e9b Replace imported serialization-ide.jar with serialization-compiler.jar so JPS build also start working 2018-11-21 15:59:46 +03:00
Leonid Startsev e40383b1ce Introduce GeneratedSerializer and childSerializers
Descriptors passing on JVM
2018-11-21 15:59:45 +03:00
Leonid Startsev f0e81c6eb8 Respect @ContextualSerialization on file
Add common ancestor to all serializable generators
2018-11-21 15:59:44 +03:00
Leonid Startsev 82fa152514 Remove auto-applying ContextSerializer 2018-11-21 15:59:43 +03:00
Vyacheslav Gerasimov 4076923a26 as34: Apply changes from AS 3.3 2018-10-26 18:25:20 +03:00
Leonid Startsev b611facd71 Check if serialization plugin presents in the facet compiler classpath before applying extensions logic
#KT-27166 Fixed
2018-09-28 18:31:03 +03:00
Denis Zharkov ed7dd6fccb Minor. Move serialization annotation fq-names to IDE light-classes
They are a kind of a hack applied in light-classes and it'd be nice
to prevent them being used in irrelevant contexts

kotlin-serialization-compiler module should not depend on idea,
thus we can't use annotations directly there.

So, we copy-paste them and add a test on names consistency
2018-09-18 18:37:11 +03:00
Denis Zharkov a4b2e5964a Do not build dummy light classes for serialization-related classes
Otherwise, whether LazyLightClassMemberMatchingError happens
or other type of errors because serialization plugin expects
full resolution in the correct module

Currently, only @Serializable annotation leads to exceptions,
but just in case we consider both of them as potentially problematic

 #KT-26895 Fixed
2018-09-17 19:09:40 +03:00
Leonid Startsev fe9ce45e1d Add initialization of constantValueGenerator for correct work
Exception was thrown from serialization plugin after compiler
refactoring
2018-09-17 19:07:10 +03:00
Ilya Gorbunov a18770fbbb Remove projectDist dependency helper usages
Use default configuration dependencies instead of projectDist ones.
2018-09-12 06:05:05 +03:00
Leonid Startsev fa990174ef Rename kotlinx-serialization => kotlin-serialization
Discussed with @elizarov and @ilya-g
2018-09-11 17:31:38 +03:00
Leonid Startsev 585d584857 Minor: get rid of some compiler warnings in kotlin-serialization-compiler-plugin 2018-09-11 14:36:10 +03:00
Leonid Startsev 7011e9422d Rename kotlinx-gradle-serialization-plugin => kotlinx-serialization 2018-09-11 13:22:17 +03:00
Leonid Startsev 23fd0a6ec9 Split IDE part from kotlinx-serialization-compiler-plugin 2018-09-11 13:22:16 +03:00
Leonid Startsev dea69e4469 Integrate serialization plugin into big Kotlin plugin
Split import handlers into multiple files
Add empty Maven handler for Android Studio

Add testRuntime dependency on kx-serialization-plugin for all modules which require compiler
plugins in test classpath
2018-09-07 21:17:07 +03:00
Leonid Startsev 087f60389a Migrating to 1.3 preview API 2018-09-07 21:17:06 +03:00
Leonid Startsev 359a37c9c3 Fix after rebase 2018-09-07 21:17:05 +03:00