-
Notifications
You must be signed in to change notification settings - Fork 128
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
Setup-ide should run before compile, run and test #188
Setup-ide should run before compile, run and test #188
Conversation
modules/cli/src/main/scala/scala/cli/commands/CoursierOptions.scala
Outdated
Show resolved
Hide resolved
modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala
Show resolved
Hide resolved
modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala
Outdated
Show resolved
Hide resolved
|
||
val importPprintOnlyProject = TestInputs( | ||
Seq( | ||
os.rel / "simple.sc" -> s"import $$ivy.`com.lihaoyi::pprint:${Constants.pprintVersion}`" | ||
) | ||
) | ||
|
||
test("setup-ide should have only absolute path if relative one was specified") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this tests. Plus the handling of the os.Path
s looks suspicious (all os.Path
s are absolute and normalized).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue that i wanted to solve is whenever i run something like scala-cli setup-ide ../other/folder -S 3.0.1
in the directory that is not within a project then the scala-cli.json
contains relative path that i posted. This is wrong as the paths (if we want relative one) should be resolved from the workspace not from the place where i run scala-cli. Therefore i thought that it would be safe to always include absolute paths just like we do when path to scala-cli
is relative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be exact this is what scala-cli outputs:
{
"name": "sbt",
"argv": [
"scala-cli",
"bsp",
"../example/scala3",
"-S",
"3.0.1",
"--bsp-name",
"sbt"
],
"version": "0.0.4-SNAPSHOT",
"bspVersion": "2.0.0-M13",
"languages": [
"scala",
"java"
]
}⏎
When i run from: ~/Documents/scala-cli
and have an example project in ~/Documents/example/scala3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Weird, I thought I had answered this in an earlier review, but I can't see my answers here… Anyway, that was a good point ^^)
82d6a9e
to
b69886d
Compare
os.FilePath(rawArgv(0)).resolveFrom(Os.pwd).toString | ||
else { | ||
val absoluteScalaCliPath = | ||
this.getClass.getProtectionDomain.getCodeSource.getLocation.toURI.getPath.trim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is going to work from the native executables… (it should throw an NPE I think).
Using just rawArgv(0)
should be fine here (these would be even better, but that can wait…)
|
||
val importPprintOnlyProject = TestInputs( | ||
Seq( | ||
os.rel / "simple.sc" -> s"import $$ivy.`com.lihaoyi::pprint:${Constants.pprintVersion}`" | ||
) | ||
) | ||
|
||
test("setup-ide should have only absolute path if relative one was specified") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Weird, I thought I had answered this in an earlier review, but I can't see my answers here… Anyway, that was a good point ^^)
modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala
Outdated
Show resolved
Hide resolved
modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala
Outdated
Show resolved
Hide resolved
050e568
to
dd566d8
Compare
@@ -125,6 +126,17 @@ abstract class BspTestDefinitions(val scalaVersionOpt: Option[String]) | |||
expect(expectedPrefixes.exists(uri.startsWith)) | |||
} | |||
|
|||
def readBspConfig(root: os.Path, f: (Details) => Unit): Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT Why not just returning the Details
? And let the tests below do whatever they want with them?
modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala
Outdated
Show resolved
Hide resolved
305a3fb
to
9e9262b
Compare
Co-authored-by: Alexandre Archambault <alexarchambault@users.noreply.github.com> Co-authored-by: Alexandre Archambault <alexarchambault@users.noreply.github.com>
Co-authored-by: Alexandre Archambault <alexarchambault@users.noreply.github.com>
…stDefinitions.scala Co-authored-by: Alexandre Archambault <alexarchambault@users.noreply.github.com>
9e9262b
to
94611a1
Compare
Just pushed a NIT commit, with mostly minor syntax changes or dummy refactorings. Otherwise, LGTM. |
CI is green 🎉 |
No description provided.