Skip to content

BSP fixes and workaround for cross projects#885

Merged
lefou merged 1 commit intocom-lihaoyi:masterfrom
joan38:bsp
May 18, 2020
Merged

BSP fixes and workaround for cross projects#885
lefou merged 1 commit intocom-lihaoyi:masterfrom
joan38:bsp

Conversation

@joan38
Copy link
Collaborator

@joan38 joan38 commented May 14, 2020

This is fixing:

Thanks

@joan38 joan38 force-pushed the bsp branch 2 times, most recently from 46c7e36 to 50e0062 Compare May 14, 2020 10:49
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@joan38 joan38 marked this pull request as draft May 15, 2020 01:37
@joan38
Copy link
Collaborator Author

joan38 commented May 15, 2020

Please ignore this PR for now, it needs more work.

@joan38 joan38 force-pushed the bsp branch 2 times, most recently from 1b76901 to 944f0b4 Compare May 15, 2020 06:04
@joan38 joan38 marked this pull request as ready for review May 15, 2020 06:08
@joan38
Copy link
Collaborator Author

joan38 commented May 15, 2020

@samvel1024 @adadima Please have a look.
I'm still testing this locally and also trying to get the $file to work somehow.

@joan38 joan38 force-pushed the bsp branch 2 times, most recently from c178f91 to a1de4bd Compare May 15, 2020 08:26
@joan38
Copy link
Collaborator Author

joan38 commented May 15, 2020

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:
Excluded Folders

@joan38
Copy link
Collaborator Author

joan38 commented May 15, 2020

On my previous question it seems not supported yet https://gitter.im/scalacenter/bsp?at=5ebe65b2ecc55a312d0446fc but this is not really important anyway.

@joan38 joan38 force-pushed the bsp branch 4 times, most recently from d309131 to 8f6a234 Compare May 15, 2020 19:19
Comment on lines +87 to +89
def millProperty(key: String): Option[String] =
Option(sys.props(key)) // System property has priority
.orElse(Option(LongMillProps.getProperty(key)))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@joan38 joan38 force-pushed the bsp branch 2 times, most recently from 76af078 to c93f7ab Compare May 15, 2020 22:12
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 144 to 152
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use T.log.error here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I will do the change in a bit.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. We want a file starting with a . to always be excluded no matter what OS it it.
Reverting this change.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting

Comment on lines +87 to +89
def millProperty(key: String): Option[String] =
Option(sys.props(key)) // System property has priority
.orElse(Option(LongMillProps.getProperty(key)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@joan38 joan38 force-pushed the bsp branch 2 times, most recently from d3bb1fd to 7bf15f7 Compare May 16, 2020 18:15
.setInput(stdin)
.setLocalService(millServer)
.setRemoteInterface(classOf[BuildClient])
.traceMessages(new PrintWriter((os.pwd / ".bsp" / "mill.log").toIO))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed moduleName for .render. That makes display of modules in Idea (and other BSP clients) look exactly the same as mill cli.

@joan38
Copy link
Collaborator Author

joan38 commented May 18, 2020

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.
And when this is merged and I have more time I will also fix #893.

@lefou lefou merged commit 08be5a7 into com-lihaoyi:master May 18, 2020
@lefou lefou added this to the after 0.7.1 milestone May 18, 2020
@joan38 joan38 deleted the bsp branch May 19, 2020 08:04
@joan38
Copy link
Collaborator Author

joan38 commented May 19, 2020

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants