Soong build system model is different with default idea project model. There is a couple of incompatibilities:
Soong blueprint is a separate module with own sources, dependencies and artifacts. Set of blueprints share single content root directory but Intellij IDEA does not support different modules with the same content root.
Also Intellij IDEA does not support selecting a single source file and only allows to create source folders. On the other hand soong allows to select files by wildcards.
This problems cause that Intellij IDEA project structure differs of soong's one. Current implementation does not allow to index sources and libraries correctly.
In this branch I've added a blueprint toolwindow that structures all AOSP blueprint in a tree view. Double click on a single blueprint creates a module structure of this blueprint that is built in a way that IDEA can understand.
Goals
Provide a correct module structure to Intellij IDEA.
Reduce resource consumption allowing not to index all AOSP tree.
Provide a view to display blueprints structure.
How to test it
Create an empty IDEA project.
Open a blueprint toolwindow (on the right panel)
Enter an absolute path to AOSP source root and click "Refresh" button
Wait until it indexes all .bp files (now it's running in UI thread but should be moved to bg)
Select a blueprint with type android_app or android_library (for example, SystemUI-core)
Wait until plugin creates a directory and module structure.
After it IDEA index all modules.
NOTE!! When modules are created Intellij IDEA starts to index sources but it does not show default 'Indexing' status. So you need to wait until dependencies are resolved. On my hardware it takes about 5-7 minutes to index SystemUI-core and it's deps.
Plugin creates a directory for selected module and all it's source dependencies. Then it creates a directory structure same as in AOSP but it does not collide between modules and includes to it all .jar dependencies. All files are created via a hard link to original files, so changes made in IDEA will affect original files. Also it calculates source roots based on "package" in .java and .kt files.
This demo does not support all features. It does not copy resources, aidl and hidl files (only its generated sources), R files. It does not configure kotlin and android facets. But all this features can be implemented in future.
The problem
Soong build system model is different with default idea project model. There is a couple of incompatibilities:
This problems cause that Intellij IDEA project structure differs of soong's one. Current implementation does not allow to index sources and libraries correctly.
Possible solution
Take a look at demo https://github.com/Vlad8161/AndroidBlueprintPlugin/tree/blueprint-view. It's not a production ready implementation but can illustrate a core idea.
In this branch I've added a blueprint toolwindow that structures all AOSP blueprint in a tree view. Double click on a single blueprint creates a module structure of this blueprint that is built in a way that IDEA can understand.
Goals
How to test it
NOTE!! When modules are created Intellij IDEA starts to index sources but it does not show default 'Indexing' status. So you need to wait until dependencies are resolved. On my hardware it takes about 5-7 minutes to index SystemUI-core and it's deps.
Plugin creates a directory for selected module and all it's source dependencies. Then it creates a directory structure same as in AOSP but it does not collide between modules and includes to it all .jar dependencies. All files are created via a hard link to original files, so changes made in IDEA will affect original files. Also it calculates source roots based on "package" in .java and .kt files.
This demo does not support all features. It does not copy resources, aidl and hidl files (only its generated sources), R files. It does not configure kotlin and android facets. But all this features can be implemented in future.