Skip to content

Commit

Permalink
use sbt 1.1+ slash notation (#1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-brice-jaglin committed Jan 22, 2021
1 parent 5230231 commit e2904cc
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 61 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -68,8 +68,8 @@ containing the following line:

Add the following line to your `build.sbt`:

PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value / "scalapb"
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)

For additional configuration options, see [ScalaPB SBT Settings](https://scalapb.github.io/sbt-settings.html) documentation
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/build.sbt
Expand Up @@ -8,18 +8,18 @@ lazy val root = project
.in(file("."))
.enablePlugins(JmhPlugin)
.settings(
skip in publish := true,
publish / skip := true,
crossScalaVersions := Seq(Scala213, Scala212),
scalaVersion := Scala213,
PB.protocVersion in Compile := "-v" + ProtobufJavaVersion,
PB.targets in Compile := Seq(
PB.gens.java(ProtobufJavaVersion) -> (sourceManaged in Compile).value / "protos",
scalapb.gen(javaConversions = true) -> (sourceManaged in Compile).value / "protos"
Compile / PB.protocVersion := "-v" + ProtobufJavaVersion,
Compile / PB.targets := Seq(
PB.gens.java(ProtobufJavaVersion) -> (Compile / sourceManaged).value / "protos",
scalapb.gen(javaConversions = true) -> (Compile / sourceManaged).value / "protos"
),
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
),
sourceGenerators in Compile += Def.task {
Compile / sourceGenerators += Def.task {
val file = (Compile / sourceDirectory).value / "templates" / "message.scala.tmpl"
val content = IO.read(file)
TestNames.testNames.map { m =>
Expand Down
18 changes: 9 additions & 9 deletions build.sbt
Expand Up @@ -258,7 +258,7 @@ lazy val lensesJVM2_12 = lenses.jvm(Scala212)

val e2eCommonSettings = commonSettings ++ Seq(
useCoursier := true,
skip in publish := true,
publish / skip := true,
javacOptions ++= Seq("-Xlint:deprecation"),
libraryDependencies ++= Seq(
grpcNetty,
Expand Down Expand Up @@ -389,17 +389,17 @@ lazy val docs = project
"org.plotly-scala" %% "plotly-render" % "0.7.2"
),
mdocIn := baseDirectory.value / "src" / "main" / "markdown",
siteSubdirName in ScalaUnidoc := "api/scalapb/latest",
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc),
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(
ScalaUnidoc / siteSubdirName := "api/scalapb/latest",
addMappingsToSiteDir(ScalaUnidoc / packageDoc / mappings, ScalaUnidoc / siteSubdirName),
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(
lensesJVM2_12,
runtimeJVM2_12,
grpcRuntimeJVM2_12
),
target in (ScalaUnidoc, unidoc) := (baseDirectory in LocalRootProject).value / "website" / "static" / "api",
cleanFiles += (target in (ScalaUnidoc, unidoc)).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(unidoc in Compile).value,
docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(unidoc in Compile).value,
ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api",
cleanFiles += (ScalaUnidoc / unidoc / target).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(Compile / unidoc).value,
docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(Compile / unidoc).value,
mdocVariables := Map(
"scalapb" -> "0.10.10",
"scalapb_latest" -> "0.11.0-M4",
Expand All @@ -413,7 +413,7 @@ lazy val docs = project
git.remoteRepo := "git@github.com:scalapb/scalapb.github.io.git",
ghpagesBranch := "master"
/*
includeFilter in ghpagesCleanSite := GlobFilter(
ghpagesCleanSite / includeFilter := GlobFilter(
(ghpagesRepository.value / "README.md").getCanonicalPath
)
*/
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/markdown/dotty.md
Expand Up @@ -25,8 +25,8 @@ In build.sbt:
```scala
scalaVersion := "@scala3@"

PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value / "scalapb"
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)
```

Expand Down
8 changes: 4 additions & 4 deletions docs/src/main/markdown/generated-code.md
Expand Up @@ -407,13 +407,13 @@ renames.

If you are dealing with legacy Java protocol buffer code, while still wanting
to write new code using ScalaPB, it can be useful to generate converters
to/from the Java protocol buffers. To do this, set `PB.targets in Compile`
to/from the Java protocol buffers. To do this, set `Compile / PB.targets`
like this in your `build.sbt`:

```scala
PB.targets in Compile := Seq(
PB.gens.java -> (sourceManaged in Compile).value,
scalapb.gen(javaConversions=true) -> (sourceManaged in Compile).value
Compile / PB.targets := Seq(
PB.gens.java -> (Compile / sourceManaged).value,
scalapb.gen(javaConversions=true) -> (Compile / sourceManaged).value
)
```

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/markdown/installation.md
Expand Up @@ -17,8 +17,8 @@ libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "@scalapb@"
Add the following line to your `build.sbt`:

```scala
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value / "scalapb"
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)

// (optional) If you need scalapb/scalapb.proto or anything from
Expand Down
16 changes: 8 additions & 8 deletions docs/src/main/markdown/sbt-settings.md
Expand Up @@ -15,8 +15,8 @@ libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "@scalapb@"
Add the following line to your `build.sbt`:

```scala
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value / "scalapb"
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)
```

Expand All @@ -34,7 +34,7 @@ libraryDependencies += "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.com
## Defaults

The plugin assumes your `proto` files are under `src/main/protobuf`,
however this is configurable using the `PB.protoSources in Compile` setting.
however this is configurable using the `Compile / PB.protoSources` setting.

By default, `sbt-protoc` invokes `protoc` 3.x that is shipped with `protoc-jar`.
If you would like to run a different version of `protoc`:
Expand All @@ -50,9 +50,9 @@ See all available options in [sbt-protoc documentation](https://github.com/thesa
To enable Java conversions add the following to your build.sbt:

```scala
PB.targets in Compile := Seq(
PB.gens.java -> (sourceManaged in Compile).value,
scalapb.gen(javaConversions=true) -> (sourceManaged in Compile).value
Compile / PB.targets := Seq(
PB.gens.java -> (Compile / sourceManaged).value,
scalapb.gen(javaConversions=true) -> (Compile / sourceManaged).value
)
```

Expand All @@ -61,8 +61,8 @@ PB.targets in Compile := Seq(
Generating gRPC stubs for services is enabled by default. To disable:

```scala
PB.targets in Compile := Seq(
scalapb.gen(grpc=false) -> (sourceManaged in Compile).value
Compile / PB.targets := Seq(
scalapb.gen(grpc=false) -> (Compile / sourceManaged).value
)
```

Expand Down
8 changes: 4 additions & 4 deletions docs/src/main/markdown/third-party-protos.md
Expand Up @@ -48,17 +48,17 @@ lazy val externalProtos = (project in file("ext-protos"))
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapbVersion % "protobuf"
),

PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value
)
)

// myProject contains its own protos which rely on protos from externalProtos
lazy val myProject = (project in file("my-project"))
.dependsOn(externalProtos)
.settings(
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value
)
)
```
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/markdown/upgrading.md
Expand Up @@ -48,8 +48,8 @@ is the default:

**Add** a value to `gen.targets`:

PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value
)

If you need Java Conversions, flat packages, etc see
Expand Down
14 changes: 7 additions & 7 deletions docs/src/main/markdown/validation.md
Expand Up @@ -56,9 +56,9 @@ libraryDependencies ++= Seq(
Change your `PB.targets` to generate the validation code. The output directory must be the same as the one used for `scalapb.gen`:

```scala
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value / "scalapb",
scalapb.validate.gen() -> (sourceManaged in Compile).value / "scalapb"
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb",
scalapb.validate.gen() -> (Compile / sourceManaged).value / "scalapb"
)

libraryDependencies ++= Seq(
Expand Down Expand Up @@ -150,10 +150,10 @@ scalapb-validate's preprocessor to `PB.targets`. The preprocessor does two thing
2. Expand your PGV-based rules such that they match repeated items, map keys and map values.

```scala
PB.targets in Compile := Seq(
scalapb.validate.preprocessor() -> (sourceManaged in Compile).value / "scalapb",
scalapb.gen() -> (sourceManaged in Compile).value / "scalapb",
scalapb.validate.gen() -> (sourceManaged in Compile).value / "scalapb"
Compile / PB.targets := Seq(
scalapb.validate.preprocessor() -> (Compile / sourceManaged).value / "scalapb",
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb",
scalapb.validate.gen() -> (Compile / sourceManaged).value / "scalapb"
)

libraryDependencies ++= Seq(
Expand Down
18 changes: 9 additions & 9 deletions docs/src/main/markdown/writing-plugins.md
Expand Up @@ -247,10 +247,10 @@ via options. To add custom options, follow this process:
custom options proto by adding the following settings to the `core`
project in `build.sbt`:
```scala
PB.targets in Compile := Seq(
PB.gens.java -> (sourceManaged in Compile).value / "scalapb",
Compile / PB.targets := Seq(
PB.gens.java -> (Compile / sourceManaged).value / "scalapb",
scalapb.gen(javaConversions = true) ->
(sourceManaged in Compile).value / "scalapb",
(Compile / sourceManaged).value / "scalapb",
)
```

Expand All @@ -263,9 +263,9 @@ via options. To add custom options, follow this process:
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion,
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf",
),
PB.protoSources in Compile += core.base / "src" / "main" / "protobuf",
PB.targets in Compile := Seq(
PB.gens.java -> (sourceManaged in Compile).value / "scalapb"
Compile / PB.protoSources += core.base / "src" / "main" / "protobuf",
Compile / PB.targets := Seq(
PB.gens.java -> (Compile / sourceManaged).value / "scalapb"
)
```

Expand Down Expand Up @@ -306,9 +306,9 @@ The project can be published to Maven using the “publish” command. We recomm
SBT users of your code generators will add your plugin to the build by adding it to their `project/plugins.sbt` like this:

```scala
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value / "scalapb",
com.myplugin.gen() -> (sourceManaged in Compile).value / "scalapb"
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb",
com.myplugin.gen() -> (Compile / sourceManaged).value / "scalapb"
)
```

Expand Down
4 changes: 2 additions & 2 deletions examples/basic/build.sbt
@@ -1,5 +1,5 @@
scalaVersion := "2.13.2"

PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value / "scalapb"
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)
4 changes: 2 additions & 2 deletions examples/custom_options/build.sbt
Expand Up @@ -2,8 +2,8 @@ import scalapb.compiler.Version.scalapbVersion

scalaVersion := "2.12.10"

PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value
)

libraryDependencies ++= Seq(
Expand Down
2 changes: 1 addition & 1 deletion make_reflect_config.sh
Expand Up @@ -3,7 +3,7 @@ set -e
TMPDIR=$(mktemp -d)
PROTOFILES=$(find e2e/src/main/protobuf -name "*.proto" -print)

sbt "set version in ThisBuild := \"SNAPSHOT\"" protoc-gen-scala-unix/assembly
sbt "set ThisBuild / version := \"SNAPSHOT\"" protoc-gen-scala-unix/assembly
printf "#!/usr/bin/env bash\nset -e\n" > $TMPDIR/plugin.sh
echo export JAVA_OPTS=-agentlib:native-image-agent=config-output-dir=protoc-gen-scala-native-image/native-image-config >> $TMPDIR/plugin.sh
echo $PWD/.protoc-gen-scala-unix/target/scala-2.12/protoc-gen-scala-unix-assembly-SNAPSHOT.jar >> $TMPDIR/plugin.sh
Expand Down
2 changes: 1 addition & 1 deletion project/BuildHelper.scala
Expand Up @@ -105,7 +105,7 @@ object BuildHelper {
}

val scalajsSourceMaps = scalacOptions += {
val a = (baseDirectory in LocalRootProject).value.toURI.toString
val a = (LocalRootProject / baseDirectory).value.toURI.toString
val g = "https://raw.githubusercontent.com/scalapb/ScalaPB/" + sys.process
.Process("git rev-parse HEAD")
.lineStream_!
Expand Down

0 comments on commit e2904cc

Please sign in to comment.