slackhq / foundry

Gradle and IntelliJ build tooling used in Slack's Android repo
https://slackhq.github.io/foundry/
Apache License 2.0
432 stars 21 forks source link

[Bug] Lint baseline is not generated #813

Open saurabharora90 opened 7 months ago

saurabharora90 commented 7 months ago

https://github.com/slackhq/slack-gradle-plugin/blob/2670eb302109c6b15f60008d1314802b144c5427/slack-plugin/src/main/kotlin/slack/gradle/lint/LintTasks.kt#L341

Lint is not generating a baseline.xml when using the Lint task from this plugin. The issue seems to that the baseline file is being configured in library modules as well, whereas instead it should only be done for Application Modules. Adding a

if (androidExtensionNullable is ApplicationAndroidComponentsExtension)

before configuring the baseline file seems to resolve the issue. Given checkDependencies is enabled for app modules, it makes sense to enable baseline also just for app modules.

I have this working locally and can send a PR if you are open to contributions and agree with the change. Didn't file it under discussion as it was more of a bug than a feature request :)

ZacSweers commented 1 month ago

sorry for the delay on this!

it should only be done for Application Modules

I'm not sure I follow this. We run lint with baselines on both library and application projects. In our application project, we only run lint with UnusedResources and nothing else. Could you elaborate on why you think this option only applies to application projects?

saurabharora90 commented 1 month ago

Could you elaborate on why you think this option only applies to application projects?

Been a while since I had filed this. Let me rejig my memory, look through the code again and I'll get back, otherwise will close the issue if I can't!