Skip to content

Commit

Permalink
Merge pull request #33 from http4s/dotty-support
Browse files Browse the repository at this point in the history
Support Dotty
  • Loading branch information
rossabaker authored Oct 22, 2020
2 parents fd423bb + da4b005 commit a1948c6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ Enable with `enablePlugins(SilencerPlugin)`

* Adds the [silencer](https://github.com/ghik/silencer) compiler plugin to suppress warnings.
* Adds the supporting library to `CompileTime` and `Test` scopes, so it doesn't leave a trace in production.

* Disabled automatically in Dotty
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ lazy val core = project
.settings(commonSettings)
.settings(
name := "sbt-http4s-org",
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.4"),
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.2.15"),
addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % "0.6.0"),
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1"),
Expand Down
14 changes: 9 additions & 5 deletions core/src/main/scala/org/http4s/sbt/Http4sOrgPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import sbt._
import sbt.Keys._

import com.typesafe.sbt.SbtGit.git
import dotty.tools.sbtplugin.DottyPlugin.autoImport._
import de.heikoseeberger.sbtheader.{AutomateHeaderPlugin, LicenseDetection, LicenseStyle}
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
import java.lang.{Runtime => JRuntime}
Expand Down Expand Up @@ -34,11 +35,14 @@ object Http4sOrgPlugin extends AutoPlugin {

val scalaSettings: Seq[Setting[_]] =
Seq(
scalacOptions ++=
Seq(
"-Ybackend-parallelism",
math.min(JRuntime.getRuntime.availableProcessors, 16).toString
)
scalacOptions ++= {
if (isDotty.value) Seq.empty
else
Seq(
"-Ybackend-parallelism",
math.min(JRuntime.getRuntime.availableProcessors, 16).toString
)
}
)

val docSettings: Seq[Setting[_]] =
Expand Down
23 changes: 14 additions & 9 deletions core/src/main/scala/org/http4s/sbt/SilencerPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package org.http4s.sbt
import sbt._
import sbt.Keys._

import dotty.tools.sbtplugin.DottyPlugin.autoImport._
import explicitdeps.ExplicitDepsPlugin.autoImport._

import CompileTimePlugin.CompileTime

object SilencerPlugin extends AutoPlugin {
Expand All @@ -20,14 +20,19 @@ object SilencerPlugin extends AutoPlugin {
override lazy val projectSettings: Seq[Setting[_]] =
Seq(
silencerVersion := "1.7.0",
libraryDependencies ++= Seq(
compilerPlugin(
("com.github.ghik" % "silencer-plugin" % silencerVersion.value).cross(CrossVersion.full)),
("com.github.ghik" % "silencer-lib" % silencerVersion.value % CompileTime)
.cross(CrossVersion.full),
("com.github.ghik" % "silencer-lib" % silencerVersion.value % Test)
.cross(CrossVersion.full)
),
libraryDependencies ++= {
if (isDotty.value) Seq.empty
else
Seq(
compilerPlugin(
("com.github.ghik" % "silencer-plugin" % silencerVersion.value).cross(
CrossVersion.full)),
("com.github.ghik" % "silencer-lib" % silencerVersion.value % CompileTime)
.cross(CrossVersion.full),
("com.github.ghik" % "silencer-lib" % silencerVersion.value % Test)
.cross(CrossVersion.full)
)
},
unusedCompileDependenciesFilter -= moduleFilter("com.github.ghik", name = "silencer-lib")
)
}

0 comments on commit a1948c6

Please sign in to comment.