Skip to content
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

Fixes:#3550; Added hello-world Android Kotlin example using Mill #3679

Merged
merged 6 commits into from
Oct 8, 2024

Conversation

himanshumahajan138
Copy link
Contributor

Pull Request

Fixes: #3550

Description

Added Kotlin Android "Hello World" Application Example while reusing AndroidSdkModule, KotlinModule and creating new Module AndroidAppModule with Kotlin Support and Proper Documentation.

Related Issues

Checklist

  • Android Support for Kotlin Added in the example section for "HelloWorld" Android Application.
  • Added Kotlin Source files and Customized AndroidAppModule.
  • Code is clean and follows project conventions.
  • Documentation has been updated.
  • Tests have been added or updated.
  • All tests pass.

Additional Notes

Actually, I was wondering that we reused the AndroidSdkModule but created a new Module AndroidAppModule for Andorid Workflow but what we can do is to provide Kotlin support in the Existing AndroidAppModule and then based on user query they can use the functionality.

So for this i need @lihaoyi Sir your Permission and Guidance, Please Review this PR suggest changes...

@himanshumahajan138 himanshumahajan138 changed the title Fixes:#3550; Add hello-world Android Kotlin example using Mill Fixes:#3550; Added hello-world Android Kotlin example using Mill Oct 6, 2024
@himanshumahajan138 himanshumahajan138 marked this pull request as draft October 7, 2024 14:33
@himanshumahajan138
Copy link
Contributor Author

Final Changes

  • mill.kotlinlib.android.AndroidAppModule Renamed to AndroidAppKotlinModule
  • Extended mill.javalib.android.AndroidAppModule for App related tasks and redefine androidJar task for Kotlin Compilation
  • Fixed and Updated Documentation
  • All Tests Passed

Note

@lihaoyi Thankyou Sir for the detailed feedback!

I’ve addressed all the requested changes and resolved the comments. Please let me know if anything else needs attention.

Please pardon me if I missed anything or made a mistake. Looking forward to your final review and any further suggestions!

@himanshumahajan138 himanshumahajan138 marked this pull request as ready for review October 7, 2024 16:03
Comment on lines 47 to 59
def androidJar: T[PathRef] = Task {
val jarFile: os.Path = T.dest / "app.jar"

os.call(
Seq(
androidSdkModule().d8Path().path.toString, // Call D8 tool
"--output",
jarFile.toString, // Output JAR file
"--no-desugaring" // Disable desugaring
) ++ os.walk(compile().classes.path).filter(_.ext == "class").map(
_.toString
) // Get Kotlin class files, this calls compile task from Kotlinlib
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? Isn't this the same as the implementation in AndroidAppModule?

Copy link
Contributor Author

@himanshumahajan138 himanshumahajan138 Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sir it is same but think of situation like if we will implement this one(androidJar) from the AndroidAppModule then in that case our AndoridAppModule is extending JavaModule and in this we have compile function for .java extension only and we need this for .kt this time so like we extended the KotlinModule in AndroidAppKotlinModule then we need to call compile function here so that it will take function from the KotlinModule rather than the JavaModule

This is My Hypothesis or Approach is this correct ?

please extend the Conversation Sir with your thoughts...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This def does nothing, KotlinModule already overrides compile

Copy link
Contributor Author

@himanshumahajan138 himanshumahajan138 Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its shame for me actually it worked i tried this now 😅

no worries i will update the code just give me 5 mins

sorry for this misconception

Copy link
Contributor Author

@himanshumahajan138 himanshumahajan138 Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lihaoyi Sir it worked even without AndroidSdkModule Abstract 😅

i removed this too...

this is what lack of experience looks like (shame on me), highly inspired by your expertise thanks for guidance Sir...

@lihaoyi
Copy link
Member

lihaoyi commented Oct 8, 2024

Look great @himanshumahajan138 , will merge it and close out that part of the bounty

@lihaoyi lihaoyi merged commit 017b86a into com-lihaoyi:main Oct 8, 2024
24 checks passed
@lefou lefou added this to the 0.12.0 milestone Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add hello-world Android Java & Kotlin examples using Mill (2000USD bounty)
3 participants