SpinalHDL / SpinalTemplateSbt

A basic SpinalHDL project
77 stars 64 forks source link

Can't add local or git dependencies #35

Open nmk456 opened 1 year ago

nmk456 commented 1 year ago

I am attempting to copy the changes from SpinalTemplateSbtDependencies to my build.sbt in a project based on SpinalTemplateSbt. When I compile, I get the following error:

[warn]
[warn]  Note: Unresolved dependencies path:
[error] sbt.librarymanagement.ResolveException: Error downloading com.github.spinalhdl:vexriscv_2.12:2.0.0
[error]   Not found
[error]   Not found
[error]   not found: /home/nathan/.ivy2/localcom.github.spinalhdl/vexriscv_2.12/2.0.0/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/github/spinalhdl/vexriscv_2.12/2.0.0/vexriscv_2.12-2.0.0.pom
[error]         at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:345)
[error]         at lmcoursier.CoursierDependencyResolution.$anonfun$update$38(CoursierDependencyResolution.scala:314)
[error]         at scala.util.Either$LeftProjection.map(Either.scala:573)
[error]         at lmcoursier.CoursierDependencyResolution.update(CoursierDependencyResolution.scala:314)
[error]         at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:60)
[error]         at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:59)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:133)
[error]         at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:73)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$20(LibraryManagement.scala:146)
[error]         at scala.util.control.Exception$Catch.apply(Exception.scala:228)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:146)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:127)
[error]         at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:219)
[error]         at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:160)
[error]         at sbt.Classpaths$.$anonfun$updateTask0$1(Defaults.scala:3690)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]         at sbt.Execute.work(Execute.scala:291)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:750)
[error] (update) sbt.librarymanagement.ResolveException: Error downloading com.github.spinalhdl:vexriscv_2.12:2.0.0
[error]   Not found
[error]   Not found
[error]   not found: /home/nathan/.ivy2/localcom.github.spinalhdl/vexriscv_2.12/2.0.0/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/github/spinalhdl/vexriscv_2.12/2.0.0/vexriscv_2.12-2.0.0.pom
[error] Total time: 1 s, completed Aug 12, 2023 5:07:58 PM

I'm able to reproduce this on a fresh project created from this template with the following changes:

diff --git a/build.sbt b/build.sbt
index 0ced33a..b208157 100644
--- a/build.sbt
+++ b/build.sbt
@@ -11,6 +11,8 @@ lazy val projectname = (project in file("."))
   .settings(
     Compile / scalaSource := baseDirectory.value / "hw" / "spinal",
     libraryDependencies ++= Seq(spinalCore, spinalLib, spinalIdslPlugin)
-  )
+  ).dependsOn(vexRiscv)
+
+lazy val vexRiscv = RootProject(uri("git://github.com/SpinalHDL/VexRiscv.git"))

 fork := true

Steps:

  1. git clone https://github.com/SpinalHDL/SpinalTemplateSbt
  2. Apply the diff above
  3. cd SpinalTemplateSbt
  4. sbt compile

I've also tried pointing it at a local copy of VexRiscv and got the same error.

I'm not really sure if this is an issue with the template, VexRiscv, sbt, or something else. I can move this somewhere else if necessary.

nmk456 commented 1 year ago

Looks like this is an issue with the Scala version. 2.12.16 (used in this repo) produces the error, 2.11.12 (used in the dependency template repo) doesn't. It looks like VexRiscv uses 2.11.12 so that's where the mismatch is.

Dolu1990 commented 1 year ago

Hi, yes you are right, you need to downgrade to 2.11.12 :)

nmk456 commented 1 year ago

Is there any chance that the VexRiscv Scala version could be upgraded to 2.12 or higher? It seems like 2.11 has issues with the latest version of Metals (https://github.com/scalameta/metals/issues/5561), so autocomplete no longer works.

Dolu1990 commented 1 year ago

Did you tried updating https://github.com/SpinalHDL/VexRiscv/blob/master/build.sbt#L7 to scala 2.12 ? It should normaly work fine.

Then, could try a multi version build.sbt, but seems that it often break people stuff easily XD So maybe a master_2.12 branch could be added ?