forked from com-lihaoyi/mill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android Studio Integration: Attempt via bsp for Java android apps (co…
…m-lihaoyi#4362) ## This PR provides - ability to import a mill android project to android studio via BSP, including sources and generated sources. - necessary changes to the way sources are resolved (through module dependency instead of class inheritance). - Changes to tests (e.g. number of sources compiled) reflect these changes ### Not provided - Compilation still needs to be done from the command line in order for the paths to be resolved inside the IDE. Note that to make compilation, running, testing and debugging work from android studio, we'll need to develop a plugin for it ## Note This is an early draft and I need to cleanup or review a few rough edges, I submit this as a draft to get some early feedback. I've implemented java to get the basics to work, as kotlin has multiple kinds of sources and files that need to be taken care of, so this is just a small step. Don't hesitate to point out any issues as I've really just braced through and hacked around to get this to work! @0xnm @lihaoyi any feedback will be appreciated! ## Android Studio Integration The attempt focuses on BSP. Although bsp as a plugin does not seem to be available for android studio, it strangely becomes available if it is installed through intelliJ (see video) ### Basic changes - Use the moduleDeps instead of resolving the classpath bits (sources, resources) through inheritance. This makes BSP and studio integration work (see the directories that are highlighted correctly) - Crude implementation of bsp methods to get the IDE to report the imported modules correctly ### Tricky parts - Resources are compiled twice due to how aapt linking and later the module deps compile hierarchy. In order to avoid this, I've added an empty generatedSources method in android instrumentation module . ### Demo You can see in the demo most of the IDE static import features work (R is not recognised but I'll look into it either in this PR or subsequent). https://github.com/user-attachments/assets/77fe5e52-57e7-4480-9971-b50cc8d4d839 EDIT: I've fixed the R not being recognised and the kotlin import  EDIT 2: Added summary at the top
- Loading branch information
1 parent
3d71b15
commit 6b50855
Showing
12 changed files
with
102 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
example/android/javalib/1-hello-world/app/src/main/java/com/helloworld/SampleLogic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters