Status Update
Comments
da...@google.com <da...@google.com>
yb...@google.com <yb...@google.com> #2
sgtm, we can add the same API for FileSpec:
I recommend using github for a small checkout size:
Looks like we do have kotlin poet in the repo:
So just need to add it as an API dependency to the room-compiler-processing's build file.
If you can add a test to the generated code match test, that would be great:
lmk if you hit any blocker in getting started, thanks!
ap...@google.com <ap...@google.com> #3
Branch: androidx-main
commit 4a2360456d817b3101f289aac55ea1f3f610cfef
Author: Gabriel Freitas Vasconcelos <gfreivasc@gmail.com>
Date: Thu Mar 11 14:54:53 2021
[GH] Adds KotlinPoet integration to Room Processing
## Proposed Changes
Adds `write()` method that accepts KotlinPoet's an instance of
`FileSpec`. Also adds KotlinPoet as an API dependency and an extension
function similar to that of JavaPoet.
## Testing
Test: ./gradlew test connectedCheck without benchmarks
## Fixes
Fixes: [
This is an imported pull request from
Resolves #137
Github-Pr-Head-Sha: 96dc315b7e0e417e6a5e3d8cd6a8adda5c1b6c6a
GitOrigin-RevId: c5e4de3ab28fed968982e572c47b5ff07d210af7
Change-Id: I9d3aaa0a752447d9ba3978ce3fb705c0e74b3d13
M room/compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationResultSubject.kt
M room/compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/Source.kt
M room/compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/GeneratedCodeMatchTest.kt
M room/compiler-processing/build.gradle
M room/compiler-processing/src/main/java/androidx/room/compiler/processing/XFiler.kt
M room/compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacFiler.kt
M room/compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacProcessingEnv.kt
M room/compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspFiler.kt
M room/compiler/src/test/kotlin/androidx/room/testing/test_util.kt
yb...@google.com <yb...@google.com>
[Deleted User] <[Deleted User]> #4
All
Description
Version used: 2.3.0-beta02
Theme used: --
Devices/Android versions reproduced on: --
Currently, the XFiler interface will allow writing to JavaPoet's `JavaFile`. In my project, the language of generated code in one of the steps relies on the processing backend. I'm testing it in a project and stumbled upon a specific scenario where I need both. That is because KSP will not parse generated Java code (will it?), and KAPT will not run another round for generated Kotlin code.
It would be nice to have a way to use XFiler to write KotlinPoet code. Perhaps through a `write()` method that takes `FileSpec`. I could issue a PR with these changes.