jimporter / bfg9000

bfg9000 - build file generator
https://jimporter.github.io/bfg9000
BSD 3-Clause "New" or "Revised" License
76 stars 21 forks source link

Figure out how to track "extra" .class files #73

Closed jimporter closed 8 years ago

jimporter commented 8 years ago

Java (and Scala, etc) can produce multiple .class files for each source file compiled. This poses problems when packaging them up into a .jar, since the extra files will get missed. We need to find a way to determine where these files are and get them included into the .jar files. Maybe they use a common template for their names? That's what Scala seems to do, at least: the extra files look like source$foo.class.

Ideally, we could also track these files for the purposes of removing them when running clean, but that might be more than we can do.

Java is bad.

refi64 commented 8 years ago

It actually is possible to track what output files were written:

https://github.com/felix-lang/fbuild/blob/master/lib/fbuild/builders/java.py#L235-L277

jimporter commented 8 years ago

Yeah, that's one option I've considered. I'm not sure I like it though, since it would basically involve having the build target for javac be a random file containing the names of all the .class files, instead of the target being the .class files themselves. Basically, compiling foo.java would output foo.classlist, which would contain:

foo.class
foo$bar.class
...