-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
Make BSP 1st class citizen #969
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package mill.bsp | ||
|
||
import ch.epfl.scala.bsp4j.BspConnectionDetails | ||
import scala.jdk.CollectionConverters._ | ||
import upickle.default._ | ||
|
||
case class BspConfigJson( | ||
name: String, | ||
argv: Seq[String], | ||
millVersion: String, | ||
bspVersion: String, | ||
languages: Seq[String] | ||
) extends BspConnectionDetails(name, argv.asJava, millVersion, bspVersion, languages.asJava) | ||
|
||
object BspConfigJson { | ||
implicit val rw: ReadWriter[BspConfigJson] = macroRW | ||
} |
2 changes: 1 addition & 1 deletion
2
.../mill/contrib/bsp/BspLoggedReporter.scala → bsp/src/mill/bsp/BspLoggedReporter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package mill.contrib.bsp | ||
package mill.bsp | ||
|
||
import java.io.File | ||
import java.util.concurrent.ConcurrentHashMap | ||
|
2 changes: 1 addition & 1 deletion
2
...rc/mill/contrib/bsp/BspTestReporter.scala → bsp/src/mill/bsp/BspTestReporter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package mill.contrib.bsp | ||
package mill.bsp | ||
|
||
import java.io.{PrintWriter, StringWriter} | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
.../src/mill/contrib/bsp/MillBspLogger.scala → bsp/src/mill/bsp/MillBspLogger.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package mill.contrib.bsp | ||
package mill.bsp | ||
|
||
import ch.epfl.scala.bsp4j._ | ||
import mill.api.Logger | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
contrib/bsp/src/mill/contrib/bsp/Utils.scala → bsp/src/mill/bsp/Utils.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
contrib/bsp/test/src/BspInstallTests.scala → bsp/test/src/BspInstallTests.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package mill.contrib.bsp | ||
package mill.bsp | ||
|
||
import mill.util.ScriptTestSuite | ||
import os._ | ||
import utest._ | ||
|
||
object BspInstallTests extends ScriptTestSuite(false) { | ||
override def workspaceSlug: String = "gen-idea-hello-world" | ||
override def scriptSourcePath: Path = os.pwd / "contrib" / "bsp" / "test" / "resources" / workspaceSlug | ||
override def scriptSourcePath: Path = os.pwd / "bsp" / "test" / "resources" / workspaceSlug | ||
|
||
def tests: Tests = Tests { | ||
"BSP install" - { | ||
val workspacePath = initWorkspace() | ||
eval("mill.contrib.BSP/install") | ||
eval("mill.bsp.BSP/install") | ||
|
||
assert(exists(workspacePath / ".bsp" /"mill.json")) | ||
assert(exists(workspacePath / ".bsp" / "mill.json")) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@joan38 So I've started to play around a bit with this in Metals, and one thing that surprised me a bit was that this captures all env variables and adds them to the
mill.json
. My worry is, especially in Metals if we automatically generate this for a mill build is that a user may accidentally commit this. I've fairly positive this will happen. I already see it happening a bunch with the new.bsp/sbt.json
files that sbt has been producing. Unknowingly I expect users will be committing this with env variables such as passwords etc that they may obviously not want committed.In my experience with bsp discovery and the other build servers, I haven't seen this before. Is this a limitation of Mill, is this really necessary to include to start the server?
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.
Why are these env varibables explicitly set? Is it solving some known issue, e.g. a mill specific env varibale? In that case, we might better special handle a know case than bulk materializing a given state of env variables into this file.
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.
We initially copied all the env vars to pick stuff such as
COURSIER_REPOSITORY
orJAVA_OPTS
and make sure the BSP compilation is equal to a cmd compilation.That can be reverted easily.
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.
Ditto #984