scalacenter / bloop

Bloop is a build server and CLI tool to compile, test and run Scala fast from any editor or build tool.
https://scalacenter.github.io/bloop/
Apache License 2.0
907 stars 201 forks source link

Expected scoop to install bloop v1.4.1 #1281

Open Arthurm1 opened 4 years ago

Arthurm1 commented 4 years ago

Bloop v1.4.1 gives an error when installing on Windows using Scoop...

Exception in thread "main" coursier.error.ResolutionError$CantDownloadModule: Error downloading C:\Users\ArthurM\scoop\apps\bloop\1.4.1:latest.release
  not found: C:\Users\ArthurM\.ivy2\local\C\Users\ArthurM\scoop\apps\bloop\1.4.1
  not found: https://repo1.maven.org/maven2/C/\Users\ArthurM\scoop\apps\bloop\1.4.1/maven-metadata.xml
        at coursier.Resolve$.$anonfun$validate$1(Resolve.scala:325)
        at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:273)
        at scala.collection.Iterator.foreach(Iterator.scala:943)
        at scala.collection.Iterator.foreach$(Iterator.scala:943)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
        at scala.collection.IterableLike.foreach(IterableLike.scala:74)
        at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
        at scala.collection.TraversableLike.map(TraversableLike.scala:273)
        at scala.collection.TraversableLike.map$(TraversableLike.scala:266)
        at scala.collection.AbstractTraversable.map(Traversable.scala:108)
        at coursier.Resolve$.validate(Resolve.scala:323)
        at coursier.Resolve.validate0$1(Resolve.scala:112)
        at coursier.Resolve.$anonfun$ioWithConflicts0$4(Resolve.scala:156)
        at coursier.util.Task$.$anonfun$flatMap$2(Task.scala:14)
        at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
        at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Linking ~\scoop\apps\bloop\current => ~\scoop\apps\bloop\1.4.1
Creating shim for 'bloop'.
Can't shim 'bloop': File doesn't exist.

Coursier looks like it's merging 2 directory names together. Trying to call it directly gives the same error (although I'm not sure if this is how --channel is supposed to be specified)...

coursier install --install-dir C:\Users\ArthurM\scoop\apps\bloop\1.4.1 --default-channels=false --channel C:\Users\ArthurM\scoop\apps\bloop\1.4.1\bloop-coursier.json bloop

It works if I remove channel info and run...

coursier install --install-dir C:\Users\ArthurM\scoop\apps\bloop\1.4.1 bloop

I'm using coursier 2.0.0-RC6-16

Also - the shim isn't setup. I think the "bin": "bloop" section in bloop.json should read "bin": "bloop.bat"

Arthurm1 commented 4 years ago

Temporary workaround...

Uninstall Bloop if you have installed it... scoop uninstall bloop

Add the Bloop bucket scoop bucket add bloop-stable https://github.com/scalacenter/scoop-bloop.git

Edit the bucket file: %home%/scoop/buckets/bloop-stable/bloop.json (or wherever you installed Scoop) to be...

{
  "version": "1.4.1",
  "url": "https://github.com/scalacenter/bloop/releases/download/v1.4.1/bloop-coursier.json",
  "hash": "sha256:2e6a873183e5e22712913bfdab1331d0a7792167c369fee5be0c83e27572fe12",
  "depends": "coursier",
  "bin": "bloop.bat",
  "env_add_path": "$dir",
  "env_set": {
    "BLOOP_HOME": "$dir",
    "BLOOP_IN_SCOOP": "true"
  },
  "installer": {
    "script": "coursier install --install-dir $dir bloop"
  }
}

install bloop: scoop install bloop

jvican commented 4 years ago

Hey @Arthurm1 thanks for reporting! Would you mind opening a PR with those changes in scoop-bloop so that it can be consumed right away and following up to that change with a PR in bloop itself, so that the next release contains these changes?

Arthurm1 commented 4 years ago

@jvican please merge scalacenter/scoop-bloop#7 if you're happy with it

heksesang commented 4 years ago

So, it seems to not like it when you start the directory path with a drive letter, and it seems to not like that the file is called bloop-coursier.json. When you specify to install the app bloop, it looks for bloop.json, and for some reason if you have C:\ at the start, it gets confused and doesn't understand it's a Windows path. Doing \Users\...\bloop, just dropping the C:\ seems to work (though it then relies on scoop being installed on the system drive):

coursier install --install-dir \Users\ginnu\scoop\apps\bloop\1.4.1 --default-channels=false --channel \Users\ginnu\scoop\apps\bloop\1.4.1 bloop-coursier
Wrote bloop-coursier
Warning: \Users\ginnu\scoop\apps\bloop\1.4.1 is not in your PATH
Arthurm1 commented 4 years ago

Thanks @heksesang - I think you're right

I've raised an issue coursier/coursier#1741

zzvara commented 4 years ago

Temporary workaround...

Uninstall Bloop if you have installed it... scoop uninstall bloop

Add the Bloop bucket scoop bucket add bloop-stable https://github.com/scalacenter/scoop-bloop.git

Edit the bucket file: %home%/scoop/buckets/bloop-stable/bloop.json (or wherever you installed Scoop) to be...

{
  "version": "1.4.1",
  "url": "https://github.com/scalacenter/bloop/releases/download/v1.4.1/bloop-coursier.json",
  "hash": "sha256:2e6a873183e5e22712913bfdab1331d0a7792167c369fee5be0c83e27572fe12",
  "depends": "coursier",
  "bin": "bloop.bat",
  "env_add_path": "$dir",
  "env_set": {
    "BLOOP_HOME": "$dir",
    "BLOOP_IN_SCOOP": "true"
  },
  "installer": {
    "script": "coursier install --install-dir $dir bloop"
  }
}

install bloop: scoop install bloop

I had the same problem, this fixed it for me with 1.4.3.

fineconstant commented 3 years ago

And same now with 1.4.8