Chained compilers => output file deleted => race condition?

Hello Jetbrains and Community,

I implemented two IDEA compiler plugins (Jangaroo EXML, Jangaroo Language), where one compiler works on the result of the other. Concretely, the first, exmlc, transforms an XML format called EXML to ActionScript 3, and the second, jooc, compiles ActionScript 3 to JavaScript.

Whenever an *.exml file is compiled by exmlc, the corresponding *.as file is (re-)generated correctly. Creating or updating the *.as file correctly triggers the second compiler (jooc), and the output *.js file is created.

Now, the following strange thing happens: When an *.exml file is changed and I hit Ctrl-F9 (Make Project), both the *.as file and the *.js file are re-generated correctly, but then, the IDEA build process deletes the *.js file! Why?!

My theory is that the IDEA build process notices that an input file for the AS->JS compiler changed, so the output file should be removed, but things may happen in the wrong order (race condition?): the new *.js file is generated first, then, it is deleted. There seems to be something wrong with the translating compiler caches and output file clean-up.

Triggering "Make Project" a second time heals the problem, but this is really only a workaround.

The compilers implement TranslatingCompiler and use OutputItems to map input files to output files. If you need more information, logs, or source code, let me know!

Is there any best practice to chain compilers that I missed? You may know that documentation is a bit... er... sparse in this part of IDEA's Open API.

Please help me with this problem, as it is the last major issue to become productive using IDEA with the Jangaroo tools!



1 comment

It seems the problem does not occur anymore since the update to IDEA 9.0.2.
I'll post again if the problem shoul occur again.


Please sign in to leave a comment.