-
-
Notifications
You must be signed in to change notification settings - Fork 350
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
Add Android Linting Example #3931
base: main
Are you sure you want to change the base?
Conversation
@c0d33ngr looks good, need to include an example test and explanation so we can include it in the documentation |
@c0d33ngr Buddy you did just basic linting but this is not the appropriate way tbh i have tried this on my example and its saying the miss of class file but class files only come after the compilation so @lihaoyi i request you to please wait till my new pull request(anndroid bundle support) gets merged coz in that i have updated the whole android app building process and made it professional (now we can include custom resources) so @c0d33ngr sorry to interrupt you, but please understand... |
@himanshumahajan138 completing bounties out of order is fine. I'll look at your PR if you wish and we can decide which one to merge first |
Ya I Agree We can decide which one to merge first i was saying before becoz there will be need for updated code as you can see in my pr i have updated the codes with resources so that's the only thing i was concerned about rest we can decide this... |
@lihaoyi this command below produce the error output above. What could be wrong? |
@c0d33ngr the lint error should be fixed in latest main branch, if you merge in main it should work. Give me some time to do a proper review, I'm not familiar with android haha |
FYI I'm planning on landing #3935 first before coming back to this, since that one is a larger and more invasive PR so this one would be easier to rebase/merge after |
* specifying lint rules, managing reports, and more. | ||
*/ | ||
@mill.api.experimental | ||
trait AndroidLintModule extends AndroidSdkModule with JavaModule { |
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.
Why are we inheriting from both AndroidSdkModule
and JavaModule
? Those are typically not mixed in together, so there's something weird here. It should be on one or the other but not both, and from the usage example I'm guessing it should instead inherit from AndroidAppModule
/** Usage | ||
|
||
> ./mill show app.androidLint # Display full path to the linting report in HTML | ||
".../out/app/androidLint.dest/report.html" |
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.
We should use cat
on the HTML report to ensure certain lint errors get picked up and properly reported, and discuss how the code in MainActivity.java
results in the lint warnings reported
|
||
// Actual android application | ||
object app extends AndroidLintModule { | ||
def androidSdkModule = mill.define.ModuleRef(androidSdkModule0) |
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.
Let's include an example custom lint configuration here so people know what it looks like
/** | ||
* Path to the project for which lint should run. | ||
*/ | ||
def projectPath: T[PathRef] = Task.Source { millSourcePath } |
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.
Do we need this? Or can we just use millSourcePath
everywhere instead?
/** | ||
* Specifies the file format of lint report. | ||
*/ | ||
def lintReportFormat: T[String] = Task { "html" } |
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.
The comment should list the possible formats we are aware of
/** | ||
* Additional options for lint (e.g., enabling/disabling specific checks). | ||
*/ | ||
def lintOptions: T[Seq[String]] = Task { Seq("--check", "NewApi,InlinedApi") } |
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 tasks in this module should be prefixed by androidLint
to make it clear where they come from and avoid collisions with tasks coming from other traits that get mixed in
Took a review pass. Looks like a straightforward change but left a few nits |
I'll do the necessary changes and also include more features to it. I had to rewrite it as a module after looking through java linting in the codebase and also other android related modules |
This is meant to to be a draft of item number 4 of issue #3868. The android linting
Hi @lihaoyi is this close to what you have in mind about the android linting or there's more?