Skip to content

Conversation

kpodsiad
Copy link
Contributor

Implementation of build-server-protocol/build-server-protocol#300

I wanted to do as few changes as possible to not break compatibility or change the codebase completely. For now, I'll create this PR as a draft to see the test results and your opinion about it.

@kpodsiad kpodsiad force-pushed the feat/scala-test-classes branch from bce8a37 to 5a6ff3d Compare February 25, 2022 09:53
@kpodsiad
Copy link
Contributor Author

Main question is: am I allowed to modify already defined keys or should I create new ones and include this logic here while leaving already existing keys untouched?

Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

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

Unfortunately we cannot change the return type of keys in the sbt 1.x series because it could break the builds and plugins using that key.

I think you can group the definedTests by framework in the BuildServerProtocol implementation directly, as suggested below.

Comment on lines 847 to 852
defined.testPerFramework.map {
case (framework, tests) =>
ScalaTestClassesItem(
bspTargetIdentifier.value,
tests.map(_.name).toVector,
framework.name
Copy link
Member

@adpi2 adpi2 Feb 28, 2022

Choose a reason for hiding this comment

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

You cannot change the type of Keys.definedTests. But here you can use loadedTestFrameworks.value to build a Map[Fingerprint, Framework] and then group each definedTests.value by framework.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw your comment too late :/ I've already tweaked my initial implementation to not break compatibility by just adding other keys but I find your proposition far better, I'll change that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only key which s changed now is bspScalaTestClassesItem. Is changing bsp keys acceptable or just to be fully compliant it's better to create a new one?
cc: @eed3si9n

Copy link
Member

Choose a reason for hiding this comment

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

Assuming no plugins are consuming bsp* keys, I am ok with making mima exceptions for those.

Copy link
Member

Choose a reason for hiding this comment

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

scala-debug-adapter does not depend on bspScalaTestClassesItem and I found no consumer in https://github.com/search?p=1&q=bspScalaTestClassesItem&type=Code.

So I think we are good with this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I've never used MiMa before - if mainProj/mimaReportBinaryIssues passes should I change something with mima or is it ok?

Copy link
Member

Choose a reason for hiding this comment

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

It is unclear to me why the mimaReportBinaryIssues passes. But since it does I think there is nothing else to do.

Copy link
Member

Choose a reason for hiding this comment

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

Amina and I started on sbt 2.x on develop branch, so mima has been turned off. Maybe we should create 1.7.x branch off of 1.6.x?
https://github.com/sbt/sbt/blob/develop/.github/workflows/ci.yml#L102

Copy link
Member

Choose a reason for hiding this comment

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

I just created branch 1.7.x. @kpodsiad you can repoen this PR to merge into 1.7.x.

@kpodsiad kpodsiad force-pushed the feat/scala-test-classes branch 2 times, most recently from 83f37a4 to b7b63c2 Compare February 28, 2022 12:23
@kpodsiad
Copy link
Contributor Author

There is an error in tests:

Compile / loadedTestFrameworks from Compile / bspScalaTestClassesItem ((sbt.internal.server.BuildServerProtocol.configSettings) BuildServerProtocol.scala:303)
Did you mean Test / loadedTestFrameworks ?

but I don't know how to deal with it.

@adpi2
Copy link
Member

adpi2 commented Feb 28, 2022

loadedTestFrameworks is not implemented in the Compiler config.

You can work around this using Keys.loadedTestFrameworks.?.value that should give you a Option[Seq[Framework]] that you can flatten.

@kpodsiad kpodsiad force-pushed the feat/scala-test-classes branch from b7b63c2 to 0495697 Compare February 28, 2022 17:34
@kpodsiad kpodsiad changed the base branch from develop to 1.7.x March 4, 2022 09:50
@kpodsiad kpodsiad changed the base branch from 1.7.x to develop March 4, 2022 09:51
@kpodsiad
Copy link
Contributor Author

kpodsiad commented Mar 4, 2022

Superseded by #6830

@kpodsiad kpodsiad closed this Mar 4, 2022
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.

3 participants