Update IntelliJ build for use with sbt#5054
Conversation
|
Review by @szeiger. Different compared to the 2.12.x version: there are modules now for |
|
/rebuild |
build.sbt
Outdated
| continue = true | ||
| } | ||
| } else { | ||
| scala.Console.print("Update library classpaths in the current src/intellij/scala.ipr (y/n)? ") |
There was a problem hiding this comment.
Can't get this to work:
[info] Updating library classpaths in src/intellij/scala.ipr.
[debug] Forcing garbage collection...
java.lang.RuntimeException: Replacing library classpath for starr failed, no existing library found.
at scala.sys.package$.error(package.scala:27)
at scala.Predef$.error(Predef.scala:142)
at $ae530580ea485cfb81d0$$anonfun$$sbtdef$1.$ae530580ea485cfb81d0$$anonfun$$replaceLibrary$1(/Users/szeiger/code/scala/build.sbt:938)
at $ae530580ea485cfb81d0$$anonfun$$sbtdef$1.apply(/Users/szeiger/code/scala/build.sbt:959)
at $ae530580ea485cfb81d0$$anonfun$$sbtdef$1.apply(/Users/szeiger/code/scala/build.sbt:858)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (root/*:intellij) Replacing library classpath for starr failed, no existing library found.
[error] Total time: 76 s, completed Mar 21, 2016 2:56:13 PM
There was a problem hiding this comment.
Hm, must have been some incompatible .ipr file. Recreating it from scratch worked. It's unfortunate that scala.ipr ends up under src/intellij. It's not obvious at all that this is a generated file, not a source file.
|
hmm, that basically indicates you have a |
build.sbt
Outdated
|
|
||
| lazy val intellij = taskKey[Unit]("Update the library classpaths in the IntelliJ project files.") | ||
|
|
||
| def moduleDeps(name: String) = Def.taskDyn { Def.task((name, (externalDependencyClasspath in Compile in LocalProject(name)).value.map(_.data))) } |
There was a problem hiding this comment.
This should be doable without a dynamic task:
def moduleDeps(name: String) = (externalDependencyClasspath in Compile in LocalProject(name)).map(a => (name, a.map(_.data)))
You can also get rid of the dynamic references but our project names were chosen poorly so they clash with sbt imports (and there's no way to re-import the correct ones). We'd have to rename the projects or use an alias:
def moduleDeps(p: Project) = (externalDependencyClasspath in Compile in p).map(a => (p.id, a.map(_.data)))
def compilerP = compiler
def testP = test
...
buildModule :: List(
moduleDeps(actors).value,
moduleDeps(compilerP).value,
// moduleDeps("dist").value, // No sources, therefore no module in IntelliJ
moduleDeps(forkjoin).value,
moduleDeps(interactive).value,
moduleDeps(junit).value,
moduleDeps(library).value,
// moduleDeps("library-all").value, // No sources
moduleDeps(manual).value,
moduleDeps(partestExtras).value,
moduleDeps(partestJavaAgent).value,
moduleDeps(reflect).value,
moduleDeps(repl).value,
moduleDeps(replJline).value,
// moduleDeps("repl-jline-embedded").value, // No sources
// moduleDeps("root").value, // No sources
// moduleDeps("scala-dist").value, // No sources
moduleDeps(scaladoc).value,
moduleDeps(scalap).value,
moduleDeps(testP).value)
|
Thanks for the comments, @szeiger, I'll push another commit. Any ideas about the ide failure? note that this is targeting 2.11.x. cc @SethTisue, @sschaef |
|
Another improvement we could make in IntelliJ config would be to place the generated config in a more standard location, so one can just run IIRC, this would either mean |
That would require adjusting paths stored in those files. While I agree with all the review comments, I'm also eager to get this merged; it works, and it can be refined later. The goal was to get unblocked on moving to sbt, but now there are some higher-priority things on my list.. |
|
@lrytz I opened an issue at scala/scala-dev#104 |
|
Thanks! |
|
@szeiger I pushed another commits with your suggestions, PTAL. The IDE failure is unrelated (see scala/scala-dev#104, same error on a different 2.11.x-PR #5056), so I think we can go ahead and merge this. |
|
LGTM |
Re-submission of #5046 targeting 2.11.x. I will create a merge-2.11-to-2.12 follow-up PR.