Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve optics processor #852

Merged
merged 17 commits into from Jun 10, 2018
Merged

Improve optics processor #852

merged 17 commits into from Jun 10, 2018

Conversation

nomisRev
Copy link
Member

Closes #848

@nomisRev nomisRev force-pushed the simon-improve-optics-processor branch from a3f51d8 to 34ba752 Compare June 6, 2018 21:23
@nomisRev
Copy link
Member Author

nomisRev commented Jun 6, 2018

@arrow-kt/maintainers After discussion with @JorgeCastilloPrz I updated this PR to generated code as follows:

  1. The file must be generated with the same package as the annotated target (Generate classes on target class packages #765)
  2. Folder structure must match the target's package.
  3. The file name must match annotated target name + some postfix.

i.e.

package com.domain.my

@optics data class Person(val name: String, val age: Int)

Result should be in a file kaptKotlin/main/com/domain/my/Person$$optics.kt

If everyone agrees should we write this down somewhere in a Contributor wiki? (I thought we had one, did we remove it?)

@codecov
Copy link

codecov bot commented Jun 6, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@d7c1931). Click here to learn what that means.
The diff coverage is 53.88%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #852   +/-   ##
=========================================
  Coverage          ?   44.65%           
  Complexity        ?      615           
=========================================
  Files             ?      303           
  Lines             ?     7771           
  Branches          ?      837           
=========================================
  Hits              ?     3470           
  Misses            ?     4000           
  Partials          ?      301
Impacted Files Coverage Δ Complexity Δ
...essor/src/main/java/arrow/optics/AnnotationInfo.kt 100% <ø> (ø) 0 <0> (?)
.../src/main/java/arrow/optics/PrismsFileGenerator.kt 100% <ø> (ø) 0 <0> (?)
.../src/main/java/arrow/optics/DslSnippetGenerator.kt 0% <0%> (ø) 0 <0> (?)
...ssor/src/main/java/arrow/optics/OpticsProcessor.kt 58.73% <57.14%> (ø) 31 <16> (?)
...ssor/src/main/java/arrow/optics/AnnotatedDomain.kt 78.12% <76.66%> (ø) 0 <0> (?)
...or/src/main/java/arrow/optics/IsosFileGenerator.kt 78.26% <80%> (ø) 0 <0> (?)
.../src/main/java/arrow/optics/LensesFileGenerator.kt 94.44% <94.44%> (ø) 0 <0> (?)
...rc/main/java/arrow/optics/OptionalFileGenerator.kt 95% <94.44%> (ø) 0 <0> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7c1931...0847863. Read the comment docs.

else -> prism.left()
}
},
reverseGet = { it }
reverseGet = ::identity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@raulraja raulraja merged commit 5cae954 into master Jun 10, 2018
@raulraja raulraja deleted the simon-improve-optics-processor branch June 10, 2018 23:10
RawToast pushed a commit to RawToast/kategory that referenced this pull request Jul 18, 2018
* fix AP tests

* Add OpticsProcessor check to verify unnamed companion object

* Generate single file per annotated element

* Re-enabled grained control for DSL generation

* Small clean up Optics processors

* Remove unused reflection usage

* Update formatting generated code Lens & Iso

* Fix tests

* Update DSLTest with new syntax

* Update Snippet so it belongs to an annotated target

* Generate file per annotated target in corresponding directory

* Test code generation in correct folder structure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants