Migrate to KotlinPoet-metadata (#903)

* Add kotlinpoet version to properties

* Swap in kotlinpoet-metadata for kotlin-metadata in dependencies

* Don't use KotlinMetadataUtils and KotlinAbstractProcessor anymore

* Upcast to TypeElement

* Temporarily add direct kotlinx-metadata dependency

Something is wrong with packaging in my local kotlinpoet, will remove before

* Remove tags API from TargetParameter

No longer needed

* Add PropertySpec directly to TargetProperty, remove holder funs

Simplifies some things!

* Move generated annotation gen into type callback

Removes JsonClassCodegenProcessor completely from codegen API

* Remove unstable autocommon dependency

Won't be using this anymore after this change

* Manually put quotes jsonName in AdapterGenerator

Otherwise we could incur double escaping from kotlinpoet since we directly reuse possible-escaped parsed `@Json` name values

* Opt in to use `@UseExperimental` annotation for preview

* Rework and simplify metadata to just use kotlinpoet-metadata

This is hard to do in broken down 1:1 steps, but the net result is a much smaller implementation footprint, better error messages, and a simpler API interaction with the code gen API. There is some raw parsing of kotlinpoet types required (mostly around annotations), but otherwise it's pretty smooth sailing and a good test of the upcoming kotlinpoet-metadata support

* Declare KotlinPoetMetadataPreview directly

* Try to point to snapshots for CI build

* Update to classinspector API

* Remove TypeResolver API

No longer needed

* Kotlinpoet 1.4.0 final

* Fix missing import from rebase

* Remove old kotlin-metadata version
This commit is contained in:
Zac Sweers
2019-09-25 22:22:44 -04:00
committed by GitHub
parent 5f98e93698
commit 54d07b6cbf
11 changed files with 211 additions and 683 deletions

View File

@@ -31,15 +31,13 @@
<java.version>1.7</java.version>
<!-- Dependencies -->
<auto-common.version>0.10</auto-common.version>
<auto-service.version>1.0-rc5</auto-service.version>
<dokka.version>0.9.17</dokka.version>
<incap.version>0.2</incap.version>
<okio.version>1.16.0</okio.version>
<okio2.version>2.1.0</okio2.version>
<kotlin.version>1.3.40</kotlin.version>
<kotlinpoet.version>1.3.0</kotlinpoet.version>
<kotlin-metadata.version>1.4.0</kotlin-metadata.version>
<kotlinpoet.version>1.4.0</kotlinpoet.version>
<maven-assembly.version>3.1.0</maven-assembly.version>
<!-- Test Dependencies -->
@@ -118,11 +116,6 @@
<artifactId>kotlin-annotation-processing-embeddable</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>me.eugeniomarletti.kotlin.metadata</groupId>
<artifactId>kotlin-metadata</artifactId>
<version>${kotlin-metadata.version}</version>
</dependency>
<dependency>
<groupId>com.google.testing.compile</groupId>
<artifactId>compile-testing</artifactId>