Closed matejdro closed 1 day ago
I don't think this is something I have a ton of control over unfortunately. I believe that behavior would be within the compose / kotlin compiler and how it generates metrics. I think you'd see the same behavior by just generating the compose compiler metrics for that module following the standard instructions - https://github.com/JetBrains/kotlin/blob/master/plugins/compose/design/compiler-metrics.md#enabling-metrics - please let me know if that is not the case though!
This tool could theoretically do what you suggest though, and generate empty / zero'd files on top of that, if it detected no files were generated as a result. Is there a use case you had in mind for why that would be valuable?
I admit that this was a bit of an XXYY problem.
The real problem here is that running Verify
task on such a project will cause a task to crash because the files inside do not exist.
That crashing behavior is specifically done by me in the tool when running the verify task. If no golden metrics exist, I throw an exception. I can see how that would be problematic though in a module like you mention with no main source set. I can look into giving a warning but still letting the task complete successfully
I took a stab at ignoring empty main modules for check / generate tasks - https://github.com/j-roskopf/ComposeGuard/pull/39
the behavior of failing check task with a valid main source set is still preserved
will play around with it a bit more before merging
Thank you!
no problem at all! pushed out 2.2.1 to maven central with the fix
In our project we have a module that is test-only (it only contains unit tests, including Composables, but not any main code). Since tests contain compose, this plugin is blanked-applied among other compose-related configuration.
But it appears that the
ComposeCompilerGenerate
will not generate anything when main source set is empty - presumably it should generate empty txt files and json stats file with all zeros?