Custom compiler is not invoked


I'm trying to get work on 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:

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


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)         );     } }


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


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);     } }


IntelliJ IDEA 12 by default uses external make, which doesn't use the Compiler API at all. Please see for information on extending external make.


So, from Idea 12 the Compiler API is deprecated?


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.


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?


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?


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.


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?


Last question is closed.

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


Please sign in to leave a comment.