Skip to content
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

Add warning for unknown configurations #4231

Merged
merged 1 commit into from
Jun 28, 2018
Merged

Conversation

steinybot
Copy link
Contributor

@steinybot steinybot commented Jun 27, 2018

Adds a warning for unknown configurations. This helps to mitigate the issue in #4065 where the id's of unknown configurations are guessed incorrectly and cannot be used with the new unified / scope syntax.

@eed3si9n
Copy link
Member

eed3si9n commented Jun 27, 2018

@steinybot Thanks for the contribution. Looks like a lot of work went into this.

I am a bit concerned about the the failure on AppVeyor however:

Running actions/eval-is-safe-and-sound
...
[info] [error] (checkNumConfigClasses) java.lang.AssertionError: assertion failed: Failed to delete extra configuration classes.  Expected: 30, Found: 32
[error] x actions/eval-is-safe-and-sound 
[error]  Cause of test exception: {line 8}  Command failed: checkNumConfigClasses failed

This kind of looks related, but I am not sure why it's passing on Travis if there's an issue.

log.warn(
s"""The project $project references an unknown configuration "$config" and was guessed to be "$guess"."""
)
log.warn("This configuration should be explicitly added to the project.")
Copy link
Member

Choose a reason for hiding this comment

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

👍

@eed3si9n
Copy link
Member

Never mind. I think restarting the AppVeyor job fixed it, so I guess that's an unrelated issue.

@eed3si9n eed3si9n merged commit 773d35d into sbt:1.x Jun 28, 2018
@eed3si9n eed3si9n removed the ready label Jun 28, 2018
@eed3si9n
Copy link
Member

We made a survey form to collect feedback on the contribution process. Please fill it out when get you get a chance. https://goo.gl/forms/LDPlTl9Wso7YwEri2

@steinybot steinybot deleted the fix/3432 branch July 3, 2018 10:14
@@ -383,8 +387,8 @@ trait ParserMain {
}

/** Presents a Char range as a Parser. A single Char is parsed only if it is in the given range.*/
implicit def range(r: collection.immutable.NumericRange[Char]): Parser[Char] =
charClass(r contains _).examples(r.map(_.toString): _*)
implicit def range(r: collection.immutable.NumericRange[Char], label: String): Parser[Char] =
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 noticed bincompat breakages in this PR now. Even though Parser is currently under "internal" package, it's publicly used so I don't think we can break bincompat.

@@ -396,7 +400,7 @@ trait ParserMain {
* Defines a Parser that parses a single character only if the predicate `f` returns true for that character.
* If this parser fails, `label` is used as the failure message.
*/
def charClass(f: Char => Boolean, label: String = "<unspecified>"): Parser[Char] =
def charClass(f: Char => Boolean, label: String): Parser[Char] =
Copy link
Member

Choose a reason for hiding this comment

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

This breaks source compat.

@ches
Copy link
Contributor

ches commented Jul 31, 2018

An unfortunate consequence of this is that you will get a spurious warning from the implicit root project any time you have e.g. an inThisBuild with a Test-scoped setting:

// Entire contents of a build.sbt

inThisBuild(
  fork in Test := true
)
[warn] The project {file:/private/tmp/4231/ }<root> references an unknown configuration "test" and was guessed to be "Test".

@eed3si9n
Copy link
Member

eed3si9n commented Aug 1, 2018

@ches Let's call that a regression. Could you open an issue for it?

@eed3si9n
Copy link
Member

eed3si9n commented Aug 1, 2018

Just opened sbt/sbt-multi-jvm#48 regarding:

[warn] The project ProjectRef(uri("file:/Users/eed3si9n/work/akka/"), "akka-actor-typed") references an unknown configuration "multi-jvm" and was guessed to be "Multi-jvm".
[warn] This configuration should be explicitly added to the project.
[warn] The project ProjectRef(uri("file:/Users/eed3si9n/work/akka/"), "akka-actor-typed-tests") references an unknown configuration "multi-jvm" and was guessed to be "Multi-jvm".
[warn] This configuration should be explicitly added to the project.
[warn] The project ProjectRef(uri("file:/Users/eed3si9n/work/akka/"), "akka") references an unknown configuration "multi-jvm" and was guessed to be "Multi-jvm".
[warn] This configuration should be explicitly added to the project.
[warn] The project ProjectRef(uri("file:/Users/eed3si9n/work/akka/"), "akka-stream-tests-tck") references an unknown configuration "multi-jvm" and was guessed to be "Multi-jvm".
[warn] This configuration should be explicitly added to the project.
[warn] The project ProjectRef(uri("file:/Users/eed3si9n/work/akka/"), "akka-osgi") references an unknown configuration "multi-jvm" and was guessed to be "Multi-jvm".
[warn] This configuration should be explicitly added to the project.
[warn] The project ProjectRef(uri("file:/Users/eed3si9n/work/akka/"), "akka-protobuf") references an unknown configuration "multi-jvm" and was guessed to be "Multi-jvm".
[warn] This configuration should be explicitly added to the project.
[warn] The project ProjectRef(uri("file:/Users/eed3si9n/work/akka/"), "akka-actor-testkit-typed") references an unknown configuration "multi-jvm" and was guessed to be "Multi-jvm".
[warn] This configuration should be explicitly added to the project.
...

I am not sure at this point if this warning is really meaningful to most build users.

cunei pushed a commit to lightbend-labs/dbuild that referenced this pull request Aug 3, 2018
sbt 1.2.0 changed the prototype of Load.reapply(), so we use
reflection to call the proper version; this commit restores
sbt 1.2.0 compatibility.

Fixes #212
Ref sbt/sbt#4231
eed3si9n added a commit to eed3si9n/sbt that referenced this pull request Aug 6, 2018
Fixes sbt#4293
Ref sbt#4231, sbt#4065

This fixes the regression on sbt 1.2.0 that displays a lot of warnings about configurations.

The warning was added in sbt#4231 in an attempt to fix sbt#4065. This actually highlights somewhat loose usage of configurations among the builds in the wild, and the limitation on the current slash syntax implementation.

I think we can remove this warning for now, and try to fix sbt#4065 by making slash syntax more robust. In particular, we need to memorize the mapping between the configuration name and Scala identifier across the entire build, and use that in the shell.
eed3si9n added a commit to eed3si9n/sbt that referenced this pull request Aug 6, 2018
Fixes sbt#4293
Ref sbt#4231, sbt#4065

This fixes the regression on sbt 1.2.0 that displays a lot of warnings about configurations.

The warning was added in sbt#4231 in an attempt to fix sbt#4065. This actually highlights somewhat loose usage of configurations among the builds in the wild, and the limitation on the current slash syntax implementation.

I think we can remove this warning for now, and try to fix sbt#4065 by making slash syntax more robust. In particular, we need to memorize the mapping between the configuration name and Scala identifier across the entire build, and use that in the shell.
@eed3si9n eed3si9n added the area/shell sbt shell and slash syntax related issues label May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/shell sbt shell and slash syntax related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants