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 val for "compile-time" sbt Configuration #1889

Merged
merged 1 commit into from
Sep 8, 2017

Conversation

fthomas
Copy link
Member

@fthomas fthomas commented Sep 2, 2017

This is another change that makes upgrading to sbt 1.0 easier
and which is compatible with sbt 0.13.

With sbt 1.0 the following line in commonSettings:

ivyConfigurations += config("compile-time").hide

leads to this exception:

[info] Loading settings from build.sbt,version.sbt ...
[info] Resolving key references (15580 settings) ...
[error] java.lang.IllegalArgumentException: requirement failed: id must be capitalized: commonSettings
[error]         at scala.Predef$.require(Predef.scala:277)
[error]         at sbt.librarymanagement.Configuration.<init>(Configuration.scala:19)
[error]         at sbt.librarymanagement.Configuration$.of(Configuration.scala:72)
[error]         at $61255add5b0123fd7403$.$anonfun$commonSettings$9(build.sbt:47)

The reason why commonSettings is used as id for this "compile-time"
configuration can be found in this sbt-librarymanagement macro.

As the macro suggests, extracting the defintion of the Configuration
and assigning it to a val fixes the error.

The "compile-time" configuration was added in
#1638 to remove simulacrum from
the dependencies in the POM. I therefore checked that simulacrum is
still not present in the POM after this change.

This is another change that makes upgrading to sbt 1.0 easier
and which is compatible with sbt 0.13.

With sbt 1.0 the following line in `commonSettings`:
```
ivyConfigurations += config("compile-time").hide
```
leads to this exception:
```
[info] Loading settings from build.sbt,version.sbt ...
[info] Resolving key references (15580 settings) ...
[error] java.lang.IllegalArgumentException: requirement failed: id must be capitalized: commonSettings
[error]         at scala.Predef$.require(Predef.scala:277)
[error]         at sbt.librarymanagement.Configuration.<init>(Configuration.scala:19)
[error]         at sbt.librarymanagement.Configuration$.of(Configuration.scala:72)
[error]         at $61255add5b0123fd7403$.$anonfun$commonSettings$9(build.sbt:47)
```

The reason why `commonSettings` is used as `id` for this "compile-time"
configuration can be found in [this sbt-librarymanagement macro](https://github.com/sbt/librarymanagement/blob/53c80f076a5e9ab469037f352a4d68173140e216/core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala#L109-L114).

As the macro suggests, extracting the defintion of the `Configuration`
and assigning it to a `val` fixes the error.

The "compile-time" configuration was added in
typelevel#1638 to remove simulacrum from
the dependencies in the POM. I therefore checked that simulacrum is
still not present in the POM after this change.
@fthomas fthomas mentioned this pull request Sep 2, 2017
16 tasks
@codecov-io
Copy link

codecov-io commented Sep 2, 2017

Codecov Report

Merging #1889 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1889   +/-   ##
=======================================
  Coverage   95.17%   95.17%           
=======================================
  Files         248      248           
  Lines        4352     4352           
  Branches      126      126           
=======================================
  Hits         4142     4142           
  Misses        210      210

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c61a0e1...a54b524. Read the comment docs.

Copy link
Contributor

@ceedubs ceedubs left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation. I wouldn't have understood otherwise :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants