mpeltonen / sbt-idea

A simple-build-tool (sbt) plugin/processor for creating IntelliJ IDEA project files
Other
1.07k stars 153 forks source link

JDK + language level autodetection (and other improvements) #315

Open dansanduleac opened 10 years ago

dansanduleac commented 10 years ago

I noticed that, aside from some functionality for Android projects (which I don't use) the plugin doesn't make an effort to detect what JDK version and language level the sbt projects are using (instead it derives these from the JVM that sbt runs under, and sticks them onto the IDEA project).

With this change, I look at javacOptions in each sbt project's scope, and if -target is set, I set the SDK (specifically, the JDK library to use) and the language level to that version. If, further, -source is also set, then I set the language level to the version coming after -source.

Other improvements are minor source code rearrangements, things like that, but also a fix which allows slashes in ivy module names to be used (previously, they weren't normalized to _ and the plugin would crash when it couldn't find the XML file with a slash in it, that it supposedly generated for a library whose name contained slashes).

mauhiz commented 10 years ago

:+1: