Adding external builder

Hi guys,
I've just started work on a plugin to support Pony programming language. Everything went smoothly so far except now I have an issue I seem unable to get through, maybe I don't understand something so I'd appreciate clarifications.

I'm adding an external builder, which I understand is the way to run the compiler on source files. Pony compiler is simple enough and to compile all sources it just needs to be invoked with a single command without params in proper work dir.

I looked at both intellij-haskforce and intellij-erlang for inspiration and even though I think I've implemented all required pieces, external build doesn't trigger. I tried debugging the external builder but breakpoints in my implementation of the BuilderService never worked.

I added the jps-plugin to project dependencies in plugin module. Checking the ~/Library/Caches/IdeaIC14/plugins-sandbox/plugins/intellij-pony/classes/META-INF I see services and proper extension, also classes are located in the classes folder

The implementation is located in the github repo https://github.com/pbuda/intellij-pony/tree/feature/runner.

Any hints/tips are very welcome.

0
3 comments

Hello Piotr,

I don't see any evident problems in your plugin. To debug the problem you can put a breakpoint to org.jetbrains.jps.incremental.BuilderRegistry
constructor and check whether your BuilderService implementation is returned from JpsServiceManager#getExtensions call. If it doesn't it means that
your jps-plugin isn't included to the external build classpath. So you can put a breakpoint in
com.intellij.compiler.server.impl.BuildProcessClasspathManager#computeCompileServerPluginsClasspath method and check why it happens.

--
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"

0

Hello Nikolay,

Thanks for your answer. Funny thing is I figured it out the moment I got notification about your post :) First of all, I was mistaken in believing that the builder is not executed. It was, but my module was of type JpsJavaModuleType.

So I added org.jetbrains.jps.model.serialization.JpsModelSerializerExtension - and it's implementation that is quite simple:

 
public class JpsPonyModelSerializerExtension extends JpsModelSerializerExtension {
    @NotNull
    @Override
    public
List<? extends JpsModulePropertiesSerializer<?>> getModulePropertiesSerializers() {
        return Collections.singletonList(new JpsModulePropertiesSerializer<JpsDummyElement>(JpsPonyModuleType.INSTANCE, "PONY_MODULE", null) {
            @Override
            public
JpsDummyElement loadProperties(@Nullable Element componentElement) {
                return JpsElementFactory.getInstance().createDummyElement();
            
}

            @Override
            public void saveProperties
(@NotNull JpsDummyElement properties, @NotNull Element componentElement) {
            }
        });
    
}
}


Now it all seems to work.

This involved a lot of trial and error and frustration, I didn't see any documentation on this model serializer extension. But it works now :)

0

Got the same problem and your solution helped. Thanks! (needed to implement getSdkPropertiesSerializers as well to get my own sdktype)

0

Please sign in to leave a comment.