-
Notifications
You must be signed in to change notification settings - Fork 282
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
Remove Filer writing and originating elements concept. #93
Conversation
These stem from javac annotation processors inside which Kotlin cannot be generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all red diffs are the best diffs
Hi, if you don't mind me asking : why removing the |
javac can't compile kotlin code so that method is useless.
…On Fri, Jun 2, 2017 at 11:43 AM Maxime Toumi ***@***.***> wrote:
Hi, if you don't mind me asking : why removing the writeTo(Filer)?
I've created an annotation processor for android which generates kotlin
files to Filer.createResource(SOURCE_OUTPUT, ...) and it works like a
charm.
I was hoping to use writeTo(Filer) when switching to kotlinPoet
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#93 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEf1lYgCH7wm4ncyAnnaHLYpMGnaXks5sAC2QgaJpZM4Nl9eE>
.
|
javac can't for sure but i'm using android studio 3 (canary) and the default kotlin buildchain compile the generated kotlin files in |
Please provide a sample which demonstrates this behavior
…On Fri, Jun 2, 2017 at 12:35 PM Maxime Toumi ***@***.***> wrote:
javac can't for sure but i'm using android studio 3 (canary) and the
default kotlin buildchain compile the generated kotlin files in Filer.createResource(SOURCE_OUTPUT,
...)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#93 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEES6ZU23Wkk7toUDDVuYL6ME_2WLOks5sADnbgaJpZM4Nl9eE>
.
|
Here is a sample :
...
fun Maker.getDummy() = "Test String"
...
@MakerAnnotation
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
(findViewById(R.id.txt_view) as TextView).text = Maker().getDummy()
}
} P.S.: the private fun getWriter() : Writer = processingEnv.filer.createResource(
StandardLocation.SOURCE_OUTPUT, "com.example.extension", "MakerExtension.kt").openWriter() |
I mean an executable sample
…On Fri, Jun 2, 2017 at 12:40 PM Maxime Toumi ***@***.***> wrote:
Here is a sample :
- In
app/build/generated/source/kapt/debug/com/example/extension/ViewMakerExtension.kt
(generated):
...fun Maker.getDummy() = "Test String"...
- In app/src/main/java/com/example/MainActivity.kt:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
(findViewById(R.id.txt_view) as TextView).text = Maker().getDummy()
}
}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#93 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEcByeKCyRJsLEbItsJUNrSwAxEUfks5sADsAgaJpZM4Nl9eE>
.
|
Here is the sample |
Wow interesting! I've never used kapt. I'm surprised it does this. We
potentially might want to revert this then.
…On Fri, Jun 2, 2017 at 2:02 PM Maxime Toumi ***@***.***> wrote:
Here is the https://github.com/max4t/KotlinGeneratingProcessor
<http://sample>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#93 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEe7Qgi_uaPe6uuMo1cttKziAdMJdks5sAE5RgaJpZM4Nl9eE>
.
|
Thanks that would be great. It works because |
Hmm that's kapt1 though which is deprecated. Does it work with kapt3?
…On Fri, Jun 2, 2017 at 3:19 PM Maxime Toumi ***@***.***> wrote:
Thanks that would be great.
It works because kapt.generateStubs = true in app/build.gradle otherwise
you get an missing reference.
I don't remember exactly how it works but if i recall correctly kapt
generated the references (the stubs) without content so that javac doesn't
complain and then all is linked at the end or something like that
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#93 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEXQ2mRwbqjCmibkaJqCNDoNJI3nwks5sAGAlgaJpZM4Nl9eE>
.
|
It seems like by default kapt1 is used. kapt3 is available by adding With
is useless (as announced in the blog paragraph |
Hi @JakeWharton @max4t any update here? |
These stem from javac annotation processors inside which Kotlin cannot be generated.