sbt-idea icon indicating copy to clipboard operation
sbt-idea copied to clipboard

Allow arbitrary override of settings

Open jroper opened this issue 10 years ago • 2 comments

The sbt idea plugin provides a command, not a task, which means you can't arbitrarily override any setting/task it depends on. An alternative to this, would be to define a dummy task, eg:

val task = TaskKey[Unit]("idea")

And then when reading config, it would:

unmanagedResourceDirectories in idea in Compile

If defined specifically for idea in a given project, you would get that value, otherwise it would fallback to the Compile config.

What this would allow is users to override any arbitrary value, so that they could configure sbt idea to their hearts content, without impacting their sbt build at all.

The specific use case I have in mind for this is in Play, we are moving to a 2 stage assets process, stage 1 will be on the dev mode classpath, and it contains things like compiled coffeescript/less files, things that must be done in dev mode, and stage 2 will contain things like minimised js, gzipped files, md5s, requirejs optimisation, as well as all original js/css/coffescript/less/source maps (if wanted, these can also be blocked if you don't want those files making it into prod). The key to making this work is that none of this gets put into sbts resource/source/classes directories, they are kept separate, and this is achieved by adding the assets to products in Runtime for dev mode, and products in Compile for distribution (which is used to generate the jar). The idea plugin can't/shouldn't depend on these keys because it requires the project to be fully compilable. So what would seem to make sense is to add these directories to unmanagedResourceDirectories in idea in Test, so that they are on the test classpath during testing (and therefore selenium tests that depend on these assets being on the classpath will work).

jroper avatar Apr 02 '14 03:04 jroper

+1. It would be also great if inspect idea would show all the keys which are used to generate idea project

avakhrenev avatar Apr 07 '14 10:04 avakhrenev

IDEA has direct support for Play / SBT now, so this is no longer needed.

wsargent avatar Aug 06 '16 17:08 wsargent