Closed olafurpg closed 6 years ago
I reproduced the problem, it seems to be that sourceDirectories
in sbt are configured to be a subdirectory of .cross
:
[IJ]> unit/sourceDirectories
[info] * /Users/jast/playspace/scalafix/.cross/unit/src/main/scala-2.12
[info] * /Users/jast/playspace/scalafix/.cross/unit/src/main/scala
[info] * /Users/jast/playspace/scalafix/.cross/unit/src/main/java
[info] * /Users/jast/playspace/scalafix/scalafix-tests/unit/src/main/scala
[info] * /Users/jast/playspace/scalafix/.cross/unit/target/scala-2.12/src_managed/main
... while actually they are under the root. IntelliJ uses the sourceDirectories
setting to mark directories appropriately. Not sure what you're doing here :)
Can you explain how you would expect sourceDirectories to look like?
[master] scalafix: show coreJVM/sourceDirectories
[info] * /Users/ollie/dev/scalafix/.cross/core/jvm/src/main/scala-2.12
[info] * /Users/ollie/dev/scalafix/.cross/core/jvm/src/main/scala
[info] * /Users/ollie/dev/scalafix/.cross/core/jvm/src/main/java
[info] * /Users/ollie/dev/scalafix/.cross/core/shared/src/main/scala-2.12
[info] * /Users/ollie/dev/scalafix/.cross/core/shared/src/main/scala
[info] * /Users/ollie/dev/scalafix/scalafix-core/shared/src/main/scala
[info] * /Users/ollie/dev/scalafix/scalafix-core/jvm/src/main/scala
[info] * /Users/ollie/dev/scalafix/.cross/core/jvm/target/scala-2.12/src_managed/main
[master] scalafix: show coreJVM/sourceDirectory
[info] /Users/ollie/dev/scalafix/.cross/core/jvm/src
We have this unorthodox setup to avoid ++
. Our build has a mix of 2.10 only, 2.11/2.12 cross-build and dotty only projects. Compile in some 2.11/2.12 cross-built projects have task depend on compile in dotty/2.10 only projects, which triggered intellij to fail update.
For IDEA to pick up the directory with BuildInfo
as source dir, either you would have to configure sbt-buildinfo to generate the file to <build root>/.cross/unit/target/scala-2.12/src_managed/main
, or add the directory that it is generated to the sourceDirectories
, i.e. <build root>/target/scala-2.12/src_managed/main
Thanks for the input @jastice The build seems to import fine now for some reason, no idea what changed.
In #454 we refactored the build to escape the wrath of
++
and sbt-doge. Now the entire build stays within the task graph, even for cross-builds. This new build is significantly easier to reason about and is less fragile, but it seems it's no longer possible to run the tests or compile the project from IJ.Here's how my "Modules" looks like
No matter if I reload, IJ still says build.sbt has changed and requires a refresh
When trying to run the tests from IJ, I get a missing dependency error even if
difflib
is a dependency ofdiff-sources
(but it's not a dependency ofdiffJVM~1
It seems
BuildInfo
in src_managed of theunit
project is neither picked up I was able to fix this by manually addingsrc_managed
to "Sourcesof
unit-sources` projectcc/ @jastice any idea what is happening?