eta icon indicating copy to clipboard operation
eta copied to clipboard

Add a command line flag to emit class files directly

Open rahulmutt opened this issue 9 years ago • 2 comments

Compilation currently produces a .jar for every module. To simplify integration with JVM build tools, it makes sense to add a flag that will emit class files directly instead of jar files.

rahulmutt avatar Oct 01 '17 03:10 rahulmutt

@rahulmutt : Any hints on this about how to proceed?

mbrc12 avatar Feb 27 '18 06:02 mbrc12

First you have to have a basic understanding of how the incremental compilation process works. Basically, it checks for the existence of a .jar file for each Eta module in the output folder to check whether the given module has already been compiled. If the corresponding source module changes, it will recompile that module and generate a new .jar file. It detects this by comparing the modification timestamp of the .jar file vs the source file.

Now if we dump classes directly to disk, this check won't work anymore since you need a single file with a modification time that you can use to check whether to compile or not. One simple solution is to create a dummy .jar file (it doesn't even have to be a jar file, just an empty file with a filename the compiler expects).

Now the next major part is to dump class files directly. That modification should probably made somewhere here: https://github.com/typelead/eta/blob/master/compiler/ETA/Main/HscMain.hs#L1218-L1228

rahulmutt avatar Feb 27 '18 08:02 rahulmutt