sbt/build.sbt

231 lines
6.9 KiB
Plaintext
Raw Normal View History

import sbtrelease.ReleasePlugin.ReleaseKeys.{ publishArtifactsAction, versionBump }
import sbtrelease.Version.Bump
lazy val publishingSettings = Seq(
publishMavenStyle := true,
2015-11-21 14:23:07 +01:00
licenses := Seq("Apache 2.0" -> url("http://opensource.org/licenses/Apache-2.0")),
homepage := Some(url("https://github.com/alexarchambault/coursier")),
pomExtra := {
<scm>
<connection>scm:git:github.com/alexarchambault/coursier.git</connection>
<developerConnection>scm:git:git@github.com:alexarchambault/coursier.git</developerConnection>
<url>github.com/alexarchambault/coursier.git</url>
</scm>
<developers>
<developer>
<id>alexarchambault</id>
<name>Alexandre Archambault</name>
<url>https://github.com/alexarchambault</url>
</developer>
</developers>
2015-12-12 19:01:37 +01:00
}
) ++ releaseSettings
lazy val releaseSettings = sbtrelease.ReleasePlugin.releaseSettings ++ Seq(
publishTo := {
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")
},
2015-12-12 19:01:37 +01:00
versionBump := Bump.Bugfix,
publishArtifactsAction := PgpKeys.publishSigned.value,
credentials += {
Seq("SONATYPE_USER", "SONATYPE_PASS").map(sys.env.get) match {
case Seq(Some(user), Some(pass)) =>
Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", user, pass)
case _ =>
Credentials(Path.userHome / ".ivy2" / ".credentials")
}
2015-12-12 19:01:37 +01:00
}
)
2015-11-21 14:23:08 +01:00
lazy val noPublishSettings = Seq(
publish := (),
publishLocal := (),
publishArtifact := false
)
lazy val baseCommonSettings = Seq(
organization := "com.github.alexarchambault",
resolvers ++= Seq(
"Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases",
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
2015-11-28 17:56:55 +01:00
),
scalacOptions += "-target:jvm-1.7",
javacOptions ++= Seq(
"-source", "1.7",
"-target", "1.7"
2015-12-30 01:34:34 +01:00
),
javacOptions in Keys.doc := Seq()
)
lazy val commonSettings = baseCommonSettings ++ Seq(
scalaVersion := "2.11.7",
crossScalaVersions := Seq("2.10.6", "2.11.7"),
2015-11-21 14:23:08 +01:00
libraryDependencies ++= {
if (scalaVersion.value startsWith "2.10.")
Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.0.1" cross CrossVersion.full))
else
Seq()
}
)
lazy val core = crossProject
.settings(commonSettings: _*)
.settings(publishingSettings: _*)
.settings(
name := "coursier"
)
.jvmSettings(
libraryDependencies ++=
Seq(
"org.scalaz" %% "scalaz-core" % "7.1.2"
) ++ {
if (scalaVersion.value.startsWith("2.10.")) Seq()
else Seq(
"org.scala-lang.modules" %% "scala-xml" % "1.0.3"
)
}
)
.jsSettings(
libraryDependencies ++= Seq(
"com.github.japgolly.fork.scalaz" %%% "scalaz-core" % (if (scalaVersion.value.startsWith("2.10.")) "7.1.1" else "7.1.2"),
"org.scala-js" %%% "scalajs-dom" % "0.8.0",
"be.doeraene" %%% "scalajs-jquery" % "0.8.0"
)
)
lazy val coreJvm = core.jvm
lazy val coreJs = core.js
lazy val `fetch-js` = project
.enablePlugins(ScalaJSPlugin)
.dependsOn(coreJs)
.settings(commonSettings)
.settings(noPublishSettings)
.settings(
name := "coursier-fetch-js"
)
lazy val tests = crossProject
.dependsOn(core)
.settings(commonSettings: _*)
.settings(noPublishSettings: _*)
.settings(
name := "coursier-tests",
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-async" % "0.9.1" % "provided",
"com.lihaoyi" %%% "utest" % "0.3.0" % "test"
),
unmanagedResourceDirectories in Test += (baseDirectory in LocalRootProject).value / "tests" / "shared" / "src" / "test" / "resources",
testFrameworks += new TestFramework("utest.runner.Framework")
)
.jsSettings(
postLinkJSEnv := NodeJSEnv().value,
scalaJSStage in Global := FastOptStage
)
2015-12-30 01:34:41 +01:00
lazy val testsJvm = tests.jvm.dependsOn(cache % "test")
lazy val testsJs = tests.js.dependsOn(`fetch-js` % "test")
2015-12-30 01:34:41 +01:00
lazy val cache = project
.dependsOn(coreJvm)
.settings(commonSettings)
.settings(publishingSettings)
.settings(
2015-12-30 01:34:41 +01:00
name := "coursier-cache",
libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-concurrent" % "7.1.2"
)
)
lazy val bootstrap = project
.settings(baseCommonSettings)
.settings(publishingSettings)
.settings(
name := "coursier-bootstrap",
artifactName := {
val artifactName0 = artifactName.value
(sv, m, artifact) =>
if (artifact.`type` == "jar" && artifact.extension == "jar")
"bootstrap.jar"
else
artifactName0(sv, m, artifact)
},
crossPaths := false,
2015-12-30 01:34:34 +01:00
autoScalaLibrary := false
)
lazy val cli = project
2015-12-30 01:34:41 +01:00
.dependsOn(coreJvm, cache)
.settings(commonSettings)
2015-12-30 01:34:34 +01:00
.settings(publishingSettings)
.settings(packAutoSettings)
.settings(
name := "coursier-cli",
libraryDependencies ++= Seq(
"com.github.alexarchambault" %% "case-app" % "1.0.0-SNAPSHOT",
2015-11-29 20:22:25 +01:00
"com.lihaoyi" %% "ammonite-terminal" % "0.5.0",
"ch.qos.logback" % "logback-classic" % "1.1.3"
2015-12-30 01:34:34 +01:00
)
)
lazy val web = project
.enablePlugins(ScalaJSPlugin)
.dependsOn(coreJs, `fetch-js`)
.settings(commonSettings)
2015-11-21 14:23:08 +01:00
.settings(noPublishSettings)
.settings(
libraryDependencies ++= {
if (scalaVersion.value startsWith "2.10.")
Seq()
else
Seq("com.github.japgolly.scalajs-react" %%% "core" % "0.9.0")
},
sourceDirectory := {
val dir = sourceDirectory.value
if (scalaVersion.value startsWith "2.10.")
dir / "dummy"
else
dir
},
test in Test := (),
testOnly in Test := (),
resolvers += "Webjars Bintray" at "https://dl.bintray.com/webjars/maven/",
jsDependencies ++= Seq(
("org.webjars.bower" % "bootstrap" % "3.3.4" intransitive()) / "bootstrap.min.js" commonJSName "Bootstrap",
("org.webjars.bower" % "react" % "0.12.2" intransitive()) / "react-with-addons.js" commonJSName "React",
("org.webjars.bower" % "bootstrap-treeview" % "1.2.0" intransitive()) / "bootstrap-treeview.min.js" commonJSName "Treeview",
("org.webjars.bower" % "raphael" % "2.1.4" intransitive()) / "raphael-min.js" commonJSName "Raphael"
)
)
2015-12-30 01:34:34 +01:00
lazy val doc = project
2015-12-30 01:34:41 +01:00
.dependsOn(coreJvm, cache)
2015-12-30 01:34:34 +01:00
.settings(commonSettings)
.settings(noPublishSettings)
.settings(tutSettings)
.settings(
tutSourceDirectory := baseDirectory.value,
tutTargetDirectory := baseDirectory.value / ".."
)
2015-12-30 01:34:34 +01:00
// Don't try to compile that if you're not in 2.10
lazy val plugin = project
2015-12-30 01:34:41 +01:00
.dependsOn(coreJvm, cache, cli)
2015-12-30 01:34:34 +01:00
.settings(baseCommonSettings)
.settings(
name := "coursier-sbt-plugin",
sbtPlugin := true
)
lazy val `coursier` = project.in(file("."))
2015-12-30 01:34:41 +01:00
.aggregate(coreJvm, coreJs, `fetch-js`, testsJvm, testsJs, cache, bootstrap, cli, web, doc)
.settings(commonSettings)
2015-11-21 14:23:08 +01:00
.settings(noPublishSettings)
2015-12-12 19:01:37 +01:00
.settings(releaseSettings)