Custom compiler is not invoked

Hello.

I'm trying to get work on 132.xxx a custom language plugin. Plugin should generate a .java files from custom file.
The problem is that my custom compiler is not executed for my custom file type at all either I do 'Rebuild all' or 'Compile file' on the custom file.
Compiler extends SourceGeneratingCompiler so it should be invoked befor other compiles (as it is written down in JavaDocs)

I've set debug points to every method in Slice2Xxx class but no one is fired.

Could you help me to figure out what happend?

Here is some code:
plugin.xml

    <extensions defaultExtensionNs="com.intellij">         <fileTypeFactory implementation="org.xblackcat.frozenice.IceFileTypeFactory"/>         <compilerFactory implementation="org.xblackcat.frozenice.processor.SliceCompilerFactory"/>


IceFileTypeFactory:

public class IceFileTypeFactory extends FileTypeFactory {     @Override     public void createFileTypes(@NotNull FileTypeConsumer consumer) {         consumer.consume(IceFileType.INSTANCE, "ice" + FileTypeConsumer.EXTENSION_DELIMITER + "slice");         TypedHandler.registerBaseLanguageQuoteHandler(                 SliceLanguage.class,                 TypedHandler.getQuoteHandlerForType(IceFileType.INSTANCE)         );     } }


SliceCompilerFactory:

public class SliceCompilerFactory implements CompilerFactory {     @Override     public Compiler[] createCompilers(@NotNull CompilerManager compilerManager) {         compilerManager.addCompilableFileType(IceFileType.INSTANCE);         compilerManager.addCompiler(new Slice2Xxx());         return new Compiler[0];     } }


Slice2Xxx:

public class Slice2Xxx implements SourceGeneratingCompiler {     public static final GenerationItem[] NO_ITEMS = new GenerationItem[0];     @Override     public VirtualFile getPresentableFile(             CompileContext context,             Module module,             VirtualFile outputRoot,             VirtualFile generatedFile     ) {         return null;     }     @Override     public GenerationItem[] getGenerationItems(CompileContext context) { ...     }     @Override     public GenerationItem[] generate(CompileContext context, GenerationItem[] items, VirtualFile outputRootDirectory) { ...     }     @NotNull     @Override     public String getDescription() {         return "slice";     }     @Override     public boolean validateConfiguration(CompileScope scope) { ....     }     @Override     public ValidityState createValidityState(DataInput in) throws IOException {         return TimestampValidityState.load(in);     } }

0
9 comments

IntelliJ IDEA 12 by default uses external make, which doesn't use the Compiler API at all. Please see http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins for information on extending external make.

0

So, from Idea 12 the Compiler API is deprecated?

0

In IDEA 12, you need to support both APIs, because there are still users who turn off the external make. The compiler API will become deprecated once the possibility to disable external make is removed from the UI.

0

I see.

Is there an clean example of such plugin which use an external application to perform compile? Could Groovy plugin be used as clean example?

0

Yes, Groovy is a good example.

0

One more question: could I obtain any services from JPS part of plugin? Like I can in plugin itself: JavaHelper service = ServiceManager.getService(project, JavaHelper.class);


Are there any restrictions?

0

No. JPS plugins run outside of the IDEA process and do not have access to any services or components of your plugin or IDEA itself.

0

I have two configuraiton levels: global (project level config) and module-depend (facet config). I've saw how obtain a project-level config in Groovy module. How I can get a module facet configuration?

0

Last question is closed.

JpsModelSerializerExtension has necessary methods to override to load project/module/facet/etc configuration.

0

Please sign in to leave a comment.