Skip to content

Commit

Permalink
Merge pull request sbt#1087 from xuwei-k/more-slash
Browse files Browse the repository at this point in the history
use new slash syntax
  • Loading branch information
eed3si9n committed Jun 24, 2022
2 parents c4366ec + 610ed25 commit 2d88fdb
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/reference/01-Faq/00.md
Expand Up @@ -207,9 +207,9 @@ This run task can be configured individually by specifying the task key
in the scope. For example:

```scala
fork in myRunTask := true
myRunTask / fork := true

javaOptions in myRunTask += "-Xmx6144m"
myRunTask / javaOptions += "-Xmx6144m"
```

#### How should I express a dependency on an outside tool such as proguard?
Expand Down
4 changes: 2 additions & 2 deletions src/reference/02-DetailTopics/02-Configuration/14-Testing.md
Expand Up @@ -443,11 +443,11 @@ Then, we can disable parallel execution in just that configuration
using:

```scala
parallelExecution in Serial := false
Serial / parallelExecution := false
```

The tests to run in parallel would be run with `test` and the ones to
run in serial would be run with `serial:test`.
run in serial would be run with `Serial/test`.

### JUnit

Expand Down
Expand Up @@ -487,9 +487,9 @@ myTask := {
You can scope logging settings by the specific task's scope:

```scala
logLevel in myTask := Level.Debug
myTask / logLevel := Level.Debug

traceLevel in myTask := 5
myTask / traceLevel := 5
```

To obtain the last logging output from a task, use the `last` command:
Expand Down
Expand Up @@ -300,7 +300,7 @@ different input applied. For example:
```scala
lazy val runFixed2 = taskKey[Unit]("A task that hard codes the values to `run`")

fork in run := true
run / fork := true

runFixed2 := {
val x = (Compile / run).toTask(" blue green").value
Expand Down
Expand Up @@ -324,9 +324,9 @@ object ObfuscatePlugin extends AutoPlugin {
// default values for the tasks and settings
lazy val baseObfuscateSettings: Seq[Def.Setting[_]] = Seq(
obfuscate := {
Obfuscate(sources.value, (obfuscateLiterals in obfuscate).value)
Obfuscate(sources.value, (obfuscate / obfuscateLiterals).value)
},
obfuscateLiterals in obfuscate := false
obfuscate / obfuscateLiterals := false
)
}

Expand Down Expand Up @@ -355,7 +355,7 @@ object Obfuscate {
A build definition that uses the plugin might look like. `obfuscate.sbt`:

```scala
obfuscateLiterals in obfuscate := true
obfuscate / obfuscateLiterals := true
```

#### Global plugins example
Expand Down
Expand Up @@ -179,7 +179,7 @@ object WhateverPlugin extends sbt.AutoPlugin {
}
import autoImport._
override lazy val projectSettings = Seq(
specificKey in Whatever := "another opinion" // DON'T DO THIS
Whatever / specificKey := "another opinion" // DON'T DO THIS
)
}
```
Expand Down Expand Up @@ -266,8 +266,8 @@ object ObfuscatePlugin extends sbt.AutoPlugin {
}
import autoImport._
lazy val baseObfuscateSettings: Seq[Def.Setting[_]] = Seq(
obfuscate := Obfuscate((sources in obfuscate).value),
sources in obfuscate := sources.value
obfuscate := Obfuscate((obfuscate / sources).value),
obfuscate / sources := sources.value
)
override lazy val projectSettings = inConfig(Compile)(baseObfuscateSettings)
}
Expand Down Expand Up @@ -365,12 +365,12 @@ task itself. See the `baseObfuscateSettings`:

```scala
lazy val baseObfuscateSettings: Seq[Def.Setting[_]] = Seq(
obfuscate := Obfuscate((sources in obfuscate).value),
sources in obfuscate := sources.value
obfuscate := Obfuscate((obfuscate / sources).value),
obfuscate / sources := sources.value
)
```

In the above example, `sources in obfuscate` is scoped under the main
In the above example, `obfuscate / sources` is scoped under the main
task, `obfuscate`.

#### Rewiring existing keys in `globalSettings`
Expand Down
Expand Up @@ -66,7 +66,7 @@ lazy val root = (project in file("."))
.settings(
version := "0.1",
scalaVersion := "2.10.6",
assemblyJarName in assembly := "foo.jar"
assembly / assemblyJarName := "foo.jar"
)
```

Expand Down Expand Up @@ -155,7 +155,7 @@ lazy val root = (project in file("."))
.settings(
version := "0.1",
scalaVersion := "2.10.6",
assemblyJarName in assembly := "foo.jar",
assembly / assemblyJarName := "foo.jar",
TaskKey[Unit]("check") := {
val process = Process("java", Seq("-jar", (crossTarget.value / "foo.jar").toString))
val out = (process!!)
Expand Down
28 changes: 14 additions & 14 deletions src/reference/04-Howto/10-Howto-Scala.md
Expand Up @@ -102,46 +102,46 @@ page.

### Define the initial commands evaluated when entering the Scala REPL

Set `initialCommands in console` to set the initial statements to
Set `console / initialCommands` to set the initial statements to
evaluate when `console` and `consoleQuick` are run. To configure
`consoleQuick` separately, use `initialCommands in consoleQuick`. For
`consoleQuick` separately, use `consoleQuick / initialCommands`. For
example,

```scala
initialCommands in console := """println("Hello from console")"""
console / initialCommands := """println("Hello from console")"""

initialCommands in consoleQuick := """println("Hello from consoleQuick")"""
consoleQuick / initialCommands := """println("Hello from consoleQuick")"""
```

The `consoleProject` command is configured separately by
`initialCommands in consoleProject`. It does not use the value from
`initialCommands in console` by default. For example,
`consoleProject / initialCommands`. It does not use the value from
`console / initialCommands` by default. For example,

```scala
initialCommands in consoleProject := """println("Hello from consoleProject")"""
consoleProject / initialCommands := """println("Hello from consoleProject")"""
```

<a name="cleanup"></a>

### Define the commands evaluated when exiting the Scala REPL

Set `cleanupCommands in console` to set the statements to evaluate after
Set `console / cleanupCommands` to set the statements to evaluate after
exiting the Scala REPL started by `console` and `consoleQuick`. To
configure `consoleQuick` separately, use
`cleanupCommands in consoleQuick`. For example,
`consoleQuick / cleanupCommands`. For example,

```scala
cleanupCommands in console := """println("Bye from console")"""
console / cleanupCommands := """println("Bye from console")"""

cleanupCommands in consoleQuick := """println("Bye from consoleQuick")"""
consoleQuick / cleanupCommands := """println("Bye from consoleQuick")"""
```

The `consoleProject` command is configured separately by
`cleanupCommands in consoleProject`. It does not use the value from
`cleanupCommands in console` by default. For example,
`consoleProject / cleanupCommands`. It does not use the value from
`console / cleanupCommands` by default. For example,

```scala
cleanupCommands in consoleProject := """println("Bye from consoleProject")"""
consoleProject / cleanupCommands := """println("Bye from consoleProject")"""
```

<a name="embed"></a>
Expand Down
Expand Up @@ -67,7 +67,7 @@ lazy val root = (project in file("."))
.settings(
version := "0.1",
scalaVersion := "2.10.6",
assemblyJarName in assembly := "foo.jar"
assembly / assemblyJarName := "foo.jar"
)
```

Expand Down Expand Up @@ -156,7 +156,7 @@ lazy val root = (project in file("."))
.settings(
version := "0.1",
scalaVersion := "2.10.6",
assemblyJarName in assembly := "foo.jar",
assembly / assemblyJarName := "foo.jar",
TaskKey[Unit]("check") := {
val process = Process("java", Seq("-jar", (crossTarget.value / "foo.jar").toString))
val out = (process!!)
Expand Down

0 comments on commit 2d88fdb

Please sign in to comment.