sbt / contraband

http://www.scala-sbt.org/contraband/
Other
69 stars 22 forks source link

Managed source dirs aren't mapped to source directories in IDEA #76

Open dwijnand opened 7 years ago

dwijnand commented 7 years ago

Just taking a moment to start this issue.

I wouldn't be surprised if this is:

dwijnand commented 7 years ago

Some details:

Contraband, in its baseContrabandSettings, which it runs through inConfig(Compile) and inConfig(Test) defines (among other things):

sourceManaged in generateContrabands := sourceManaged.value

And then protocolProj in sbt defines:

sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala"

So everything is task-scoped.

dwijnand commented 7 years ago

/cc @jastice

jastice commented 7 years ago

It seems the compile task gets the contraband source files via the output of the sourceGenerators. Which works just fine for sbt, but since IntelliJ knows only directory-level sources can't be easily imported, and also can't be imported without actually calling the generators. You might just want to add the contraband directory to themanagedSourceDirectories setting :\

Alternatively, it might be possible to import task-scoped source directories, but I'm not clear on how to do that robustly

dwijnand commented 7 years ago

It seems the compile task gets the contraband source files via the output of the sourceGenerators.

Could you show me (or explain to me) how that comes to be true?

jastice commented 7 years ago

Following the inspect rabbithole: protocolProj/compile -> protocolProj/compile:manipulateBytecode -> protocolProj/compile:compileIncremental -> protocolProj/compile:compile::compileInputs -> protocolProj/compile:compile::sources -(provided by) -> protocolProj/compile:sources -> protocolProj/compile:managedSources -> protocolProj/compile:sourceGenerators -> protocolProj/compile:generateContrabands

dwijnand commented 7 years ago

protocolProj/compile:managedSources -> protocolProj/compile:sourceGenerators

ah-ha. Thank you.

dwijnand commented 7 years ago

I guess given this we can't solve this at the root (sbt), at least for now. We'll have to fix it on a case-by-case basis and by convention.

jvican commented 7 years ago

It would be interesting to fix this in the close future in the spirit of getting more contributors to 1.0.