BSP fixes and workaround for cross projects#885
Conversation
46c7e36 to
50e0062
Compare
lefou
left a comment
There was a problem hiding this comment.
This look ok to me, but I'm not really familiar with the BSP contrib module. What does @samvel1024 or @adadima think?
Also it seems there is a unrelated change in GenIdeaImpl.
|
Please ignore this PR for now, it needs more work. |
1b76901 to
944f0b4
Compare
|
@samvel1024 @adadima Please have a look. |
c178f91 to
a1de4bd
Compare
|
This is working like a charm on my projects. @samvel1024 @adadima Do you guys know how to specify "Excluded Folders"? The red folders in this screenshot: |
|
On my previous question it seems not supported yet https://gitter.im/scalacenter/bsp?at=5ebe65b2ecc55a312d0446fc but this is not really important anyway. |
d309131 to
8f6a234
Compare
| def millProperty(key: String): Option[String] = | ||
| Option(sys.props(key)) // System property has priority | ||
| .orElse(Option(LongMillProps.getProperty(key))) |
There was a problem hiding this comment.
I changed this to an Option for type safety. It didn't make sense to get nulls and try to wrap in an Option at multiple call sites.
76af078 to
c93f7ab
Compare
There was a problem hiding this comment.
Is there any BSP test suite or compliance kit where we can check our support against?
Still can't say much about your changes. I haven't tested them, but if they solve some issue and the original authors don't complain, I tend to merge. I added some questions.
| System.err.println( | ||
| s"""An exception occured while connecting to the client. | ||
| |Cause: ${e.getCause} | ||
| |Message: ${e.getMessage} | ||
| |Exception class: ${e.getClass} | ||
| |Stack Trace: ${e.getStackTrace}""".stripMargin | ||
| ) | ||
| } finally { | ||
| System.err.println("Shutting down executor") |
There was a problem hiding this comment.
Shouldn't we use T.log.error here?
There was a problem hiding this comment.
Good point. I will do the change in a bit.
scalalib/src/JavaModule.scala
Outdated
| path <- (if (os.isDir(root.path)) os.walk(root.path) else Seq(root.path)) | ||
| if os.isFile(path) && ((path.ext == "java") && !isHiddenFile(path)) | ||
| path <- if (os.isDir(root.path)) os.walk(root.path) else Seq(root.path) | ||
| if os.isFile(path) && ((path.ext == "java") && !path.toIO.isHidden) |
There was a problem hiding this comment.
The isHidden is already defined in Java IO and is probably more robust wrt cross platform (i.e on windows a hidden file don't start with a .)
There was a problem hiding this comment.
Yeah, but I think a dot file should always be excluded and treated not as sourcefile. If you make that logic OS-specific, your build end up to be non-reproducible.
There was a problem hiding this comment.
Ah, I see. We want a file starting with a . to always be excluded no matter what OS it it.
Reverting this change.
scalalib/src/ScalaModule.scala
Outdated
| path <- (if (os.isDir(root.path)) os.walk(root.path) else Seq(root.path)) | ||
| if os.isFile(path) && ((path.ext == "scala" || path.ext == "java") && !isHiddenFile(path)) | ||
| path <- if (os.isDir(root.path)) os.walk(root.path) else Seq(root.path) | ||
| if os.isFile(path) && ((path.ext == "scala" || path.ext == "java") && !path.toIO.isHidden) |
There was a problem hiding this comment.
The isHidden is already defined in Java IO and is probably more robust wrt cross platform (i.e on windows a hidden file don't start with a .)
| def millProperty(key: String): Option[String] = | ||
| Option(sys.props(key)) // System property has priority | ||
| .orElse(Option(LongMillProps.getProperty(key))) |
d3bb1fd to
7bf15f7
Compare
| .setInput(stdin) | ||
| .setLocalService(millServer) | ||
| .setRemoteInterface(classOf[BuildClient]) | ||
| .traceMessages(new PrintWriter((os.pwd / ".bsp" / "mill.log").toIO)) |
There was a problem hiding this comment.
I moved the log file in the .bsp folder.
I think it was too much in the face of the user.
| buildTarget.setData(dataBuildTarget) | ||
| buildTarget.setDisplayName(moduleName(module.millModuleSegments)) | ||
| buildTarget.setBaseDirectory(module.intellijModulePath.toIO.toURI.toString) | ||
| buildTarget.setDisplayName(module.millModuleSegments.render) |
There was a problem hiding this comment.
I removed moduleName for .render. That makes display of modules in Idea (and other BSP clients) look exactly the same as mill cli.
|
This PR is ready to go @lefou @lihaoyi . We are looking forward to use it in my team since the current version of BSP is a great start but contained important bugs and missing support for Cross projects. FYI I also finished JetBrains/intellij-scala#534 which fixes SCL-17551. |
|
Thanks |

This is fixing:
CrossandCrossScalaModule#864 just like how SBT does 1 version only.I'm also trying to fix it on the client side BSP: Fix cross modules JetBrains/intellij-scala#534
$ivyimports but missing the$fileresolutions./buildroot project so that in the future we will be able to support actual root project.Thanks