Hey, <@U79JY5TL3>! I was looking into the above is...
# apollo-kotlin
e
Hey, @mbonnin! I was looking into the above issue, more specifically why is the
lint
task taking significantly longer with data builders enabled. And after realising that I can actually debug the task in Android Studio, I found out that the directory with the generated Apollo source is included both in the generated sourcesets and the java sourcesets (see screenshot in 🧵). I am not 100% sure, but I assume this is the cause. Anyway, is this intentional? Shouldn't this directory be only in the generated sourceset?
👀 1
message has been deleted
m
Anyway, is this intentional?
I'm not sure. Maybe this can be useful? (even if it surely doesn't look useful in your case)
Shouldn't this directory be only in the generated sourceset?
Maybe? We're using `srcDir()` on the kotlin sourceSet. I was not aware of an API to tell AGP that a specific directory is generated. I'll ask around
In theory, I believe lint should process generated files. Because generated files can be anything, they can for an example reference some resources. Having lint ignore those would create a lot of false positive for "find unused resources" for an example
But I'm not too versed in the lint world
e
I was not aware of an API to tell AGP that a specific directory is generated
What would be the goal? I see other folders in
build/generated/source
that are not marked as source, including where
BuildConfig.java
lives, but they are still picked up in the build.
In theory, I believe lint should process generated files.
There is a specific lint option to enable this, so I don't think that a library should overrule this, knowingly or not 😛
m
What would be the goal? I see other folders in
build/generated/source
that are not marked as source, including where
BuildConfig.java
lives, but they are still picked up in the build.
Does that mean
build/generated/source
is automatically picked up by the
compileKotlin
task?
e
Not an expert, but empirically, it seems so.
m
If that's the case then it means we have a serious problem with variants
e
ah, or maybe not then? xD
m
We always generate sources in the same folder and add it to variant source sets
The default being
main
. But I think we have tests that generate source in
build/generated/source/com/example
and add it to the
debug
variant
e
now I am noticing,
build/generated/source/kapt
has subfolders with the variants names which are marked as "generated sources root" too
but those don't appear in the lint config's
javaSourceFolders
😕
m
In all cases:
There is a specific lint option to enable this
Right 👍 , means we need to tell AGP that we are a generated dir, I'll dig ⛏️
Double checking: you're not on AGP 8.something, right?
e
nope, 7.2.1
I can update to 7.3.1, if it helps
m
But upgrading is always good 🙂
even if I don't expect magic to happen here
What method did you put your breakpoint in?
e
Sorry, many meetings today 😅
com.android.tools.lint.detector.api.LintModelModuleProject#getJavaSourceFolders
is the method that returns that list. A breakpoint where I could see that was in
com.android.tools.lint.LintCliClient#run(com.android.tools.lint.client.api.IssueRegistry, com.android.tools.lint.client.api.LintRequest, kotlin.jvm.functions.Function0<kotlin.Unit>, kotlin.jvm.functions.Function0<java.lang.Integer>)
, in
lintRequest
argument,
projects[0]
field.
m
Thanks!!