8000 Update IntelliJ build for use with sbt by lrytz · Pull Request #5054 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

Update IntelliJ build for use with sbt #5054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2016
Merged

Conversation

lrytz
Copy link
Member
@lrytz lrytz commented Mar 21, 2016

Re-submission of #5046 targeting 2.11.x. I will create a merge-2.11-to-2.12 follow-up PR.

@scala-jenkins scala-jenkins added this to the 2.11.9 milestone Mar 21, 2016
@lrytz lrytz mentioned this pull request Mar 21, 2016
@lrytz
Copy link
Member Author
lrytz commented Mar 21, 2016

Review by @szeiger. Different compared to the 2.12.x version: there are modules now for actors and forkjoin.

@lrytz
Copy link
Member Author
lrytz commented Mar 21, 2016

/rebuild

continue = true
}
} else {
scala.Console.print("Update library classpaths in the current src/intellij/scala.ipr (y/n)? ")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.concu
8000
rrent.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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@lrytz
Copy link
Member Author
lrytz commented Mar 21, 2016

hmm, that basically indicates you have a scala.ipr that doesn't have the expected shape. should have better diagnostics for that case. can you rm *.iml scala.ipr and try again?


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))) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@lrytz
Copy link
Member Author
lrytz commented Mar 21, 2016

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

[sbt-republish] [info] Set current project to sbt-republish (in build file:/home/jenkins/workspace/scala-2.11.x-integrate-ide/target/zinc/target-0.9.1/project-builds/sbt-republish-7b7e22ab6c9eb7470adf488ecfc7c014d5404ed8/)
[sbt-republish] These subprojects will be built: compilerInterface, sbtInterface, compilerInterfacePrecompiled, incrementalCompiler, root
[sbt-republish] ----------------------
[sbt-republish] Processing subproject: compilerInterface
[sbt-republish] All Dependencies for subproject compilerInterface:
[sbt-republish]    org.scala-lang:scala-compiler:2.11.9-5f5cc18-SNAPSHOT:scala-tool->default,optional(default)
[sbt-republish]    org.scala-lang:scala-library:2.11.9-5f5cc18-SNAPSHOT:scala-tool->default,optional(default)
[sbt-republish]    org.scala-lang:scala-library:2.11.9-5f5cc18-SNAPSHOT
[sbt-republish]    org.scala-sbt:compiler-interface:latest.integration:deps
[sbt-republish] Running build: compilerInterface
[sbt-republish] [info] Updating {file:/home/jenkins/workspace/scala-2.11.x-integrate-ide/target/zinc/target-0.9.1/project-builds/sbt-republish-7b7e22ab6c9eb7470adf488ecfc7c014d5404ed8/}compilerInterface...
[sbt-republish] [info] Wrote /home/jenkins/workspace/scala-2.11.x-integrate-ide/target/zinc/target-0.9.1/project-builds/sbt-republish-7b7e22ab6c9eb7470adf488ecfc7c014d5404ed8/compiler-interface/target/compiler-interface-0.13.8-on-2.11.9-5f5cc18-SNAPSHOT-for-IDE-SNAPSHOT.pom
[sbt-republish] [warn]  [NOT FOUND  ] org.scala-sbt#compiler-interface;0.13.8-dbuildx24d9ffe08b45fb05dac0b8e32baf26cc13610153!compiler-interface.jar(src) (0ms)
[sbt-republish] [warn] ==== ivy-build-local: tried
[sbt-republish] [warn]   /home/jenkins/workspace/scala-2.11.x-integrate-ide/target/zinc/target-0.9.1/project-builds/sbt-republish-7b7e22ab6c9eb7470adf488ecfc7c014d5404ed8/.dbuild/local-repo/0/org.scala-sbt/compiler-interface/0.13.8-dbuildx24d9ffe08b45fb05dac0b8e32baf26cc13610153/srcs/compiler-interface-sources.jar
[sbt-republish] [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[sbt-republish] [warn]  ::              FAILED DOWNLOADS            ::
[sbt-republish] [warn]  :: ^ see resolution messages for details  ^ ::
[sbt-republish] [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[sbt-republish] [warn]  :: org.scala-sbt#compiler-interface;0.13.8-dbuildx24d9ffe08b45fb05dac0b8e32baf26cc13610153!compiler-interface.jar(src)
[sbt-republish] [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[sbt-republish] sbt.ResolveException: download failed: org.scala-sbt#compiler-interface;0.13.8-dbuildx24d9ffe08b45fb05dac0b8e32baf26cc13610153!compiler-interface.jar(src)
[sbt-republish]     at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:294)
[sbt-republish]     at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
[sbt-republish]     at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
...
[sbt-republish] [error] (compilerInterface/*:update) sbt.ResolveException: download failed: org.scala-sbt#compiler-interface;0.13.8-dbuildx24d9ffe08b45fb05dac0b8e32baf26cc13610153!compiler-interface.jar(src)

@retronym
Copy link
Member

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 idea /code/scala rather than idea /code/scala/src/intellij/scala.ipr.

IIRC, this would either mean ./scala.ipr, which could reference .iml files somewhere else, or switching away from the .ipr format to the .idea/... format.

@lrytz
Copy link
Member Author
lrytz commented Mar 22, 2016

place the generated config in a more standard location

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..

@kiritsuku
Copy link
Contributor

@lrytz I opened an issue at scala/scala-dev#104

@lrytz
Copy link
Member Author
lrytz commented Mar 22, 2016

Thanks!

@lrytz
Copy link
Member Author
lrytz commented Mar 23, 2016

@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.

@szeiger
Copy link
Contributor
szeiger commented Mar 23, 2016

LGTM

@lrytz lrytz merged commit 1fcfdd8 into scala:2.11.x Mar 23, 2016
@lrytz lrytz deleted the intellij-2.11 branch April 4, 2016 09:41
@SethTisue SethTisue modified the milestones: 2.11.11, 2.11.9 May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0