Skip to content

Commit

Permalink
WIP: build.sbt,plugins.sbt,SubObjects.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
fdietze committed Aug 12, 2020
1 parent 6d2baa2 commit 9cc7294
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ import Def.{setting => dep}
// -- common setting --
scalaVersion in ThisBuild := "2.12.12"

inThisBuild(
List(
semanticdbEnabled := true, // enable SemanticDB
semanticdbVersion := scalafixSemanticdb.revision // use Scalafix compatible version
)
)


scalafixDependencies in ThisBuild += "org.scala-lang.modules" %% "scala-collection-migrations" % "2.1.4"
addCompilerPlugin(scalafixSemanticdb)
scalacOptions ++= List("-Yrangepos", "-P:semanticdb:synthetics:on")


Global / onChangedBuildSource := IgnoreSourceChanges // disabled, since it doesn't recover state of devserver

Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.7")
/* addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") */
/* addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.6") */

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.19")
3 changes: 1 addition & 2 deletions util/shared/src/main/scala/wust/util/macros/SubObjects.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package wust.util.macros

import scala.reflect.macros.blackbox.Context
import scala.collection.breakOut

// This macro is for expanding a class type into a list of objects that extend this class.
// Example:
Expand All @@ -27,7 +26,7 @@ object SubObjectsMacro {
case _ => Set.empty
}

val subObjects: Array[Tree] = recursiveSubObjects(traitTag.tpe.typeSymbol).map(utils.fullNameTree)(breakOut)
val subObjects: Array[Tree] = recursiveSubObjects(traitTag.tpe.typeSymbol).map(utils.fullNameTree).toArray
c.Expr[Array[Trait]](q"..$subObjects")
/* TODO: generates too much runtime code:
var array = [$m_Lwust_webApp_state_Feature$TaskUnchecked$(), $m_Lwust_webApp_state_Feature$TaskChecked$(), $m_Lwust_webApp_state_Feature$TaskReordered$()];
Expand Down

0 comments on commit 9cc7294

Please sign in to comment.