More compete documentation and/or examples for external system api

I'm working on a custom external system plugin. I would really appreciate some more in depth documentation or examples for the api in general, especially surrounding the Project, Module, DataNode and other api's relating to project and module structure. Also the apis needed to customize the project tool panel structure aside from the custom project/module tree generated in the Project Resolver.

I've looked at the Gradle plugin in depth but it is overly complicated with layers of helpers and hooks so its not particularly useful as an example.

 

Also having some weird results with how intellij is displaying the module groups, and trying to be clever with pulling modules out of their implicit groups (all modules are named with "dot.paths" and while many are properly nested, many are also pulled out into a grand parent group which makes a mess of the tree.

1
5 comments

Hi Thomas. You can find documentation here http://www.jetbrains.org/intellij/sdk/docs/welcome.html

Yes, unfortunately External System API documented less than one would like, so the best way is to read gradle plugin code as an example.

You can start from implementing your own implementation of ExternalSystemManager, and settings classes (this is an entry-point to your plugin), implementation of ExternalSystemProjectResolver to convert your external model to IDEA project data and your own implementation of ExternalSystemTaskManager to run external tasks (like gradle compile, e.g.) Please fell free to ask if somthing is unclear

I've also seen your previous post and it is not clear for me, what you mean under same "module root", but with a different subset of the files. Do you want to use one directory as source dir for different modules?

 

 

0
Avatar
Permanently deleted user

Yeah, I've seen the documentation, or at least did when I first started working on this plugin. It's less than I'd like.. I've already got an exeternal system manager, project resolver and settings stuff. I initially did base a lot of it on some of the gradle code, but it is WAY over engeineered for what I need my plugin to do and trying to dig through the various layers to figure out what is going on is tedious and usually fruitless.

 

As for the question, yes. Basically one directory can house multiple "artifacts", eg: libraries and executables or apps. I've seen some of the build files specify a dozen diferent outputs. The interesting part is the build files themselves can change the entire of the visible tree... artifacts will depend on various other artifacts in the same or other modules. Its a pretty complex and arcane setup. theres millions of lines of code and hundreds of individual modules or artifacts. And the visible modules change depending on the build configuration. 

 

I'm currently trying to just make one module for all shared source roots, then trying to do something about the artifact dependencies, but I'm honestly not sure how to handle any of this. I have a large number of questions about this but so far don't know which ones are even valid till I get something approaching usable. You'll see from the screenshot above that intellij is doing some weird stuff with the module list I've built. My current thought is I'll manually create the module tree using the DataNode api rather than just a bunch of modules that are direct children of the ProjectData node. this way I might get a bit more control over the display. perhaps?

 

Oh, one issue I've had is that it can take intellij a long time to process the module data after my plugin has finished. Sometimes longer than it took me to scan the multi MB mess of 2000+ build files (which currently takes about 2-3min).

0

Well, you can look into other third-party implmenetations of external system api plugin. https://github.com/cbeust/kobalt-intellij-plugin 

Could you please confirm, do you want to create 2000+ modules?

0
Avatar
Permanently deleted user

The number of modules I actually need to create is something I'm not sure about. There are thousands of different artifacts (libraries, executables, apps, etc), but the actual final structure that would be useful and useable is something I haven't figured out yet. I'm trying to start off with making a few explicit module groups (which I finally found out how to do using the undocumented method: ModuleData.setIdeModuleGroup) and then some modules for the main container source roots in each group. That alone is probably going to result in hundreds of modules. I haven't counted yet.

I still can't get the project tree view to display things in a sane way yet. My first few attempts at building the project data led to some weird behavior with some modules appearing more than once, and the ide deciding to not display some things in groups and other things in groups.. etc. it made no real sense to me how intellij decides to auto group modules. So as I mentioned above, I'm re-structuring it by using explicit groups by telling the module its actual group name via ModuleData.setIdeModuleGroup, and then trying my best to filter things into sane logical modules.

I'm starting to think that I don't need to worry about module dependencies and whatnot since intellij won't be doing the building itself. But I /think/ I'd like to expose the individual artifacts in some visual way at the very least. like: "this directory contains a module that contains X artifacts that in the external build system are individual modules". 

People using this plugin will probably expect that things have similar names and structures to the external build system. So they'd want to be able to easily look for and find "libxyz" even if its contained in a intellij module that actually contains "libxyz", "libxyz-blah", "xyx-prog", etc because they all share the same source root, but not necessarily the same source files. 

I'm just stuck at the moment.

 

I did end up trying to create a nested tree of modules (where the parent modules were all "empty" except for child/leaf modules), but that did not work at all. Any deeper than like two and intellij won't show them at all it seems.

0
Avatar
Permanently deleted user

Another issue is that I can't create a module where the source root is the same as the module root. Intellij just fails the import.

0

Please sign in to leave a comment.