Skip to content
This repository has been archived by the owner on Mar 7, 2022. It is now read-only.

Commit

Permalink
use sbt tpolecat for scalacoptions instead (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
kailuowang authored Mar 6, 2021
1 parent 4b8e997 commit fee8c36
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test.tdb
.bsp
target
lib_managed
src_managed
Expand Down
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ description := "SBT plugin for Catalysts"
libraryDependencies += "org.slf4j" % "slf4j-nop" % "1.7.30"
enablePlugins(SbtPlugin)
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.0.15")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.0.15")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.0")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.3.2")

addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.16")
scalacOptions ++= Seq(Opts.compile.deprecation, "-feature")

licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html"))
Expand Down
76 changes: 0 additions & 76 deletions src/main/scala/sbtcatalysts/CatalystsPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -252,48 +252,6 @@ trait CatalystsBase {
case _ => false
}

/** Common scalac options useful to most (if not all) projects.*/
lazy val scalacCommonOptions = Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-unchecked"
)

/** Scalac options for additional language options.*/
lazy val scalacLanguageOptions = Seq(
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-language:experimental.macros"
)

/** Scalac strict compilation options.*/
lazy val scalacStrictOptions = Seq(
"-Xfatal-warnings",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard"
)

lazy val scalacStrictOptions2_12 = Seq(
"-Yno-adapted-args",
"-Xfuture"
)

/** Combines all scalac options.*/
lazy val scalacAllOptions: Seq[String] = scalacCommonOptions ++ scalacLanguageOptions ++ scalacStrictOptions

def scalacAllOptionsFor(scalaVersion: String): Seq[String] = scalacAllOptions ++ {
if(priorTo2_13(scalaVersion)) scalacStrictOptions2_12 else Nil
}

/** all scalac options as a settings including the partialUnification and xlint **/
lazy val scalacAllSettings: Seq[Setting[_]] = Seq(
scalacOptions ++= scalacAllOptionsFor(scalaVersion.value)
) ++ partialUnificationSettings ++ xlintSettings ++ warnUnusedImport


/**
* Settings common to all projects.
*
Expand Down Expand Up @@ -413,22 +371,6 @@ trait CatalystsBase {
},
)

/** Add the "unused import" warning to scala 2.11+, but not for the console.*/
lazy val warnUnusedImport = Seq(
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) =>
Seq()
case Some((2, 11)) =>
Seq("-Ywarn-unused-import")
case Some((2, n)) if n >= 12 =>
Seq("-Ywarn-unused:imports")

}
},
scalacOptions in (Compile, console) -= "-Ywarn-unused-import",
scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value
)

/** Adds the credential settings required for sonatype releases.*/
lazy val credentialSettings = Seq(
Expand All @@ -439,24 +381,6 @@ trait CatalystsBase {
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq
)

lazy val xlintSettings = Seq(
scalacOptions += {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) => "-Xlint:-unused,_" //Xlint:unused warn against unused implicit evidence
case _ => "-Xlint"
}
}
)

lazy val partialUnificationSettings = Seq(
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 11 | 12)) => Seq("-Ypartial-unification")
case _ => Nil //Xling:unused warn against unused implicit evidence
}
}
)

lazy val CompileTime = config("compile-time").hide

/**
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/sbt-catalysts/smoke/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ lazy val coreM = module("core", CrossType.Pure)

lazy val buildSettings = sharedBuildSettings(gh, libs)

lazy val commonSettings = sharedCommonSettings ++ scalacAllSettings ++ Seq(
lazy val commonSettings = sharedCommonSettings ++ Seq(
developers := List(Developer("Kailuo Wang", "@kailuowang", "[email protected]", new java.net.URL("http://kailuowang.com"))),
parallelExecution in Test := false,
crossScalaVersions := Seq(libs.vers("scalac_2.11"), scalaVersion.value),
Expand Down

0 comments on commit fee8c36

Please sign in to comment.