-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
141 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import java.io.File | ||
|
||
import sbt.Keys._ | ||
import sbt._ | ||
|
||
object Publish { | ||
|
||
def skipSettings: Seq[Def.Setting[_]] = | ||
Seq( | ||
publish / skip := true | ||
) | ||
|
||
def settings: Seq[Def.Setting[_]] = | ||
Seq( | ||
publishTo := { | ||
import Resolver.mavenStylePatterns | ||
|
||
sys.env | ||
.get("REPO_PATH") | ||
.map(path => Resolver.file("repo", new File(path))) | ||
}, | ||
licenses := Seq( | ||
"MIT License" -> url( | ||
"https://github.com/zengularity/query-monad/blob/master/LICENSE" | ||
) | ||
), | ||
pomIncludeRepository := { _ => | ||
false | ||
}, | ||
autoAPIMappings := true, | ||
homepage := Some(url("https://github.com/zengularity/query-monad")), // TODO | ||
apiURL := Some(url("https://github.com/zengularity/query-monad")), // TODO | ||
scmInfo := Some( | ||
ScmInfo(url("https://github.com/zengularity/query-monad"), | ||
"git@github.com:zengularity/query-monad.git") | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import sbt.Keys._ | ||
import sbt.{Def, _} | ||
|
||
object Settings { | ||
|
||
def commonLibSettings: Seq[Def.Setting[_]] = | ||
commonSettings ++ Publish.settings | ||
|
||
def commonExamplesSettings: Seq[Def.Setting[_]] = | ||
commonSettings ++ Publish.skipSettings | ||
|
||
private def commonSettings = | ||
Seq( | ||
organization := "com.zengularity", | ||
crossPaths := false, | ||
scalacOptions ++= scalacOptionsVersion(scalaVersion.value), | ||
scalacOptions in (Compile, console) ~= (_.filterNot( | ||
Set( | ||
"-Ywarn-unused:imports", | ||
"-Xfatal-warnings" | ||
) | ||
)), | ||
scalacOptions in (Test, compile) ~= (_.filterNot( | ||
Set( | ||
"-Ywarn-unused:imports", | ||
"-Xfatal-warnings", | ||
"-Yrangepos" | ||
) | ||
)), | ||
resolvers ++= Seq[Resolver]( | ||
Resolver.sonatypeRepo("releases") | ||
) | ||
) | ||
|
||
private def scalacOptionsVersion(scalaVersion: String) = { | ||
val defaultOptions = Seq( | ||
"-deprecation", // Emit warning and location for usages of deprecated APIs. | ||
"-encoding", | ||
"utf-8", // Specify character encoding used by source files. | ||
"-explaintypes", // Explain type errors in more detail. | ||
"-feature", // Emit warning and location for usages of features that should be imported explicitly. | ||
"-unchecked", // Enable additional warnings where generated code depends on assumptions. | ||
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access. | ||
"-Xfatal-warnings", // Fail the compilation if there are any warnings. | ||
"-Xlint", | ||
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver. | ||
"-Ypartial-unification", // Enable partial unification in type constructor inference | ||
"-Ywarn-dead-code", // Warn when dead code is identified. | ||
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures. | ||
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`. | ||
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'. | ||
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit. | ||
"-Ywarn-numeric-widen", // Warn when numerics are widened. | ||
"-Ywarn-unused", // Warn if unused. | ||
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused. | ||
) | ||
val v211Options = Seq( | ||
"-Xsource:2.12" // See https://github.com/scala/scala/releases/tag/v2.11.11 | ||
) | ||
val v212Options = Seq( | ||
"-Ywarn-extra-implicit" // Warn when more than one implicit parameter section is defined. | ||
) | ||
|
||
CrossVersion.partialVersion(scalaVersion) match { | ||
case Some((2L, 11L)) => defaultOptions ++ v211Options | ||
case _ => defaultOptions ++ v212Options | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ThisBuild / version := "0.0.1-SNAPSHOT" |