Skip to content

Commit

Permalink
Merge pull request #10 from Sizmek/switch-to-scala-2.13.0-M4-and-chan…
Browse files Browse the repository at this point in the history
…ge-artifact-name

Switch to scala 2.13.0 m4 and change artifact name
  • Loading branch information
AnderEnder authored Jul 6, 2018
2 parents 5fbd961 + 391a452 commit 5f94fc5
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 15 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ resolvers += Resolver.jcenterRepo
Add the library to a dependency list:

```sbt
libraryDependencies += "com.sizmek.fsi" %% "macros" % "0.2.0"
libraryDependencies += "com.sizmek.fsi" %% "fsi-macros" % "0.2.0"
```

Add import and replace prefix `s` by `fs` (or for a raw string interpolator `raw` by `fraw`):
Expand Down Expand Up @@ -101,7 +101,8 @@ the following JVM system property: `com.sizmek.fsi.buffer.size`.
To compile, run tests, check coverage, and check binary compatibility for different Scala versions use a command:

```sh
sbt clean +coverage +test +coverageReport +mimaReportBinaryIssues
sbt ++2.11.12 clean coverage test coverageReport mimaReportBinaryIssues
sbt ++2.12.6 clean coverage test coverageReport mimaReportBinaryIssues
```

### Run benchmarks
Expand Down
24 changes: 12 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ lazy val commonSettings = Seq(
"-encoding", "UTF-8",
"-feature",
"-unchecked",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Xfuture",
"-Xlint"
Expand Down Expand Up @@ -92,45 +91,46 @@ lazy val publishSettings = Seq(
)

lazy val `fast-string-interpolator` = project.in(file("."))
.aggregate(macros, `benchmark-core`, benchmark)
.aggregate(`fsi-macros`, `fsi-benchmark-core`, `fsi-benchmark`)
.settings(commonSettings: _*)
.settings(noPublishSettings: _*)

lazy val macros = project
lazy val `fsi-macros` = project
.settings(commonSettings: _*)
.settings(mimaSettings: _*)
.settings(publishSettings: _*)
.settings(
crossScalaVersions := Seq("2.13.0-M3", "2.12.6", "2.11.12"),
crossScalaVersions := Seq("2.13.0-M4", "2.12.6", "2.11.12"),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scalatest" %% "scalatest" % "3.0.5-M1" % Test
"org.scalatest" %% "scalatest" % "3.0.6-SNAP1" % Test
)
)

lazy val `benchmark-core` = project
lazy val `fsi-benchmark-core` = project
.enablePlugins(JmhPlugin)
.dependsOn(macros)
.dependsOn(`fsi-macros`)
.settings(commonSettings: _*)
.settings(noPublishSettings: _*)
.settings(
crossScalaVersions := Seq("2.13.0-M3", "2.12.6", "2.11.12"),
crossScalaVersions := Seq("2.13.0-M4", "2.12.6", "2.11.12"),
libraryDependencies ++= Seq(
"pl.project13.scala" % "sbt-jmh-extras" % "0.3.3",
"org.scalatest" %% "scalatest" % "3.0.5-M1" % Test
"org.scalatest" %% "scalatest" % "3.0.6-SNAP1" % Test
)
)

lazy val benchmark = project
lazy val `fsi-benchmark` = project
.enablePlugins(JmhPlugin)
.dependsOn(`benchmark-core`)
.dependsOn(`fsi-benchmark-core`)
.settings(commonSettings: _*)
.settings(noPublishSettings: _*)
.settings(
crossScalaVersions := Seq("2.12.6", "2.11.12"),
libraryDependencies ++= Seq(
"com.dongxiguo" %% "fastring" % "1.0.0",
"com.outr" %% "perfolation" % "1.0.0",
"org.scalatest" %% "scalatest" % "3.0.5-M1" % Test
"com.outr" %% "scribe-slf4j" % "2.3.4" % Test,
"org.scalatest" %% "scalatest" % "3.0.6-SNAP1" % Test
)
)
23 changes: 23 additions & 0 deletions fsi-benchmark/src/main/scala/example/BugTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package example

import scala.annotation.compileTimeOnly
import scala.language.experimental.macros
import scala.reflect.macros.blackbox

class BugTest {
def example(message: => String): LogRecord = macro BugTest.example
}

@compileTimeOnly("Enable macros to expand")
object BugTest {
def example(c: blackbox.Context)(message: c.Tree): c.Tree = {
import c.universe._
val f = c.typecheck(q"() => $message")
c.internal.changeOwner(message, c.internal.enclosingOwner, f.symbol)
q"example.LogRecord($f)"
}
}

case class LogRecord(messageFunction: () => String) {
lazy val message: String = messageFunction()
}
10 changes: 10 additions & 0 deletions fsi-benchmark/src/test/scala/example/Test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package example

object Test {
def main(args: Array[String]): Unit = {
val bt = new BugTest
val d = 12.3456
val record = bt.example(f"Value: $d")
println(s"Record: ${record.message}")
}
}
14 changes: 14 additions & 0 deletions fsi-benchmark/src/test/scala/specs/Issue8Spec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package specs

import com.sizmek.fsi._
import org.scalatest.{Matchers, WordSpec}
import scribe.Logging

class Issue8Spec extends WordSpec with Matchers with Logging {
"java.util.NoSuchElementException: value d (Issue 8)" should {
"be reproduced" in {
val d = 12.3456
logger.info(fs"Value: $d")
}
}
}
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "0.2.1-SNAPSHOT"
version in ThisBuild := "0.3.0-SNAPSHOT"

0 comments on commit 5f94fc5

Please sign in to comment.