Skip to content

Conversation

@mtrampont
Copy link

Hi,

This PR addresses the issue #146 .
The problem was that the method Extracted.append actually drops the settings that were added with the set command.
You can see it here: https://github.com/sbt/sbt/blob/1.0.x/main/src/main/scala/sbt/Extracted.scala#L105
session.original is used instead of session.mergeSettings .

Instead of using Extracted.append I used SessionSettings.reapply.

I added a scripted test to check that coverage and coverageOff do not reset settings set with set.

When running the scripted tests, aggregate was failing because a call to coverageReport was missing (according to https://github.com/scoverage/sbt-scoverage#multi-project-reports).
Also, coverage-off is failing because of 0f9496d , but it should be fixed by PR #166 or PR #168.

@gslowikowski
Copy link
Member

@mtrampont can you rebase and update this PR?

toggleCoverage method, after merge, should now look like:

  private def toggleCoverage(status: Boolean): State => State = { state =>
    val extracted = Project.extract(state)
    val currentProjRef = extracted.currentRef
    val newSettings = extracted.structure.allProjectRefs.flatMap(proj =>
      Seq(coverageEnabled in proj := status)
    )
    val appendSettings = Load.transformSettings(Load.projectScope(currentProjRef), currentProjRef.build, extracted.rootProject, newSettings)
    val newSessionSettings = extracted.session.appendRaw(appendSettings)
    SessionSettings.reapply(newSessionSettings, state)
  }

@gslowikowski
Copy link
Member

Closed by #186

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