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 ; Add hello-world Android Java Example using Mill #3659

Merged
merged 9 commits into from
Oct 5, 2024

Conversation

himanshumahajan138
Copy link
Contributor

@himanshumahajan138 himanshumahajan138 commented Oct 3, 2024

Description

This PR fixes #3550 by adding a "hello-world" Android Java example using Mill.

Changes:

  • Created 1-hello-world folder inside example/javalib/android
    • This folder contains a src folder for sources and a build.mill file.
  • Created two modules:
    • AndroidSdkModule.scala: This module handles the SDK setup.
    • AndroidAppModule.scala: This module extends both AndroidSdkModule and JavaModule to ensure proper functionality.
  • In build.mill, extended the App module for building the Android application.
  • android_examples.adoc created and referred in navbar.adoc, finally tested.
  • Documentation done for android modules and build.mill and finally tested
  • Code is fully documented with references taken from example/{javalib,kotlinlib,scalalib} and scalalib/{Modules...}.
  • All the Documentation is checked locally (worlking as expected for scaladoc{AndroidAppModule, AndroidScalaModule})
  • Documentation and explanation of the code are embedded as comments within the code.
  • Included a screenshot of the application to demonstrate its functionality.

Type of Change

  • New feature (non-breaking change which adds functionality)

Related Issues

issue #3550

Testing

Tested by building the Android app using Mill, ensuring that both the AndroidSdkModule and AndroidAppModule work together as expected. Successfully generated the APK and verified the "Hello World" functionality.

Checklist

  • Created 1-hello-world folder with build.mill and sources
  • Created two modules AndroidAppModule.scala and AndroidSdkModule.scala
  • Created documentation file android_examples.adoc, above two modules also done.
  • Code builds and passes all tests.
  • Documentation Tested with local doc's creation
  • I have added comments in the code where necessary, updated the documentation accordingly.
  • Any dependent changes have been merged and published.

Additional Notes

Feel free to review the code and let me know if any further improvements are needed.

Screenshots

hello-world-android

@himanshumahajan138 himanshumahajan138 marked this pull request as draft October 3, 2024 18:57
@himanshumahajan138 himanshumahajan138 marked this pull request as ready for review October 3, 2024 19:42
@himanshumahajan138 himanshumahajan138 marked this pull request as draft October 4, 2024 07:43
@himanshumahajan138
Copy link
Contributor Author

@lihaoyi Sir please don't get irritated by my doubts(i am newbie) please clear my last doubt...

basically when i reviewed Json files(allSources.json, allSourceFiles.json .....so on) in the out folder:

allSources.json

{
    "value": [
        "ref:v0:c984eca8:/home/himanshu138/opensource/himanshu/mill/out/example/javalib/android/1-hello-world/local/testCached.dest/sandbox/run-1/app/src"
    ],
    "valueHash": -2002708993,
    "inputsHash": 1715811750
}

allSourceFiles.json

{
    "value": [],
    "valueHash": 1467096776,
    "inputsHash": 435515105
}

so after this i came to know that even JavaModule is unable to pick up my src files because it is also get path added with app becoz of which i am getting error of no source files and then i checked all previous examples/javalib/ and found this :

object `package` extends RootModule with JavaModule {...}

and when i tried this same thing then i got shocked this time it got the files and sources, see:

what i tired
object `package` extends RootModule with AndroidAppModule {...}

allSources.json
{
    "value": [
        "ref:v0:49c3a842:/home/himanshu138/opensource/himanshu/mill/out/example/javalib/android/1-hello-world/local/testCached.dest/sandbox/run-1/src"
    ],
    "valueHash": -1645131398,
    "inputsHash": 1044320490
}

allSourceFiles.json
{
    "value": [
        "ref:v0:60186141:/home/himanshu138/opensource/himanshu/mill/out/example/javalib/android/1-hello-world/local/testCached.dest/sandbox/run-1/src/main/java/com/helloworld/app/MainActivity.java"
    ],
    "valueHash": -249522556,
    "inputsHash": -470604943
}

Final Verdict: we also need to use package and make androidApp as a RootModule object

please share your thoughts and suggestions...

@lihaoyi
Copy link
Member

lihaoyi commented Oct 4, 2024

Yes the filesystem hierarchy has to match the module hierarchy

@himanshumahajan138
Copy link
Contributor Author

Yes the filesystem hierarchy has to match the module hierarchy

Thanks Alot Sir finally now i got answers to all of my doubts...

@himanshumahajan138 himanshumahajan138 marked this pull request as ready for review October 4, 2024 18:27
@himanshumahajan138
Copy link
Contributor Author

@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!

@lihaoyi
Copy link
Member

lihaoyi commented Oct 5, 2024

Thanks @himanshumahajan138 , I think it looks pretty good overall, let me try running some end-to-end tests on an android emulate on my laptop and then we can close this out

@himanshumahajan138
Copy link
Contributor Author

Thanks @lihaoyi Sir It's You who gave me another chance to show up my skills and contribute to Mill.

I hope all the tests pass successfully🤞

@lihaoyi
Copy link
Member

lihaoyi commented Oct 5, 2024

Tested locally on my android emulator, works great on my macbook. A few final comments and we can merge it.

@himanshumahajan138
Copy link
Contributor Author

That's great Sir I will do the required changes and push the final code asap

Thanks Alot @lihaoyi Sir

@himanshumahajan138
Copy link
Contributor Author

@lihaoyi Sir Finally It's done, Thank you so much sir for your help and support

@lihaoyi
Copy link
Member

lihaoyi commented Oct 5, 2024

Looks good, merging it and we can tweak it more in main. @himanshumahajan138 can email me your international bank transfer details and I can send you the bounty

@lihaoyi lihaoyi merged commit a946066 into com-lihaoyi:main Oct 5, 2024
24 checks passed
@lefou lefou added this to the 0.12.0 milestone Oct 5, 2024
@himanshumahajan138
Copy link
Contributor Author

@lihaoyi Sir I have sent the details to your email mentioned in your GitHub account.

Please Confirm the details...

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