Status Update
Comments
mk...@google.com <mk...@google.com>
je...@google.com <je...@google.com> #2
Agreed, we should add those to the model.
al...@google.com <al...@google.com>
mi...@gmail.com <mi...@gmail.com> #3
Any news? This should be easy and quick to fix.
al...@google.com <al...@google.com> #4
We are working on this. Currently it's a major refactoring of source directory mechanism to make it more extendable and less error prone. Another problem is that generated source directories do not publish correctly to the IDE in case there is no flavors in build.
al...@google.com <al...@google.com> #5
Fix will be in Android Studio Flamingo/AGP 8.0 Canary 2
mi...@gmail.com <mi...@gmail.com> #6
Thank you very much!
cm...@google.com <cm...@google.com> #7
Re-opening to target the previous release as the go/variant team depends on this API correctly causing studio to be able to resolve symbols from generated source directories.
cm...@google.com <cm...@google.com> #8
Cherry pick landed in ag/I9e83820137b8e1be1c84d207f3ae5280ef131592 & ag/I0595bee23937003c19b20307c63fdf69f561b57e which should land in AGP 7.4 Beta 3
fr...@gmail.com <fr...@gmail.com> #9
Is there any chance to cherry-pick this also to 7.3?
Description
The new Variant API SourceDirectoriesImpl.addGeneratedSourceDirectory() allows to add a custom task generating source files that need to be compiled within the build process, but does not add the generated source directory to the IDE model in TaskProviderBasedDirectoryEntryImpl .
It is used in replacement of the old API BaseVariantImpl.registerJavaGeneratingTask() that automatically added the generated source directories to the IDE model.
It seems to me that the old behavior should be maintained, i.e., either:
shouldBeAddedToIdeModel
totrue
by default in the constructor ofTaskProviderBasedDirectoryEntryImpl
,shouldBeAddedToIdeModel = true
when creatingTaskProviderBasedDirectoryEntryImpl
inaddGeneratedSourceDirectory
,addGeneratedSourceDirectory
for letting the user set the desired value ofshouldBeAddedToIdeModel
.Note that it should go the same way with SourceDirectoriesImpl.addStaticSourceDirectory() .
Also, I would personally not set the path of the output directory here if it has already been set by the user before calling
addGeneratedSourceDirectory
, since this overwriting is not documented and not obvious to the user. Or similarly toshouldBeAddedToIdeModel
, this behavior (setting or not the output directory) could be controlled through an optional argument toaddGeneratedSourceDirectory
.Please consider this other issue too that might be relevant as well (I did not try to reproduce it), it apppears not only in TaskProviderBasedDirectoryEntryImpl but also in ProviderBasedDirectoryEntryImpl .
Studio Build: #AI-213.7172.25.2211.8571212 (Android Studio Electric Eel | 2022.1.1 Canary 2)
Version of Gradle Plugin: 7.4.0-alpha02
Version of Gradle: 7.5-rc-1
Version of Java: 1.8
OS: Ubuntu 18.04