Command line tool OpenAPI


The latest EAP announcement says an API for command-line tools has been created (presumably for Fabrique). After an absolutely minimal search, I'm unable to find the API. I'd like to create a command-line interface to the MetricsReloaded functionality, enabling it to be done as part of a build (much like the off-line inspections API).

--Dave Griffith

7 comments
Comment actions Permalink

Take a look at com.intellij.openapi.application.ApplicationStarter interface.
If you'd provide its implementation by means of com.intellij.appStarter extension
point - you're done.

You may take com.intellij.errorReporter extension in your InspectionGadgets
plugin.xml as a reference sample on how to provide extensions to extension
point.

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

The latest EAP announcement says an API for command-line tools has
been created (presumably for Fabrique). After an absolutely minimal
search, I'm unable to find the API. I'd like to create a command-line
interface to the MetricsReloaded functionality, enabling it to be done
as part of a build (much like the off-line inspections API).

--Dave Griffith




0
Comment actions Permalink

Surprisingly, it has javadocs.

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

Take a look at com.intellij.openapi.application.ApplicationStarter
interface.
If you'd provide its implementation by means of
com.intellij.appStarter extension
point - you're done.
You may take com.intellij.errorReporter extension in your
InspectionGadgets plugin.xml as a reference sample on how to provide
extensions to extension point.

-------------------
Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

>> The latest EAP announcement says an API for command-line tools has
>> been created (presumably for Fabrique). After an absolutely minimal
>> search, I'm unable to find the API. I'd like to create a
>> command-line interface to the MetricsReloaded functionality, enabling
>> it to be done as part of a build (much like the off-line inspections
>> API).
>>
>> --Dave Griffith
>>



0
Comment actions Permalink

And even better, DiffApplication is available as a sample implementation. Outstanding.

Now if I can figure out how to open a project given a .ipr file, this'll be easy.

--Dave Griffith

0
Comment actions Permalink

Damn me...
To do that you'll need to use closed API of the ProjectManager which you
cannot do obviously. (ProjectManagerEx.loadProject(), ProjectManagerEx.openProject())
Will add soon.


-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

And even better, DiffApplication is available as a sample
implementation. Outstanding.

Now if I can figure out how to open a project given a .ipr file,
this'll be easy.

--Dave Griffith




0
Comment actions Permalink

Wow. Thanks.

--Dave Griffith

0
Comment actions Permalink

Maxim, I can't get this to work. I have a class impementing the ApplicationStarter interface and have registered the extension in the plugin.xml like this:

When I invoke idea like this idea mycommand arg1 arg2 IDEA just boots up normally. The class MyAppStarter doesn't even get instantiated. Running "idea inspect|diff" works fine though. The plugin's folder structure is as follows (other structures don't work either): -]]>
--\myappstarter
-


\classes
-


\lib
-


\META-INF
-


\plugin.xml

Any idea what the problem could be?

Thanks,
Sascha

0
Comment actions Permalink

Well, I got it working now, after starting to question my own sanity and some reverse-
engineering. The key to success is to provide a version attribute at the top-level
plugin-element:

<idea-plugin version="2">...</idea-plugin>

Without that, IDEA doesn't load any extensions.

Two comments:

- Add this small, but vital information to the com.intellij.ExtensionPoints interface
and/or a better place, so people can find it by reading the docs.

- The javadoc in com.intellij.ExtensionPoints for the AppStarter is incorrect:

while it actually should be ]]>

Once those obstacles are gone, this thing really rocks ;)

Sascha

0

Please sign in to leave a comment.