lihaoyi / workbench

Tooling around scala-js
234 stars 56 forks source link

Workbench causes cyclic dependency issue with sbt-heroku plugin #30

Open tel opened 8 years ago

tel commented 8 years ago

I'm not familiar enough with SBT to understand the cause, but there appears to be a negative interaction between workbench and sbt-heroku (https://github.com/heroku/sbt-heroku/issues/30) leading to SBT failing entirely due to a cyclic dependency.

[info] Loading project definition from /Users/tel/Dropbox/proj/qubit/project
Cyclic reference involving
   {file:/Users/tel/Dropbox/proj/qubit/}ui/*:extraLoggers
   {file:/Users/tel/Dropbox/proj/qubit/}/*:extraLoggers
    at sbt.Dag$Cyclic.$colon$colon(Dag.scala:67)
    at sbt.Dag$.sbt$Dag$$visit$1(Dag.scala:27)
    at sbt.Dag$$anonfun$visitAll$1$1.apply(Dag.scala:23)
    at sbt.Dag$$anonfun$visitAll$1$1.apply(Dag.scala:23)
    at scala.collection.Iterator$class.foreach(Iterator.scala:727)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
    at scala.collection.MapLike$DefaultValuesIterable.foreach(MapLike.scala:206)
    at sbt.Dag$.visitAll$1(Dag.scala:23)
    at sbt.Dag$.topologicalSort(Dag.scala:33)
    at sbt.Init$class.sort(Settings.scala:152)
    at sbt.Def$.sort(Def.scala:10)
    at sbt.Init$class.make(Settings.scala:146)
    at sbt.Def$.make(Def.scala:10)
    at sbt.Load$.apply(Load.scala:145)
    at sbt.Load$.defaultLoad(Load.scala:36)
    at sbt.BuiltinCommands$.liftedTree1$1(Main.scala:492)
    at sbt.BuiltinCommands$.doLoadProject(Main.scala:492)
    at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:484)
    at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:484)
    at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
    at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
    at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
    at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
    at sbt.Command$.process(Command.scala:93)
    at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
    at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
    at sbt.State$$anon$1.process(State.scala:184)
    at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
    at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.MainLoop$.next(MainLoop.scala:96)
    at sbt.MainLoop$.run(MainLoop.scala:89)
    at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:68)
    at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:63)
    at sbt.Using.apply(Using.scala:24)
    at sbt.MainLoop$.runWithNewLog(MainLoop.scala:63)
    at sbt.MainLoop$.runAndClearLast(MainLoop.scala:46)
    at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:30)
    at sbt.MainLoop$.runLogged(MainLoop.scala:22)
    at sbt.StandardMain$.runManaged(Main.scala:54)
    at sbt.xMain.run(Main.scala:29)
    at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
    at xsbt.boot.Launch$.run(Launch.scala:109)
    at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
    at xsbt.boot.Launch$.launch(Launch.scala:117)
    at xsbt.boot.Launch$.apply(Launch.scala:18)
    at xsbt.boot.Boot$.runImpl(Boot.scala:41)
    at xsbt.boot.Boot$.main(Boot.scala:17)
    at xsbt.boot.Boot.main(Boot.scala)
[error] Cyclic reference involving
[error]    {file:/Users/tel/Dropbox/proj/qubit/}ui/*:extraLoggers
[error]    {file:/Users/tel/Dropbox/proj/qubit/}/*:extraLoggers
[error] Use 'last' for the full log.

My build.sbt looks like

lazy val commonSettings = Seq(
  organization := "jspha",
  scalaVersion := "2.11.8",
  version := "1.0-SNAPSHOT",
  resolvers += Resolver.sonatypeRepo("snapshots")
)

lazy val http4sVersion = "0.14.0-SNAPSHOT"
lazy val doobieVersion = "0.2.3"

lazy val server = project.in(file("server"))
  .settings(commonSettings: _*)
  .dependsOn(sharedJvm)
  .settings(
    libraryDependencies ++= Seq(
      "org.http4s" %% "http4s-dsl" % http4sVersion,
      "org.http4s" %% "http4s-blaze-server" % http4sVersion,

      "org.tpolecat" %% "doobie-core" % doobieVersion,
      "org.tpolecat" %% "doobie-contrib-postgresql" % doobieVersion,
      "org.tpolecat" %% "doobie-contrib-specs2" % doobieVersion,

      "org.slf4j" % "slf4j-simple" % "1.6.4"
    )
  )
  .settings(
    (resources in Compile) <+= Def.task {
      (artifactPath in (ui, Compile, fullOptJS)).value
    } dependsOn (fullOptJS in (ui, Compile))
  )
  .enablePlugins(JavaServerAppPackaging)

lazy val shared = crossProject.crossType(CrossType.Pure).in(file("shared"))
  .settings(commonSettings: _*)

lazy val sharedJvm = shared.jvm.settings(name := "sharedJvm")
lazy val sharedJs = shared.js.settings(name := "sharedJs")

lazy val ui = project.in(file("ui"))
  .settings(commonSettings: _*)
  .dependsOn(sharedJs)
  .enablePlugins(ScalaJSPlugin)
  .settings(workbenchSettings)
  .settings(
    bootSnippet := "jspha.qubit.ui.Runtime().main();",
    refreshBrowsers <<= refreshBrowsers.triggeredBy(fastOptJS in Compile)
  )
krzysztofcybulski commented 7 years ago

Did you find any solution to this?