Skip to content

Commit ab6de5e

Browse files
committed
Update to sbt 1.10.0, Scala 2.13.14
1 parent 7820e75 commit ab6de5e

File tree

6 files changed

+33
-12
lines changed

6 files changed

+33
-12
lines changed

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
target/
2+
.bsp/
3+
.idea/
4+
# vim
5+
*.sw?
6+
7+
# Ignore [ce]tags files
8+
tags
9+
10+
# Metals
11+
.metals
12+
.bloop
13+
metals.sbt
14+
.vscode
15+
16+
.DS_Store

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
### An example SBT project which uses macros (Scala 2.11, SBT 0.13)
1+
### An example SBT project which uses macros (Was created for Scala 2.11, SBT 0.13, updated to Scala 2.13.14, sbt 1.10.0)
22

3-
To verify that everything works fine, do `sbt run`.
3+
To verify that everything works fine, do `sbt runMy`.
44

55
Note that currently SBT doesn't support recompilation of macro clients if the dependencies of the macro implementation have changed - macro clients are only recompiled when the macro definition itself is: https://github.com/sbt/sbt/issues/399.
66

build.sbt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
name := "sbt-example"
22
organization := "org.scalamacros"
3-
version := "2.0.0"
3+
version := "2.0.1"
44

5-
scalaVersion in ThisBuild := "2.11.8"
6-
run <<= run in Compile in core
5+
ThisBuild / scalaVersion := "2.13.14"
76

8-
lazy val macros = (project in file("macros")).settings(
7+
// this line is not valid in Scala 2.13 due to <<=, migrate according to https://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html
8+
//run <<= run in Compile in core
9+
10+
// alias is the way to go, now you can do: sbt runMy
11+
addCommandAlias("runMy", "core / Compile / run")
12+
13+
lazy val macros = project in file("macros") settings(
914
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
1015
)
1116

12-
lazy val core = (project in file("core")) dependsOn macros
17+
lazy val core = project in file("core") dependsOn macros

core/src/main/scala/Test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
object Test extends App {
2-
Macros.hello
2+
Macros.hello()
33
}

macros/src/main/scala/Macros.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import scala.language.experimental.macros
2-
import scala.reflect.macros.blackbox.Context
2+
import scala.reflect.macros.blackbox
33

44
object Macros {
5-
def impl(c: Context) = {
5+
def impl(c: blackbox.Context)(): c.Expr[Unit] = {
66
import c.universe._
77
c.Expr[Unit](q"""println("Hello World")""")
88
}
99

10-
def hello: Unit = macro impl
10+
def hello(): Unit = macro impl
1111
}

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.11
1+
sbt.version=1.10.0

0 commit comments

Comments
 (0)