2015-11-21 14:23:06 +01:00
|
|
|
|
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._
|
2016-02-16 01:03:00 +01:00
|
|
|
|
2017-04-02 21:51:11 +02:00
|
|
|
parallelExecution.in(Global) := false
|
2016-08-31 21:23:11 +02:00
|
|
|
|
2015-11-21 14:23:06 +01: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
|
|
|
)
|
2015-11-21 14:23:06 +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
|
2015-11-29 20:20:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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
|
2015-11-29 20:20:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val tests = crossProject
|
|
|
|
|
.dependsOn(core)
|
2017-04-02 21:51:11 +02:00
|
|
|
.jvmConfigure(_.dependsOn(cache % "test"))
|
|
|
|
|
.jsConfigure(_.dependsOn(`fetch-js` % "test"))
|
2015-11-29 20:20:31 +01:00
|
|
|
.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
|
2015-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
|
2017-04-02 21:51:11 +02:00
|
|
|
lazy val testsJvm = tests.jvm
|
|
|
|
|
lazy val testsJs = tests.js
|
2015-11-21 14:23:06 +01:00
|
|
|
|
2017-05-31 18:49:48 +02:00
|
|
|
lazy val `proxy-tests` = project
|
|
|
|
|
.dependsOn(testsJvm % "test->test")
|
|
|
|
|
.configs(Integration)
|
|
|
|
|
.settings(
|
|
|
|
|
shared,
|
|
|
|
|
dontPublish,
|
|
|
|
|
hasITs,
|
|
|
|
|
coursierPrefix,
|
|
|
|
|
libs += Deps.scalaAsync.value,
|
|
|
|
|
utest,
|
|
|
|
|
sharedTestResources
|
|
|
|
|
)
|
|
|
|
|
|
2015-12-30 01:34:41 +01:00
|
|
|
lazy val cache = project
|
2015-11-21 14:23:06 +01:00
|
|
|
.dependsOn(coreJvm)
|
|
|
|
|
.settings(
|
2017-04-02 21:51:11 +02:00
|
|
|
shared,
|
|
|
|
|
Mima.previousArtifacts,
|
|
|
|
|
coursierPrefix,
|
|
|
|
|
libs += Deps.scalazConcurrent,
|
|
|
|
|
Mima.cacheFilters
|
2015-11-29 20:20:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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")
|
2015-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
|
2017-05-11 23:54:52 +02:00
|
|
|
lazy val extra = project
|
|
|
|
|
.dependsOn(coreJvm)
|
|
|
|
|
.settings(
|
|
|
|
|
shared,
|
|
|
|
|
coursierPrefix
|
|
|
|
|
)
|
|
|
|
|
|
2015-11-21 14:23:06 +01:00
|
|
|
lazy val cli = project
|
2017-05-11 23:54:52 +02:00
|
|
|
.dependsOn(coreJvm, cache, extra)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(
|
2017-04-02 21:51:11 +02:00
|
|
|
shared,
|
|
|
|
|
dontPublishIn("2.10", "2.12"),
|
|
|
|
|
generatePack,
|
|
|
|
|
proguard,
|
|
|
|
|
coursierPrefix,
|
|
|
|
|
libs ++= {
|
2016-10-22 01:35:57 +02:00
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
2016-11-09 18:28:31 +01:00
|
|
|
Seq(
|
|
|
|
|
Deps.caseApp,
|
|
|
|
|
Deps.argonautShapeless
|
|
|
|
|
)
|
2016-10-22 01:35:57 +02:00
|
|
|
else
|
|
|
|
|
Seq()
|
2015-12-30 23:55:17 +01:00
|
|
|
},
|
2017-04-02 21:51:11 +02:00
|
|
|
addBootstrapJarAsResource,
|
|
|
|
|
proguardedCli
|
2015-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val web = project
|
|
|
|
|
.enablePlugins(ScalaJSPlugin)
|
2015-11-29 20:20:31 +01:00
|
|
|
.dependsOn(coreJs, `fetch-js`)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(
|
2017-04-02 21:51:11 +02:00
|
|
|
shared,
|
|
|
|
|
dontPublish,
|
|
|
|
|
libs ++= {
|
2016-10-22 01:35:57 +02:00
|
|
|
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
|
|
|
)
|
2016-10-22 01:35:57 +02:00
|
|
|
else
|
|
|
|
|
Seq()
|
2015-11-21 14:23:06 +01:00
|
|
|
},
|
|
|
|
|
sourceDirectory := {
|
|
|
|
|
val dir = sourceDirectory.value
|
|
|
|
|
|
2016-10-22 01:35:57 +02:00
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
2015-11-21 14:23:06 +01:00
|
|
|
dir
|
2016-10-22 01:35:57 +02:00
|
|
|
else
|
2017-05-15 15:32:48 +02:00
|
|
|
dir / "target" / "dummy"
|
2015-11-21 14:23:06 +01:00
|
|
|
},
|
2017-04-02 21:51:11 +02:00
|
|
|
noTests,
|
|
|
|
|
webjarBintrayRepository,
|
2015-11-21 14:23:06 +01:00
|
|
|
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-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
2015-12-30 01:34:34 +01:00
|
|
|
lazy val doc = project
|
2015-12-30 01:34:41 +01:00
|
|
|
.dependsOn(coreJvm, cache)
|
2017-05-15 15:32:49 +02:00
|
|
|
.enablePlugins(TutPlugin)
|
2015-12-30 01:34:34 +01:00
|
|
|
.settings(
|
2017-04-02 21:51:11 +02:00
|
|
|
shared,
|
|
|
|
|
dontPublish,
|
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
|
2017-05-11 23:54:52 +02:00
|
|
|
.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,
|
2017-05-15 15:32:51 +02:00
|
|
|
dontPublishIn("2.10", "2.12"),
|
|
|
|
|
libs ++= {
|
|
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
|
|
|
|
Seq(
|
|
|
|
|
Deps.caseApp,
|
|
|
|
|
Deps.sbtLauncherInterface,
|
|
|
|
|
Deps.typesafeConfig
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
Nil
|
|
|
|
|
}
|
2017-02-21 15:57:41 +01:00
|
|
|
)
|
|
|
|
|
|
2016-08-05 17:37:23 +02: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,
|
2017-04-29 17:33:26 +02:00
|
|
|
name := "http-server",
|
2017-05-15 15:32:51 +02:00
|
|
|
dontPublishIn("2.10", "2.11"),
|
|
|
|
|
libs ++= {
|
|
|
|
|
if (scalaBinaryVersion.value == "2.12")
|
|
|
|
|
Seq(
|
|
|
|
|
Deps.http4sBlazeServer,
|
|
|
|
|
Deps.http4sDsl,
|
|
|
|
|
Deps.slf4jNop,
|
|
|
|
|
Deps.caseApp12
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
Nil
|
|
|
|
|
}
|
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
|
|
|
)
|
|
|
|
|
|
2017-03-14 15:39:00 +01:00
|
|
|
lazy val echo = project
|
2017-05-15 15:32:52 +02:00
|
|
|
.settings(pureJava)
|
2017-03-14 15:39:00 +01:00
|
|
|
|
2017-02-27 16:15:15 +01:00
|
|
|
lazy val jvm = project
|
2017-05-15 15:32:48 +02:00
|
|
|
.dummy
|
2017-02-27 16:15:15 +01:00
|
|
|
.aggregate(
|
|
|
|
|
coreJvm,
|
|
|
|
|
testsJvm,
|
2017-05-31 18:49:48 +02:00
|
|
|
`proxy-tests`,
|
2017-02-27 16:15:15 +01:00
|
|
|
cache,
|
|
|
|
|
bootstrap,
|
2017-05-11 23:54:52 +02:00
|
|
|
extra,
|
2017-02-27 16:15:15 +01:00
|
|
|
cli,
|
|
|
|
|
`sbt-coursier`,
|
|
|
|
|
`sbt-shading`,
|
|
|
|
|
`sbt-launcher`,
|
|
|
|
|
doc,
|
|
|
|
|
`http-server`,
|
2017-03-14 15:39:00 +01:00
|
|
|
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
|
2017-05-15 15:32:48 +02:00
|
|
|
.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-05-31 15:24:53 +02:00
|
|
|
// run sbt-plugins/publishLocal to publish all that necessary for plugins
|
|
|
|
|
lazy val `sbt-plugins` = project
|
|
|
|
|
.dummy
|
|
|
|
|
.aggregate(
|
|
|
|
|
coreJvm,
|
|
|
|
|
cache,
|
|
|
|
|
extra,
|
|
|
|
|
`sbt-coursier`,
|
|
|
|
|
`sbt-shading`
|
|
|
|
|
)
|
|
|
|
|
.settings(
|
|
|
|
|
shared,
|
|
|
|
|
dontPublish
|
|
|
|
|
)
|
|
|
|
|
|
2017-04-02 21:51:11 +02:00
|
|
|
lazy val coursier = project
|
2017-05-15 15:32:48 +02:00
|
|
|
.in(root)
|
2017-01-30 23:28:45 +01:00
|
|
|
.aggregate(
|
|
|
|
|
coreJvm,
|
|
|
|
|
coreJs,
|
|
|
|
|
`fetch-js`,
|
|
|
|
|
testsJvm,
|
|
|
|
|
testsJs,
|
2017-05-31 18:49:48 +02:00
|
|
|
`proxy-tests`,
|
2017-01-30 23:28:45 +01:00
|
|
|
cache,
|
|
|
|
|
bootstrap,
|
2017-05-11 23:54:52 +02:00
|
|
|
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
|
|
|
|
|
)
|
2016-05-29 23:45:55 +02:00
|
|
|
.settings(
|
2017-04-02 21:51:11 +02:00
|
|
|
shared,
|
|
|
|
|
dontPublish,
|
2016-05-29 23:45:55 +02:00
|
|
|
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(
|
2017-05-15 15:32:49 +02:00
|
|
|
ProguardKeys.proguardVersion.in(Proguard) := SharedVersions.proguard,
|
2017-04-02 21:51:11 +02:00
|
|
|
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-01-31 16:19:31 +01:00
|
|
|
}
|
|
|
|
|
)
|
2017-03-05 15:47:41 +01:00
|
|
|
|
2017-04-02 21:51:11 +02:00
|
|
|
lazy val sharedTestResources = {
|
|
|
|
|
unmanagedResourceDirectories.in(Test) += baseDirectory.in(LocalRootProject).value / "tests" / "shared" / "src" / "test" / "resources"
|
|
|
|
|
}
|