ScalafmtAll to sbt files

This commit is contained in:
Eike Kettner 2020-06-23 00:28:04 +02:00
parent 3018fbc0b6
commit 9db3c70e3f
2 changed files with 103 additions and 88 deletions

View File

@ -4,40 +4,39 @@ import sbt._
object Dependencies { object Dependencies {
val BcryptVersion = "0.4" val BcryptVersion = "0.4"
val BetterMonadicForVersion = "0.3.1" val BetterMonadicForVersion = "0.3.1"
val BitpeaceVersion = "0.5.0" val BitpeaceVersion = "0.5.0"
val CalevVersion = "0.3.1" val CalevVersion = "0.3.1"
val CirceVersion = "0.13.0" val CirceVersion = "0.13.0"
val DoobieVersion = "0.9.0" val DoobieVersion = "0.9.0"
val EmilVersion = "0.6.1" val EmilVersion = "0.6.1"
val FastparseVersion = "2.1.3" val FastparseVersion = "2.1.3"
val FlexmarkVersion = "0.62.2" val FlexmarkVersion = "0.62.2"
val FlywayVersion = "6.4.4" val FlywayVersion = "6.4.4"
val Fs2Version = "2.4.2" val Fs2Version = "2.4.2"
val H2Version = "1.4.200" val H2Version = "1.4.200"
val Http4sVersion = "0.21.4" val Http4sVersion = "0.21.4"
val Icu4jVersion = "67.1" val Icu4jVersion = "67.1"
val JsoupVersion = "1.13.1" val JsoupVersion = "1.13.1"
val KindProjectorVersion = "0.10.3" val KindProjectorVersion = "0.10.3"
val Log4sVersion = "1.8.2" val Log4sVersion = "1.8.2"
val LogbackVersion = "1.2.3" val LogbackVersion = "1.2.3"
val MariaDbVersion = "2.6.0" val MariaDbVersion = "2.6.0"
val MiniTestVersion = "2.8.2" val MiniTestVersion = "2.8.2"
val PdfboxVersion = "2.0.20" val PdfboxVersion = "2.0.20"
val PoiVersion = "4.1.2" val PoiVersion = "4.1.2"
val PostgresVersion = "42.2.14" val PostgresVersion = "42.2.14"
val PureConfigVersion = "0.12.3" val PureConfigVersion = "0.12.3"
val Slf4jVersion = "1.7.30" val Slf4jVersion = "1.7.30"
val StanfordNlpVersion = "3.9.2" val StanfordNlpVersion = "3.9.2"
val TikaVersion = "1.24.1" val TikaVersion = "1.24.1"
val YamuscaVersion = "0.6.2" val YamuscaVersion = "0.6.2"
val SwaggerUIVersion = "3.27.0" val SwaggerUIVersion = "3.27.0"
val SemanticUIVersion = "2.4.1" val SemanticUIVersion = "2.4.1"
val TwelveMonkeysVersion = "3.5" val TwelveMonkeysVersion = "3.5"
val JQueryVersion = "3.5.1" val JQueryVersion = "3.5.1"
val ViewerJSVersion = "0.5.8" val ViewerJSVersion = "0.5.8"
val calevCore = Seq( val calevCore = Seq(
"com.github.eikek" %% "calev-core" % CalevVersion "com.github.eikek" %% "calev-core" % CalevVersion
@ -57,23 +56,27 @@ object Dependencies {
) )
val poi = Seq( val poi = Seq(
"org.apache.poi" % "poi" % PoiVersion, "org.apache.poi" % "poi" % PoiVersion,
"org.apache.poi" % "poi-ooxml" % PoiVersion, "org.apache.poi" % "poi-ooxml" % PoiVersion,
"org.apache.poi" % "poi-scratchpad" % PoiVersion, "org.apache.poi" % "poi-scratchpad" % PoiVersion
).map(_.excludeAll( ).map(
ExclusionRule("commons-logging") _.excludeAll(
)) ++ jclOverSlf4j ExclusionRule("commons-logging")
)
) ++ jclOverSlf4j
// https://github.com/vsch/flexmark-java // https://github.com/vsch/flexmark-java
// BSD 2-Clause // BSD 2-Clause
val flexmark = Seq( val flexmark = Seq(
"com.vladsch.flexmark" % "flexmark" % FlexmarkVersion, "com.vladsch.flexmark" % "flexmark" % FlexmarkVersion,
"com.vladsch.flexmark" % "flexmark-ext-tables" % FlexmarkVersion, "com.vladsch.flexmark" % "flexmark-ext-tables" % FlexmarkVersion,
"com.vladsch.flexmark" % "flexmark-ext-gfm-strikethrough" % FlexmarkVersion "com.vladsch.flexmark" % "flexmark-ext-gfm-strikethrough" % FlexmarkVersion
).map(_.excludeAll( ).map(
ExclusionRule("junit"), _.excludeAll(
ExclusionRule("hamcrest-core") ExclusionRule("junit"),
)) ExclusionRule("hamcrest-core")
)
)
val twelvemonkeys = Seq( val twelvemonkeys = Seq(
"com.twelvemonkeys.imageio" % "imageio-jpeg" % TwelveMonkeysVersion, "com.twelvemonkeys.imageio" % "imageio-jpeg" % TwelveMonkeysVersion,
@ -81,30 +84,30 @@ object Dependencies {
) )
val pdfbox = Seq( val pdfbox = Seq(
"org.apache.pdfbox" % "pdfbox" % PdfboxVersion excludeAll ( ("org.apache.pdfbox" % "pdfbox" % PdfboxVersion).excludeAll(
ExclusionRule("org.bouncycastle"), ExclusionRule("org.bouncycastle"),
ExclusionRule("commons-logging") ExclusionRule("commons-logging")
) )
) ++ jclOverSlf4j ) ++ jclOverSlf4j
val emilCommon = Seq( val emilCommon = Seq(
"com.github.eikek" %% "emil-common" % EmilVersion, "com.github.eikek" %% "emil-common" % EmilVersion
) )
val emil = Seq( val emil = Seq(
"com.github.eikek" %% "emil-common" % EmilVersion, "com.github.eikek" %% "emil-common" % EmilVersion,
"com.github.eikek" %% "emil-javamail" % EmilVersion "com.github.eikek" %% "emil-javamail" % EmilVersion
) )
val emilDoobie = Seq( val emilDoobie = Seq(
"com.github.eikek" %% "emil-doobie" % EmilVersion, "com.github.eikek" %% "emil-doobie" % EmilVersion
) )
val emilTnef = Seq( val emilTnef = Seq(
"com.github.eikek" %% "emil-tnef" % EmilVersion, "com.github.eikek" %% "emil-tnef" % EmilVersion
) )
val emilMarkdown = Seq( val emilMarkdown = Seq(
"com.github.eikek" %% "emil-markdown" % EmilVersion, "com.github.eikek" %% "emil-markdown" % EmilVersion
) )
val emilJsoup = Seq( val emilJsoup = Seq(
"com.github.eikek" %% "emil-jsoup" % EmilVersion, "com.github.eikek" %% "emil-jsoup" % EmilVersion
) )
val jsoup = Seq( val jsoup = Seq(
@ -112,7 +115,7 @@ object Dependencies {
) )
val stanfordNlpCore = Seq( val stanfordNlpCore = Seq(
"edu.stanford.nlp" % "stanford-corenlp" % StanfordNlpVersion excludeAll( ("edu.stanford.nlp" % "stanford-corenlp" % StanfordNlpVersion).excludeAll(
ExclusionRule("com.io7m.xom", "xom"), ExclusionRule("com.io7m.xom", "xom"),
ExclusionRule("javax.servlet", "javax.servlet-api"), ExclusionRule("javax.servlet", "javax.servlet-api"),
ExclusionRule("org.apache.lucene", "lucene-queryparser"), ExclusionRule("org.apache.lucene", "lucene-queryparser"),
@ -130,8 +133,11 @@ object Dependencies {
) )
val stanfordNlpModels = Seq( val stanfordNlpModels = Seq(
"edu.stanford.nlp" % "stanford-corenlp" % StanfordNlpVersion classifier "models-german", ("edu.stanford.nlp" % "stanford-corenlp" % StanfordNlpVersion)
"edu.stanford.nlp" % "stanford-corenlp" % StanfordNlpVersion classifier "models-english" .classifier("models-german"),
("edu.stanford.nlp" % "stanford-corenlp" % StanfordNlpVersion).classifier(
"models-english"
)
) )
val tika = Seq( val tika = Seq(
@ -150,22 +156,22 @@ object Dependencies {
val fs2 = Seq( val fs2 = Seq(
"co.fs2" %% "fs2-core" % Fs2Version, "co.fs2" %% "fs2-core" % Fs2Version,
"co.fs2" %% "fs2-io" % Fs2Version "co.fs2" %% "fs2-io" % Fs2Version
) )
val http4s = Seq( val http4s = Seq(
"org.http4s" %% "http4s-blaze-server" % Http4sVersion, "org.http4s" %% "http4s-blaze-server" % Http4sVersion,
"org.http4s" %% "http4s-circe" % Http4sVersion, "org.http4s" %% "http4s-circe" % Http4sVersion,
"org.http4s" %% "http4s-dsl" % Http4sVersion, "org.http4s" %% "http4s-dsl" % Http4sVersion
) )
val http4sClient = Seq( val http4sClient = Seq(
"org.http4s" %% "http4s-blaze-client" % Http4sVersion "org.http4s" %% "http4s-blaze-client" % Http4sVersion
) )
val circe = Seq( val circe = Seq(
"io.circe" %% "circe-generic" % CirceVersion, "io.circe" %% "circe-generic" % CirceVersion,
"io.circe" %% "circe-parser" % CirceVersion "io.circe" %% "circe-parser" % CirceVersion
) )
// https://github.com/Log4s/log4s;ASL 2.0 // https://github.com/Log4s/log4s;ASL 2.0
@ -203,7 +209,7 @@ object Dependencies {
// https://github.com/tpolecat/doobie // https://github.com/tpolecat/doobie
// MIT // MIT
val doobie = Seq( val doobie = Seq(
"org.tpolecat" %% "doobie-core" % DoobieVersion, "org.tpolecat" %% "doobie-core" % DoobieVersion,
"org.tpolecat" %% "doobie-hikari" % DoobieVersion "org.tpolecat" %% "doobie-hikari" % DoobieVersion
) )
@ -224,18 +230,18 @@ object Dependencies {
val miniTest = Seq( val miniTest = Seq(
// https://github.com/monix/minitest // https://github.com/monix/minitest
// Apache 2.0 // Apache 2.0
"io.monix" %% "minitest" % MiniTestVersion, "io.monix" %% "minitest" % MiniTestVersion,
"io.monix" %% "minitest-laws" % MiniTestVersion "io.monix" %% "minitest-laws" % MiniTestVersion
).map(_ % Test) ).map(_ % Test)
val kindProjectorPlugin = "org.typelevel" %% "kind-projector" % KindProjectorVersion val kindProjectorPlugin = "org.typelevel" %% "kind-projector" % KindProjectorVersion
val betterMonadicFor = "com.olegpy" %% "better-monadic-for" % BetterMonadicForVersion val betterMonadicFor = "com.olegpy" %% "better-monadic-for" % BetterMonadicForVersion
val webjars = Seq( val webjars = Seq(
"org.webjars" % "swagger-ui" % SwaggerUIVersion, "org.webjars" % "swagger-ui" % SwaggerUIVersion,
"org.webjars" % "Semantic-UI"% SemanticUIVersion, "org.webjars" % "Semantic-UI" % SemanticUIVersion,
"org.webjars" % "jquery" % JQueryVersion, "org.webjars" % "jquery" % JQueryVersion,
"org.webjars" % "viewerjs" % ViewerJSVersion "org.webjars" % "viewerjs" % ViewerJSVersion
) )
val icu4j = Seq( val icu4j = Seq(

View File

@ -20,30 +20,34 @@ object NerModelsPlugin extends AutoPlugin {
object autoImport { object autoImport {
val NerModels = config("NerModels") val NerModels = config("NerModels")
val nerModelsFilter = settingKey[String => Boolean]("Which files to keep.") val nerModelsFilter = settingKey[String => Boolean]("Which files to keep.")
val nerModelsRunFilter = taskKey[Seq[File]]("Extract files from libraryDependencies") val nerModelsRunFilter = taskKey[Seq[File]]("Extract files from libraryDependencies")
} }
import autoImport._ import autoImport._
def nerModelSettings: Seq[Setting[_]] = Seq( def nerModelSettings: Seq[Setting[_]] =
nerModelsFilter := (_ => false), Seq(
nerModelsRunFilter := { nerModelsFilter := (_ => false),
filterArtifacts(streams.value.log nerModelsRunFilter := {
, Classpaths.managedJars(NerModels, Set("jar", "zip"), update.value) filterArtifacts(
, nerModelsFilter.value streams.value.log,
, (Compile/resourceManaged).value) Classpaths.managedJars(NerModels, Set("jar", "zip"), update.value),
}, nerModelsFilter.value,
Compile / resourceGenerators += nerModelsRunFilter.taskValue (Compile / resourceManaged).value
) )
},
Compile / resourceGenerators += nerModelsRunFilter.taskValue
)
def nerClassifierSettings: Seq[Setting[_]] = Seq( def nerClassifierSettings: Seq[Setting[_]] =
libraryDependencies ++= Dependencies.stanfordNlpModels.map(_ % NerModels), Seq(
nerModelsFilter := { libraryDependencies ++= Dependencies.stanfordNlpModels.map(_ % NerModels),
name => nerModels.exists(name.endsWith) nerModelsFilter := { name =>
} nerModels.exists(name.endsWith)
) }
)
override def projectConfigurations: Seq[Configuration] = override def projectConfigurations: Seq[Configuration] =
Seq(NerModels) Seq(NerModels)
@ -51,11 +55,16 @@ object NerModelsPlugin extends AutoPlugin {
override def projectSettings: Seq[Setting[_]] = override def projectSettings: Seq[Setting[_]] =
nerModelSettings nerModelSettings
def filterArtifacts(logger: Logger, cp: Classpath, nameFilter: NameFilter, out: File): Seq[File] = { def filterArtifacts(
logger: Logger,
cp: Classpath,
nameFilter: NameFilter,
out: File
): Seq[File] = {
logger.info(s"NerModels: Filtering artifacts...") logger.info(s"NerModels: Filtering artifacts...")
cp.files.flatMap(f => { cp.files.flatMap { f =>
IO.unzip(f, out, nameFilter) IO.unzip(f, out, nameFilter)
}) }
} }
private val nerModels = List( private val nerModels = List(