sbt-eclipse
sbt-eclipse copied to clipboard
Add some logic to the default value of EclipseKeys.createSrc
This could be used to determine if source-managed should be added to the project's source roots:
EclipseKeys.createSrc <<= ((sourceGenerators in Compile) { sourgeGens =>
if(sourgeGens == Nil)
EclipseCreateSrc.ValueSet(EclipseCreateSrc.Unmanaged, EclipseCreateSrc.Source)
else
EclipseCreateSrc.ValueSet(EclipseCreateSrc.Unmanaged, EclipseCreateSrc.Source, EclipseCreateSrc.Managed)
})
Also I wish there was a setting such as :
EclipseKeys.createSrcDirs : TaskKey[Seq[File]]
By default this setting would feed on the output of the existing EclipseKeys.createSrc unchanged. It would give a possibility to add or remove the directories that were generated by EclipseKeys.createSrc. I would use it to remove directories like src/main/java, src/test/java when they are empty.
After EclipseKeys.createSrc := EclipseCreateSrc.all gets added to build.sbt, the generated eclipse .classpath file ends up with two instances of target/scala-xxx/src_managed/main. If one uses the eclipse Build Path tool to remove one of them, both entries are removed from .classpath. Once src_managed/main is gone from .classpath, then system cannot work. Long story short, if .classpath is modified by hand to have only one instance of src_managed/main, then everything seems to fall into place.