Some sbt examples I need to research

As a brief note to self, these are some sbt settings that I need to understand better. I’ve cobbled them into a notepad over the past few weeks, and I’m putting them here now so I can (a) get them out of my note pad, (b) find them again in the future, and (c) research their correct use/usage(s) when I have more time.

Here are the notes:

Before & After Examples

fork in Test := true
Test / fork := true

scalacOptions in Compile += "-Xlint"
Compile / scalacOptions += "-Xlint"

In sbt’s shell

name                                     // hello
ThisBuild / version                      // 1.0.0-SNAPSHOT
show Compile / scalacOptions             // * -Xlint
show Compile / console / scalacOptions   // * -Xlint
Test / fork                              // true

Other

Compile / sourceGenerators += buildInfo
Compile / sourceGenerators += Def.task { List(file1, file2) }
Global / cancelable := true
ThisBuild / scalaVersion := "2.12.2"
Test / test := ()
console / scalacOptions += "-deprecation"
Compile / console / scalacOptions += "-Ywarn-numeric-widen"
projA / Compile / console / scalacOptions += "-feature"
Zero / Zero / name := "foo"

Example in build.sbt

lazy val root = (project in file("."))
  .settings(
    Global / cancelable := true,
    ThisBuild / scalaVersion := "2.11.11",
    Test / test := (),
    Compile / scalacOptions += "-deprecation",
    Compile / console / scalacOptions += "-Ywarn-numeric-widen"
  )

A correct example, but the first one is too narrow

// scope too narrow?
Compile / run / mainClass := Some("...")

// the right scope?
Compile / mainClass := Some("....") 

Also, I apologize, I don’t know where I found most of those notes/examples, so I can’t give them attribution at the moment.