forked from olafurpg/scalafix-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
49 lines (43 loc) · 1.51 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
lazy val auxifyV = "0.4"
lazy val auxifyMeta = "com.github.dmytromitin" %% "auxify-meta" % auxifyV
lazy val auxifyMetaCore = "com.github.dmytromitin" %% "auxify-meta-core" % auxifyV
import com.geirsson.coursiersmall.{Repository => R}
scalafixResolvers in ThisBuild += new R.Maven("https://oss.sonatype.org/content/groups/public/")
scalafixDependencies in ThisBuild += auxifyMeta
lazy val V = _root_.scalafix.sbt.BuildInfo
inThisBuild(
List(
scalaVersion := V.scala212,
addCompilerPlugin(scalafixSemanticdb),
scalacOptions ++= List(
"-Yrangepos"
)
)
)
lazy val rules = project
.settings(
libraryDependencies += "ch.epfl.scala" %% "scalafix-core" % V.scalafixVersion
)
lazy val in = project
.settings(
libraryDependencies += auxifyMetaCore
)
lazy val out = project
.settings(
sourceGenerators.in(Compile) += Def.taskDyn {
val root = baseDirectory.in(ThisBuild).value.toURI.toString
val from = sourceDirectory.in(in, Compile).value
val to = sourceManaged.in(Compile).value
val outFrom = from.toURI.toString.stripSuffix("/").stripPrefix(root)
val outTo = to.toURI.toString.stripSuffix("/").stripPrefix(root)
Def.task {
scalafix
.in(in, Compile)
.toTask(s" AuxRule --out-from=$outFrom --out-to=$outTo")
// .toTask(s" --rules=file:rules/src/main/scala/Scalafixdemo.scala --out-from=$outFrom --out-to=$outTo")
.value
(to ** "*.scala").get
}
}.taskValue,
libraryDependencies += auxifyMetaCore
)