build.sbt (cilib-0.8) | : | build.sbt (cilib-2.0.1) | ||
---|---|---|---|---|
seq(scalariformSettings: _*) | import sbt._ | |||
import sbt.Keys._ | ||||
import sbtrelease.ReleaseStateTransformations._ | ||||
scalacOptions += "-deprecation" | val scalazVersion = "7.2.7" | |||
val scalazStreamVersion = "0.8.6a" | ||||
val spireVersion = "0.13.0" | ||||
val monocleVersion = "1.3.2" | ||||
val scalacheckVersion = "1.12.6" | ||||
val avro4sVersion = "1.8.3" | ||||
parallelExecution in Test := false | lazy val buildSettings = Seq( | |||
organization := "net.cilib" | ||||
) | ||||
lazy val commonSettings = Seq( | ||||
autoAPIMappings := true, | ||||
scalacOptions ++= Seq( | ||||
"-deprecation", // Emit warning and location for usages | ||||
of deprecated APIs. | ||||
"-encoding", "utf-8", // Specify character encoding used by s | ||||
ource files. | ||||
"-explaintypes", // Explain type errors in more detail. | ||||
"-feature", // Emit warning and location for usages | ||||
of features that should be imported explicitly. | ||||
"-language:existentials", // Existential types (besides wildcard | ||||
types) can be written and inferred | ||||
"-language:experimental.macros", // Allow macro definition (besides impl | ||||
ementation and application) | ||||
"-language:higherKinds", // Allow higher-kinded types | ||||
"-language:implicitConversions", // Allow definition of implicit functio | ||||
ns called views | ||||
"-unchecked", // Enable additional warnings where gen | ||||
erated code depends on assumptions. | ||||
"-Xcheckinit", // Wrap field accessors to throw an exc | ||||
eption on uninitialized access. | ||||
//"-Xfatal-warnings", // Fail the compilation if there are an | ||||
y warnings. | ||||
"-Xfuture", // Turn on future language features. | ||||
"-Xlint:adapted-args", // Warn if an argument list is modified | ||||
to match the receiver. | ||||
"-Xlint:by-name-right-associative", // By-name parameter of right associati | ||||
ve operator. | ||||
"-Xlint:delayedinit-select", // Selecting member of DelayedInit. | ||||
"-Xlint:doc-detached", // A Scaladoc comment appears to be det | ||||
ached from its element. | ||||
"-Xlint:inaccessible", // Warn about inaccessible types in met | ||||
hod signatures. | ||||
"-Xlint:infer-any", // Warn when a type argument is inferre | ||||
d to be `Any`. | ||||
"-Xlint:missing-interpolator", // A string literal appears to be missi | ||||
ng an interpolator id. | ||||
"-Xlint:nullary-override", // Warn when non-nullary `def f()' over | ||||
rides nullary `def f'. | ||||
"-Xlint:nullary-unit", // Warn when nullary methods return Uni | ||||
t. | ||||
"-Xlint:option-implicit", // Option.apply used implicit view. | ||||
"-Xlint:package-object-classes", // Class or object defined in package o | ||||
bject. | ||||
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit me | ||||
thods are not visible as view bounds. | ||||
"-Xlint:private-shadow", // A private field (or class parameter) | ||||
shadows a superclass field. | ||||
"-Xlint:stars-align", // Pattern sequence wildcard must align | ||||
with sequence component. | ||||
"-Xlint:type-parameter-shadow", // A local type parameter shadows a typ | ||||
e already in scope. | ||||
"-Xlint:unsound-match", // Pattern match may not be typesafe. | ||||
"-Yno-adapted-args", // Do not adapt an argument list (eithe | ||||
r by inserting () or creating a tuple) to match the receiver. | ||||
"-Ypartial-unification", // Enable partial unification in type c | ||||
onstructor inference | ||||
"-Ywarn-dead-code", // Warn when dead code is identified. | ||||
"-Ywarn-inaccessible", // Warn about inaccessible types in met | ||||
hod signatures. | ||||
"-Ywarn-infer-any", // Warn when a type argument is inferre | ||||
d to be `Any`. | ||||
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' over | ||||
rides nullary `def f'. | ||||
"-Ywarn-nullary-unit", // Warn when nullary methods return Uni | ||||
t. | ||||
"-Ywarn-numeric-widen", // Warn when numerics are widened. | ||||
"-Ywarn-value-discard" // Warn when non-Unit expression result | ||||
s are unused. | ||||
) ++ ( | ||||
if (scalaVersion.value.startsWith("2.11")) Seq() | ||||
else Seq( | ||||
"-Xlint:constant", // Evaluation of a constant arithmeti | ||||
c expression results in an error. | ||||
"-Ywarn-extra-implicit", // Warn when more than one implicit p | ||||
arameter section is defined. | ||||
"-Ywarn-unused:implicits", // Warn if an implicit parameter is u | ||||
nused. | ||||
"-Ywarn-unused:imports", // Warn if an import selector is not | ||||
referenced. | ||||
"-Ywarn-unused:locals", // Warn if a local definition is unus | ||||
ed. | ||||
"-Ywarn-unused:params", // Warn if a value parameter is unuse | ||||
d. | ||||
"-Ywarn-unused:patvars", // Warn if a variable bound in a patt | ||||
ern is unused. | ||||
"-Ywarn-unused:privates", // Warn if a private member is unused | ||||
. | ||||
) | ||||
), | ||||
scalacOptions in (Compile, console) ~= (_.filterNot(Set( | ||||
"-Ywarn-unused:imports", | ||||
"-Xfatal-warnings" | ||||
))), | ||||
resolvers ++= Seq( | ||||
Resolver.sonatypeRepo("releases"), | ||||
"bintray/non" at "http://dl.bintray.com/non/maven" | ||||
), | ||||
libraryDependencies ++= Seq( | ||||
compilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3" cross CrossVer | ||||
sion.binary) | ||||
), | ||||
scmInfo := Some(ScmInfo(url("https://github.com/cirg-up/cilib"), | ||||
"scm:git:git@github.com:cirg-up/cilib.git")), | ||||
initialCommands in console := """ | ||||
|import scalaz._ | ||||
|import Scalaz._ | ||||
|import cilib._ | ||||
|""".stripMargin | ||||
) | ||||
lazy val noPublishSettings = Seq( | ||||
skip in publish := true | ||||
) | ||||
lazy val publishSettings = Seq( | ||||
organizationHomepage := Some(url("http://cirg.cs.up.ac.za")), | ||||
homepage := Some(url("http://www.cilib.net")), | ||||
licenses := Seq("BSD-style" -> url("http://opensource.org/licenses/BSD-2-Claus | ||||
e")),//Seq("MIT" -> url("http://opensource.org/licenses/MIT")), | ||||
autoAPIMappings := true, | ||||
apiURL := Some(url("https://www.cilib.net/api/")), | ||||
publishMavenStyle := true, | ||||
//publishArtifact in packageDoc := false, | ||||
publishArtifact in Test := false, | ||||
pomIncludeRepository := { _ => false }, | ||||
publishTo := Some("releases" at "https://oss.sonatype.org/service/local/stagin | ||||
g/deploy/maven2"), | ||||
// { | ||||
// val nexus = "https://oss.sonatype.org/" | ||||
// if (isSnapshot.value) | ||||
// Some("snapshots" at nexus + "content/repositories/snapshots") | ||||
// else | ||||
// Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||||
// }, | ||||
pomExtra := ( | ||||
<developers> | ||||
{ | ||||
Seq( | ||||
("gpampara", "Gary Pamparà "), | ||||
("filinep", "Filipe Nepomuceno"), | ||||
("benniel", "Bennie Leonard") | ||||
).map { | ||||
case (id, name) => | ||||
<developer> | ||||
<id>{id}</id> | ||||
<name>{name}</name> | ||||
<url>http://github.com/{id}</url> | ||||
</developer> | ||||
} | ||||
} | ||||
</developers> | ||||
) | ||||
) | ||||
lazy val cilibSettings = | ||||
buildSettings ++ | ||||
commonSettings ++ | ||||
publishSettings ++ | ||||
credentialSettings | ||||
lazy val cilib = project | ||||
.in(file(".")) | ||||
.enablePlugins(GitVersioning, ReleasePlugin) | ||||
.settings(credentialSettings ++ noPublishSettings ++ Seq( | ||||
git.useGitDescribe := true, | ||||
releaseProcess := Seq[ReleaseStep]( | ||||
checkSnapshotDependencies, | ||||
// runClean, | ||||
// runTest, | ||||
releaseStepCommand("publishSigned"), | ||||
releaseStepCommand("sonatypeReleaseAll") | ||||
) | ||||
)) | ||||
.aggregate(core, de, docs, eda, example, exec, ga, moo, pso, tests) | ||||
.dependsOn(core, de, docs, eda, example, exec, ga, moo, pso, tests) | ||||
lazy val core = project | ||||
.settings( | ||||
cilibSettings ++ Seq( | ||||
moduleName := "cilib-core", | ||||
libraryDependencies ++= Seq( | ||||
"org.scalaz" %% "scalaz-core" % scalazVersion, | ||||
"org.scalaz" %% "scalaz-concurrent" % scalazVersion, | ||||
"org.spire-math" %% "spire" % spireVersion, | ||||
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion, | ||||
"com.chuusai" %% "shapeless" % "2.3.2", | ||||
"eu.timepit" %% "refined" % "0.8.5" | ||||
), | ||||
wartremoverErrors in (Compile, compile) ++= Seq( | ||||
//Wart.Any, | ||||
//Wart.Nothing, | ||||
Wart.AnyVal, | ||||
Wart.ArrayEquals, | ||||
Wart.AsInstanceOf, | ||||
Wart.DefaultArguments, | ||||
Wart.ExplicitImplicitTypes, | ||||
Wart.FinalCaseClass, | ||||
Wart.FinalVal, | ||||
Wart.ImplicitConversion, | ||||
Wart.ImplicitParameter, | ||||
Wart.IsInstanceOf, | ||||
Wart.JavaConversions, | ||||
Wart.JavaSerializable, | ||||
Wart.LeakingSealed, | ||||
Wart.MutableDataStructures, | ||||
Wart.NonUnitStatements, | ||||
Wart.Null, | ||||
Wart.Option2Iterable, | ||||
Wart.OptionPartial, | ||||
Wart.Overloading, | ||||
Wart.Product, | ||||
//Wart.PublicInference, | ||||
Wart.Return, | ||||
Wart.Serializable, | ||||
Wart.StringPlusAny, | ||||
Wart.Throw, | ||||
Wart.TraversableOps, | ||||
Wart.TryPartial, | ||||
Wart.Var | ||||
) | ||||
)) | ||||
val siteStageDirectory = SettingKey[File]("site-stage-directory") | ||||
val copySiteToStage = TaskKey[Unit]("copy-site-to-stage") | ||||
lazy val docs = project | ||||
.in(file("docs")) | ||||
.enablePlugins(GhpagesPlugin, | ||||
TutPlugin, | ||||
ParadoxSitePlugin, | ||||
ParadoxMaterialThemePlugin, | ||||
ScalaUnidocPlugin) | ||||
.settings(ParadoxMaterialThemePlugin.paradoxMaterialThemeSettings(Paradox)) | ||||
.settings(moduleName := "cilib-docs") | ||||
.settings(cilibSettings) | ||||
.settings(noPublishSettings) | ||||
.settings(docSettings) | ||||
.dependsOn(core, example, exec, pso, moo, ga) | ||||
resolvers ++= Seq( | lazy val docSettings = Seq( | |||
"snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", | fork in tut := true, | |||
"releases" at "http://oss.sonatype.org/content/repositories/releases" | tutSourceDirectory := sourceDirectory.value / "main" / "tut", | |||
scalacOptions in Tut ~= (_.filterNot(Set("-Ywarn-unused:imports", "-Ywarn-dead | ||||
-code"))), | ||||
git.remoteRepo := "git@github.com:cirg-up/cilib.git", | ||||
ghpagesNoJekyll := true, | ||||
excludeFilter in ghpagesCleanSite := | ||||
new FileFilter { | ||||
def accept(f: File) = | ||||
(ghpagesRepository.value / "CNAME").getCanonicalPath == f.getCanonicalPa | ||||
th | ||||
}, | ||||
siteSubdirName in SiteScaladoc := "api", | ||||
unidocProjectFilter in (ScalaUnidoc, unidoc) := inAnyProject -- inProjects(exa | ||||
mple), | ||||
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), siteSubdirName in | ||||
SiteScaladoc), | ||||
siteStageDirectory := target.value / "site-stage", | ||||
sourceDirectory in paradox in Paradox := siteStageDirectory.value, | ||||
sourceDirectory in paradox := siteStageDirectory.value, | ||||
paradoxMaterialTheme in Paradox ~= { | ||||
_.withFavicon("img/favicon.png") | ||||
.withLogo("img/cilib_logo_transparent.png") | ||||
.withRepository(uri("https://github.com/cirg-up/cilib")) | ||||
}, | ||||
paradoxProperties in Compile ++= Map( | ||||
"github.base_url" -> s"https://github.com/cirg-up/cilib/tree/series/2.0.x/${ | ||||
version.value}" | ||||
), | ||||
copySiteToStage := { | ||||
IO.copyDirectory(source = sourceDirectory.value / "main" / "paradox", | ||||
target = siteStageDirectory.value, | ||||
overwrite = false, | ||||
preserveLastModified = true) | ||||
IO.copyDirectory(source = tutTargetDirectory.value, | ||||
target = siteStageDirectory.value, | ||||
overwrite = false, | ||||
preserveLastModified = true) | ||||
IO.write(file = siteStageDirectory.value / "CNAME", content = "cilib.net") | ||||
}, | ||||
copySiteToStage := copySiteToStage.dependsOn(tutQuick).value, | ||||
makeSite := makeSite.dependsOn(copySiteToStage).value | ||||
) | ) | |||
lazy val credentialSettings = Seq( | ||||
credentials ++= (for { | ||||
username <- Option(System.getenv("SONATYPE_USERNAME")) | ||||
password <- Option(System.getenv("SONATYPE_PASSWORD")) | ||||
} yield | ||||
Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", usernam | ||||
e, password)).toSeq, | ||||
sonatypeProfileName := "net.cilib", | ||||
pgpPublicRing := file("./project/local.pubring.asc"), | ||||
pgpSecretRing := file("./project/local.secring.asc"), | ||||
pgpPassphrase := Option(System.getenv("PGP_PASS")).map(_.toArray) | ||||
) | ||||
lazy val eda = project | ||||
.dependsOn(core) | ||||
.settings(Seq(moduleName := "cilib-eda") ++ cilibSettings) | ||||
lazy val example = project | ||||
.dependsOn(core, de, exec, ga, io, moo, pso) | ||||
.settings( | ||||
cilibSettings ++ noPublishSettings ++ Seq( | ||||
fork in run := true, | ||||
moduleName := "cilib-example", | ||||
libraryDependencies ++= Seq( | ||||
"net.cilib" %% "benchmarks" % "0.1.1", | ||||
"org.scalaz" %% "scalaz-effect" % scalazVersion | ||||
) | ||||
)) | ||||
lazy val exec = project | ||||
.dependsOn(core) | ||||
.settings(cilibSettings ++ Seq( | ||||
moduleName := "cilib-exec", | ||||
libraryDependencies ++= Seq( | ||||
"org.scalaz" %% "scalaz-concurrent" % scalazVersion, | ||||
"org.scalaz.stream" %% "scalaz-stream" % scalazStreamVersion, | ||||
"com.sksamuel.avro4s" %% "avro4s-core" % avro4sVersion | ||||
) | ||||
)) | ||||
lazy val moo = project | ||||
.dependsOn(core) | ||||
.settings(Seq(moduleName := "cilib-moo") ++ cilibSettings) | ||||
lazy val pso = project | ||||
.dependsOn(core) | ||||
.settings(Seq(moduleName := "cilib-pso") ++ cilibSettings) | ||||
lazy val ga = project | ||||
.dependsOn(core) | ||||
.settings(Seq(moduleName := "cilib-ga") ++ cilibSettings) | ||||
lazy val de = project | ||||
.dependsOn(core) | ||||
.settings(Seq(moduleName := "cilib-de") ++ cilibSettings) | ||||
lazy val tests = project | ||||
.dependsOn(core, pso, ga, moo) | ||||
.settings( | ||||
cilibSettings ++ noPublishSettings ++ Seq( | ||||
moduleName := "cilib-tests", | ||||
fork in test := true, | ||||
javaOptions in test += "-Xmx1G", | ||||
libraryDependencies ++= Seq( | ||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % "test", | ||||
"org.scalaz" %% "scalaz-scalacheck-binding" % scalazVersion % "test" | ||||
) | ||||
)) | ||||
lazy val io = project | ||||
.dependsOn(core, exec) | ||||
.settings( | ||||
cilibSettings ++ noPublishSettings ++ Seq( | ||||
moduleName := "cilib-io", | ||||
libraryDependencies ++= Seq( | ||||
"com.chuusai" %% "shapeless" % "2.3.2", | ||||
"com.sksamuel.avro4s" %% "avro4s-core" % avro4sVersion, | ||||
"org.apache.parquet" % "parquet-avro" % "1.9.0", | ||||
"org.apache.hadoop" % "hadoop-client" % "2.7.3", | ||||
"org.scalaz.stream" %% "scalaz-stream" % scalazStreamVersion | ||||
) | ||||
)) | ||||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 295 lines changed or added |