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

Work around "a pure expression does nothing" warning, take 3 #6363

Merged
merged 1 commit into from Mar 7, 2021

Conversation

eed3si9n
Copy link
Member

@eed3si9n eed3si9n commented Mar 7, 2021

Fixes #6161
Ref scala/bug#12112

This uses the configurable warning backported to Scala 2.12.

Fixes sbt#6161
Ref scala/bug#12112

This uses the configurable warning backported to Scala 2.12.
@eed3si9n eed3si9n added this to the 1.5.0 milestone Mar 7, 2021
@eed3si9n eed3si9n merged commit 93fd570 into sbt:develop Mar 7, 2021
@eed3si9n eed3si9n deleted the wip/nowarn branch March 7, 2021 19:04
@adpi2
Copy link
Member

adpi2 commented Mar 9, 2021

@eed3si9n This PR breaks the dotty repository. I get 100 errors like these:

[info] compiling 10 Scala sources and 1 Java source to /home/piquerez/lampepfl/dotty/project/target/scala-2.12/sbt-1.0/classes ...
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:1375:23: value annotation is not a member of sbt.InputKey[Unit]
[error]     publishMavenStyle := true,
[error]                       ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:1376:16: value annotation is not a member of sbt.InputKey[Unit]
[error]     isSnapshot := version.value.contains("SNAPSHOT"),
[error]                ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:1377:15: value annotation is not a member of sbt.InputKey[Unit]
[error]     publishTo := sonatypePublishToBundle.value,
[error]               ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:1380:29: value annotation is not a member of sbt.InputKey[Unit]
[error]     publishArtifact in Test := false,
[error]                             ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:1381:14: value annotation is not a member of sbt.InputKey[Unit]
[error]     homepage := Some(url(dottyGithubUrl)),
[error]              ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:1382:14: value annotation is not a member of sbt.InputKey[Unit]
[error]     licenses += (("Apache-2.0",
[error]              ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:1384:13: value annotation is not a member of sbt.InputKey[Unit]
[error]     scmInfo := Some(
[error]             ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:1390:16: value annotation is not a member of sbt.InputKey[Unit]
[error]     developers := List(
[error]                ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:230:37: value annotation is not a member of sbt.InputKey[Unit]
[error]     scalaSource       in Compile    := baseDirectory.value / "src",
[error]                                     ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:231:37: value annotation is not a member of sbt.InputKey[Unit]
[error]     scalaSource       in Test       := baseDirectory.value / "test",
[error]                                     ^
[error] /home/piquerez/lampepfl/dotty/project/Build.scala:232:37: value annotation is not a member of sbt.InputKey[Unit]
[error]     javaSource        in Compile    := baseDirectory.value / "src"

@eed3si9n
Copy link
Member Author

eed3si9n commented Mar 9, 2021

Sorry! I knew I should've used fqn. Do you have a term named scala somewhere in the file?

@adpi2
Copy link
Member

adpi2 commented Mar 9, 2021

Yes I do:

val scala = inputKey[Unit]("run compiled binary using the correct classpath, or the user supplied classpath")

@adpi2
Copy link
Member

adpi2 commented Mar 9, 2021

Ah, I see the problem now :)

@marcospereira
Copy link
Contributor

Will this be backported to 1.4?

@eed3si9n
Copy link
Member Author

@marcospereira Probably not. "a pure expression does nothing" is at best a usability annoyance, and "take 3" indicates that fixing is not straightforward because it's macro related. 1.5.0-RC1 would be a good candidate for this since it would go through RC cycle, and I'd feel less bad if plugin interaction broke something in RC1.

@andrew-selvia
Copy link

In case anyone else arrives here while attempting to decipher why this warning is appearing when they compile their plugin, you may want to bump the sbtVersion within your plugin's build to the minimum version with the fix (1.5.0):

pluginCrossBuild / sbtVersion := { scalaBinaryVersion.value match { case "2.12" => "1.5.0" } },

So long as you're comfortable requiring client projects to use 1.5.0 or later, this will make the warning disappear. Thanks @eed3si9n for all you do!

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.

"a pure expression does nothing"
4 participants