sbt/build.sbt

338 lines
7.0 KiB
Plaintext
Raw Normal View History

2017-04-02 21:51:11 +02:00
import Aliases._
2017-05-15 15:32:47 +02:00
import Settings._
2017-04-02 21:51:11 +02:00
import Publish._
2017-04-02 21:51:11 +02:00
parallelExecution.in(Global) := false
2016-08-31 21:23:11 +02:00
lazy val core = crossProject
2017-04-02 21:51:11 +02:00
.jvmConfigure(_.enablePlugins(ShadingPlugin))
2017-02-28 14:42:28 +01:00
.jvmSettings(
2017-04-02 21:51:11 +02:00
shading,
quasiQuotesIfNecessary,
scalaXmlIfNecessary,
libs ++= Seq(
Deps.fastParse % "shaded",
2017-05-10 02:06:47 +02:00
Deps.jsoup % "shaded"
),
shadeNamespaces ++= Set(
"org.jsoup",
"fastparse",
"sourcecode"
2017-04-02 21:51:11 +02:00
),
generatePropertyFile
2017-02-28 14:42:28 +01:00
)
.jsSettings(
2017-04-02 21:51:11 +02:00
libs ++= Seq(
CrossDeps.fastParse.value,
CrossDeps.scalaJsDom.value
)
2017-02-28 14:42:28 +01:00
)
.settings(
2017-04-02 21:51:11 +02:00
shared,
2016-01-31 20:55:18 +01:00
name := "coursier",
2017-04-02 21:51:11 +02:00
libs += CrossDeps.scalazCore.value,
Mima.previousArtifacts,
Mima.coreFilters
)
lazy val coreJvm = core.jvm
lazy val coreJs = core.js
lazy val `fetch-js` = project
.enablePlugins(ScalaJSPlugin)
.dependsOn(coreJs)
.settings(
2017-04-02 21:51:11 +02:00
shared,
dontPublish,
coursierPrefix
)
lazy val tests = crossProject
.dependsOn(core)
2017-04-02 21:51:11 +02:00
.jvmConfigure(_.dependsOn(cache % "test"))
.jsConfigure(_.dependsOn(`fetch-js` % "test"))
.jsSettings(
2017-04-02 21:51:11 +02:00
scalaJSStage.in(Global) := FastOptStage
)
.configs(Integration)
.settings(
shared,
dontPublish,
hasITs,
coursierPrefix,
libs += Deps.scalaAsync.value,
utest,
sharedTestResources
)
2017-04-02 21:51:11 +02:00
lazy val testsJvm = tests.jvm
lazy val testsJs = tests.js
2015-12-30 01:34:41 +01:00
lazy val cache = project
.dependsOn(coreJvm)
.settings(
2017-04-02 21:51:11 +02:00
shared,
Mima.previousArtifacts,
coursierPrefix,
libs += Deps.scalazConcurrent,
Mima.cacheFilters
)
lazy val bootstrap = project
.settings(
2017-04-02 21:51:11 +02:00
pureJava,
dontPublish,
2017-05-05 18:04:20 +02:00
// seems not to be automatically found with sbt 0.13.16-M1 :-/
mainClass := Some("coursier.Bootstrap"),
2017-04-02 21:51:11 +02:00
renameMainJar("bootstrap.jar")
)
lazy val extra = project
.dependsOn(coreJvm)
.settings(
shared,
coursierPrefix
)
lazy val cli = project
.dependsOn(coreJvm, cache, extra)
.settings(
2017-04-02 21:51:11 +02:00
shared,
dontPublishIn("2.10", "2.12"),
generatePack,
proguard,
coursierPrefix,
libs ++= {
if (scalaBinaryVersion.value == "2.11")
2016-11-09 18:28:31 +01:00
Seq(
Deps.caseApp,
Deps.argonautShapeless
)
else
Seq()
},
2017-04-02 21:51:11 +02:00
addBootstrapJarAsResource,
proguardedCli
)
lazy val web = project
.enablePlugins(ScalaJSPlugin)
.dependsOn(coreJs, `fetch-js`)
.settings(
2017-04-02 21:51:11 +02:00
shared,
dontPublish,
libs ++= {
if (scalaBinaryVersion.value == "2.11")
2016-10-22 22:24:41 +02:00
Seq(
2017-04-02 21:51:11 +02:00
CrossDeps.scalaJsJquery.value,
CrossDeps.scalaJsReact.value
2016-10-22 22:24:41 +02:00
)
else
Seq()
},
sourceDirectory := {
val dir = sourceDirectory.value
if (scalaBinaryVersion.value == "2.11")
dir
else
dir / "target" / "dummy"
},
2017-04-02 21:51:11 +02:00
noTests,
webjarBintrayRepository,
jsDependencies ++= Seq(
2017-04-02 21:51:11 +02:00
WebDeps.bootstrap
.intransitive()
./("bootstrap.min.js")
.commonJSName("Bootstrap"),
WebDeps.react
.intransitive()
./("react-with-addons.js")
.commonJSName("React"),
WebDeps.bootstrapTreeView
.intransitive()
./("bootstrap-treeview.min.js")
.commonJSName("Treeview"),
WebDeps.raphael
.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(
2017-04-02 21:51:11 +02:00
shared,
dontPublish,
tutSettings,
2015-12-30 01:34:34 +01:00
tutSourceDirectory := baseDirectory.value,
2017-04-02 21:51:11 +02:00
tutTargetDirectory := baseDirectory.in(LocalRootProject).value
2015-12-30 01:34:34 +01:00
)
2015-12-30 01:34:34 +01:00
// Don't try to compile that if you're not in 2.10
2017-02-02 02:06:04 +01:00
lazy val `sbt-coursier` = project
.dependsOn(coreJvm, cache, extra)
2017-04-02 21:51:11 +02:00
.settings(plugin)
2017-01-30 22:57:24 +01:00
// Don't try to compile that if you're not in 2.10
lazy val `sbt-shading` = project
2017-04-02 21:51:11 +02:00
.enablePlugins(ShadingPlugin)
2017-02-02 02:06:04 +01:00
.dependsOn(`sbt-coursier`)
2016-04-01 00:39:30 +02:00
.settings(
2017-04-02 21:51:11 +02:00
plugin,
shading,
localM2Repository, // for a possibly locally published jarjar
libs += Deps.jarjar.value % "shaded",
// dependencies of jarjar-core - directly depending on these so that they don't get shaded
libs ++= Deps.jarjarTransitiveDeps
2015-12-30 01:34:34 +01:00
)
2017-02-21 15:57:41 +01:00
lazy val `sbt-launcher` = project
.dependsOn(cache)
.settings(
2017-04-02 21:51:11 +02:00
shared,
generatePack,
libs ++= Seq(
Deps.caseApp,
Deps.sbtLauncherInterface,
Deps.typesafeConfig
)
2017-02-21 15:57:41 +01:00
)
lazy val `http-server` = project
2016-04-05 16:24:39 +02:00
.settings(
2017-04-02 21:51:11 +02:00
shared,
generatePack,
name := "http-server",
libs ++= Seq(
Deps.http4sBlazeServer,
Deps.http4sDsl,
Deps.slf4jNop,
Deps.caseApp12
)
2016-04-05 16:24:39 +02:00
)
2016-08-22 00:40:01 +02:00
lazy val okhttp = project
.dependsOn(cache)
.settings(
2017-04-02 21:51:11 +02:00
shared,
coursierPrefix,
libs += Deps.okhttpUrlConnection
2016-08-22 00:40:01 +02:00
)
lazy val echo = project
2017-04-02 21:51:11 +02:00
.settings(shared)
2017-02-27 16:15:15 +01:00
lazy val jvm = project
.dummy
2017-02-27 16:15:15 +01:00
.aggregate(
coreJvm,
testsJvm,
cache,
bootstrap,
extra,
2017-02-27 16:15:15 +01:00
cli,
`sbt-coursier`,
`sbt-shading`,
`sbt-launcher`,
doc,
`http-server`,
okhttp,
echo
2017-02-27 16:15:15 +01:00
)
.settings(
2017-04-02 21:51:11 +02:00
shared,
dontPublish,
2017-02-27 16:15:15 +01:00
moduleName := "coursier-jvm"
)
lazy val js = project
.dummy
2017-02-27 16:15:15 +01:00
.aggregate(
coreJs,
`fetch-js`,
testsJs,
web
)
.settings(
2017-04-02 21:51:11 +02:00
shared,
dontPublish,
2017-02-27 16:15:15 +01:00
moduleName := "coursier-js"
)
2017-04-02 21:51:11 +02:00
lazy val coursier = project
.in(file("."))
2017-01-30 23:28:45 +01:00
.aggregate(
coreJvm,
coreJs,
`fetch-js`,
testsJvm,
testsJs,
cache,
bootstrap,
extra,
2017-01-30 23:28:45 +01:00
cli,
2017-02-02 02:06:04 +01:00
`sbt-coursier`,
2017-01-30 23:28:45 +01:00
`sbt-shading`,
2017-02-21 15:57:41 +01:00
`sbt-launcher`,
2017-01-30 23:28:45 +01:00
web,
doc,
2017-05-05 18:04:20 +02:00
echo,
2017-01-30 23:28:45 +01:00
`http-server`,
okhttp
)
.settings(
2017-04-02 21:51:11 +02:00
shared,
dontPublish,
moduleName := "coursier-root"
)
2017-01-30 23:28:45 +01:00
2017-04-02 21:51:11 +02:00
lazy val addBootstrapJarAsResource = {
resourceGenerators.in(Compile) += packageBin.in(bootstrap).in(Compile).map(Seq(_)).taskValue
}
2017-01-30 23:28:45 +01:00
2017-04-02 21:51:11 +02:00
lazy val addBootstrapInProguardedJar = {
ProguardKeys.proguard.in(Proguard) := {
val bootstrapJar = packageBin.in(bootstrap).in(Compile).value
val source = proguardedJar.value
2017-01-30 23:28:45 +01:00
2017-04-02 21:51:11 +02:00
val dest = source.getParentFile / (source.getName.stripSuffix(".jar") + "-with-bootstrap.jar")
2017-03-19 14:00:10 +01:00
2017-04-02 21:51:11 +02:00
ZipUtil.addToZip(source, dest, Seq("bootstrap.jar" -> bootstrapJar))
2017-01-30 23:28:45 +01:00
2017-04-02 21:51:11 +02:00
Seq(dest)
2017-01-30 23:28:45 +01:00
}
2017-04-02 21:51:11 +02:00
}
lazy val proguardedCli = Seq(
ProguardKeys.proguardVersion.in(Proguard) := "5.3",
ProguardKeys.options.in(Proguard) ++= Seq(
"-dontwarn",
"-keep class coursier.cli.Coursier {\n public static void main(java.lang.String[]);\n}",
"-keep class coursier.cli.IsolatedClassLoader {\n public java.lang.String[] getIsolationTargets();\n}",
"-adaptresourcefilenames **.properties"
),
javaOptions.in(Proguard, ProguardKeys.proguard) := Seq("-Xmx3172M"),
artifactPath.in(Proguard) := ProguardKeys.proguardDirectory.in(Proguard).value / "coursier-standalone.jar",
artifacts ++= {
if (scalaBinaryVersion.value == "2.11")
Seq(proguardedArtifact.value)
else
Nil
},
addBootstrapInProguardedJar,
packagedArtifacts ++= {
if (scalaBinaryVersion.value == "2.11")
Map(proguardedArtifact.value -> proguardedJar.value)
else
Map()
}
)
2017-04-02 21:51:11 +02:00
lazy val sharedTestResources = {
unmanagedResourceDirectories.in(Test) += baseDirectory.in(LocalRootProject).value / "tests" / "shared" / "src" / "test" / "resources"
}