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-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
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
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2015-11-29 20:20:31 +01:00
|
|
|
.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
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2015-11-29 20:20:31 +01:00
|
|
|
.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
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2017-05-31 18:49:48 +02:00
|
|
|
.dependsOn(testsJvm % "test->test")
|
|
|
|
|
.configs(Integration)
|
|
|
|
|
.settings(
|
|
|
|
|
shared,
|
|
|
|
|
dontPublish,
|
|
|
|
|
hasITs,
|
|
|
|
|
coursierPrefix,
|
|
|
|
|
libs += Deps.scalaAsync.value,
|
|
|
|
|
utest,
|
|
|
|
|
sharedTestResources
|
|
|
|
|
)
|
|
|
|
|
|
2017-06-09 18:13:13 +02:00
|
|
|
lazy val paths = project
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2017-06-09 18:13:13 +02:00
|
|
|
.settings(
|
|
|
|
|
pureJava,
|
2017-10-27 14:35:01 +02:00
|
|
|
dontPublish,
|
|
|
|
|
addDirectoriesSources
|
2017-06-09 18:13:13 +02:00
|
|
|
)
|
|
|
|
|
|
2015-12-30 01:34:41 +01:00
|
|
|
lazy val cache = project
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
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,
|
2017-06-09 18:13:13 +02:00
|
|
|
Mima.cacheFilters,
|
|
|
|
|
addPathsSources
|
2015-11-29 20:20:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val bootstrap = project
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2015-11-29 20:20:31 +01:00
|
|
|
.settings(
|
2017-04-02 21:51:11 +02:00
|
|
|
pureJava,
|
|
|
|
|
dontPublish,
|
2017-06-09 18:13:13 +02:00
|
|
|
addPathsSources,
|
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
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2017-07-08 14:18:03 +02:00
|
|
|
.enablePlugins(ShadingPlugin)
|
2017-05-11 23:54:52 +02:00
|
|
|
.dependsOn(coreJvm)
|
|
|
|
|
.settings(
|
|
|
|
|
shared,
|
2017-07-08 14:18:03 +02:00
|
|
|
coursierPrefix,
|
|
|
|
|
shading,
|
|
|
|
|
libs ++= {
|
|
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
|
|
|
|
Seq(
|
2017-07-11 19:40:50 +02:00
|
|
|
Deps.scalaNativeTools % "shaded",
|
|
|
|
|
// brought by only tools, so should be automaticaly shaded,
|
|
|
|
|
// but issues in ShadingPlugin (with things published locally?)
|
|
|
|
|
// seem to require explicit shading...
|
|
|
|
|
Deps.scalaNativeNir % "shaded",
|
|
|
|
|
Deps.scalaNativeUtil % "shaded",
|
2017-07-08 14:18:03 +02:00
|
|
|
Deps.fastParse % "shaded"
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
Nil
|
|
|
|
|
},
|
|
|
|
|
shadeNamespaces ++=
|
|
|
|
|
Set(
|
|
|
|
|
"fastparse",
|
|
|
|
|
"sourcecode"
|
|
|
|
|
) ++
|
|
|
|
|
// not blindly shading the whole scala.scalanative here, for some constant strings starting with
|
|
|
|
|
// "scala.scalanative.native." in scalanative not to get prefixed with "coursier.shaded."
|
|
|
|
|
Seq("codegen", "io", "linker", "nir", "optimizer", "tools", "util")
|
|
|
|
|
.map("scala.scalanative." + _)
|
2017-05-11 23:54:52 +02:00
|
|
|
)
|
|
|
|
|
|
2015-11-21 14:23:06 +01:00
|
|
|
lazy val cli = project
|
2017-05-11 23:54:52 +02:00
|
|
|
.dependsOn(coreJvm, cache, extra)
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2017-10-20 02:48:12 +02:00
|
|
|
.enablePlugins(PackPlugin, SbtProguard)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(
|
2017-04-02 21:51:11 +02:00
|
|
|
shared,
|
|
|
|
|
dontPublishIn("2.10", "2.12"),
|
|
|
|
|
coursierPrefix,
|
2018-02-01 16:18:47 +01:00
|
|
|
unmanagedResources.in(Test) += packageBin.in(bootstrap).in(Compile).value,
|
2017-04-02 21:51:11 +02:00
|
|
|
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,
|
Add json report to fetch and local exclusion option (#692)
This patch introduces changes for cli with json output #659. Format as follows:
```
{
"conflict_resolution": {
"org:name:version" (requested): "org:name:version" (reconciled)
},
"dependencies": [
{
"coord": "orgA:nameA:versionA",
"files": [
[
<classifier>,
<path>
]
],
"dependencies": [ // coodinates for its transitive dependencies
<orgX:nameX:versionX>,
<orgY:nameY:versionY>,
]
},
{
"coord": "orgB:nameB:versionB",
"files": [
[
<classifier>,
<path>
]
],
"dependencies": [ // coodinates for its transitive dependencies
<orgX:nameX:versionX>,
<orgZ:nameZ:versionZ>,
]
},
]
}
```
For example:
```
fetch -t org.apache.avro:trevni-avro:1.8.2 org.slf4j:slf4j-api:1.7.6 --json-output-file x.out
Result:
├─ org.apache.avro:trevni-avro:1.8.2
│ ├─ org.apache.avro:trevni-core:1.8.2
│ │ ├─ org.apache.commons:commons-compress:1.8.1
│ │ ├─ org.slf4j:slf4j-api:1.7.7
│ │ └─ org.xerial.snappy:snappy-java:1.1.1.3
│ └─ org.slf4j:slf4j-api:1.7.7
└─ org.slf4j:slf4j-api:1.7.6 -> 1.7.7
```
would produce the following json file:
```
$ jq < x.out
{
"conflict_resolution": {
"org.slf4j:slf4j-api:1.7.6": "org.slf4j:slf4j-api:1.7.7"
},
"dependencies": [
{
"coord": "org.apache.avro:trevni-core:1.8.2",
"files": [
[
"",
"/Users/yic/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/apache/avro/trevni-core/1.8.2/trevni-core-1.8.2.jar"
]
],
"dependencies": [
"org.slf4j:slf4j-api:1.7.7",
"org.xerial.snappy:snappy-java:1.1.1.3",
"org.apache.commons:commons-compress:1.8.1"
]
},
{
"coord": "org.apache.avro:trevni-avro:1.8.2",
"files": [
[
"",
"/Users/yic/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/apache/avro/trevni-avro/1.8.2/trevni-avro-1.8.2.jar"
]
],
"dependencies": [
"org.apache.avro:trevni-core:1.8.2",
"org.slf4j:slf4j-api:1.7.7",
"org.xerial.snappy:snappy-java:1.1.1.3",
"org.apache.commons:commons-compress:1.8.1"
]
},
{
"coord": "org.slf4j:slf4j-api:1.7.7",
"files": [
[
"",
"/Users/yic/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar"
]
],
"dependencies": []
},
{
"coord": "org.apache.commons:commons-compress:1.8.1",
"files": [
[
"",
"/Users/yic/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar"
]
],
"dependencies": []
},
{
"coord": "org.xerial.snappy:snappy-java:1.1.1.3",
"files": [
[
"",
"/Users/yic/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/xerial/snappy/snappy-java/1.1.1.3/snappy-java-1.1.1.3.jar"
]
],
"dependencies": []
}
]
}
```
2017-12-26 19:46:35 +01:00
|
|
|
Deps.argonautShapeless,
|
|
|
|
|
Deps.junit % "test", // to be able to run tests with pants
|
|
|
|
|
Deps.scalatest % "test"
|
2016-11-09 18:28:31 +01:00
|
|
|
)
|
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
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2015-11-21 14:23:06 +01:00
|
|
|
.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
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
2018-01-29 20:45:28 +01:00
|
|
|
lazy val readme = project
|
|
|
|
|
.in(file("doc/readme"))
|
2015-12-30 01:34:41 +01:00
|
|
|
.dependsOn(coreJvm, cache)
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
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
|
|
|
)
|
|
|
|
|
|
2017-12-11 01:25:50 +01:00
|
|
|
lazy val `sbt-shared` = project
|
|
|
|
|
.dependsOn(coreJvm, cache)
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2017-12-11 01:25:50 +01:00
|
|
|
.settings(
|
|
|
|
|
plugin,
|
2018-01-10 15:38:48 +01:00
|
|
|
utest,
|
2018-01-31 15:26:21 +01:00
|
|
|
// addSbtPlugin("com.dwijnand" % "sbt-compat" % "1.2.0+2-f30b82f4")
|
2018-01-10 15:38:48 +01:00
|
|
|
libs ++= {
|
2018-01-31 15:26:21 +01:00
|
|
|
val dependency = "com.dwijnand" % "sbt-compat" % "1.2.0+2-f30b82f4"
|
2018-01-10 15:38:48 +01:00
|
|
|
val sbtV = (sbtBinaryVersion in pluginCrossBuild).value
|
|
|
|
|
val scalaV = (scalaBinaryVersion in update).value
|
|
|
|
|
val m = Defaults.sbtPluginExtra(dependency, sbtV, scalaV)
|
|
|
|
|
CrossVersion.partialVersion(scalaVersion.value).collect {
|
|
|
|
|
case (2, 10) => m
|
|
|
|
|
case (2, 12) => m
|
|
|
|
|
}.toList
|
|
|
|
|
}
|
2017-12-11 01:25:50 +01:00
|
|
|
)
|
|
|
|
|
|
2017-02-02 02:06:04 +01:00
|
|
|
lazy val `sbt-coursier` = project
|
2017-12-11 01:25:50 +01:00
|
|
|
.dependsOn(coreJvm, cache, extra, `sbt-shared`)
|
2017-11-01 00:27:45 +01:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2017-08-30 01:26:46 +02:00
|
|
|
.settings(
|
|
|
|
|
plugin,
|
|
|
|
|
utest
|
|
|
|
|
)
|
2017-01-30 22:57:24 +01:00
|
|
|
|
2017-06-06 19:51:38 +02:00
|
|
|
lazy val `sbt-pgp-coursier` = project
|
|
|
|
|
.dependsOn(`sbt-coursier`)
|
2017-11-01 00:27:45 +01:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2017-06-06 19:51:38 +02:00
|
|
|
.settings(
|
|
|
|
|
plugin,
|
|
|
|
|
libs ++= {
|
|
|
|
|
scalaBinaryVersion.value match {
|
|
|
|
|
case "2.10" | "2.12" =>
|
|
|
|
|
Seq(Deps.sbtPgp.value)
|
|
|
|
|
case _ => Nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2017-01-30 22:57:24 +01:00
|
|
|
lazy val `sbt-shading` = project
|
2017-11-01 00:27:45 +01:00
|
|
|
.enablePlugins(ShadingPlugin)
|
|
|
|
|
.disablePlugins(ScriptedPlugin)
|
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
|
2017-07-11 19:04:00 +02:00
|
|
|
libs += Deps.jarjar % "shaded",
|
2017-04-02 21:51:11 +02:00
|
|
|
// 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
|
|
|
)
|
|
|
|
|
|
2016-08-22 00:40:01 +02:00
|
|
|
lazy val okhttp = project
|
|
|
|
|
.dependsOn(cache)
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2016-08-22 00:40:01 +02:00
|
|
|
.settings(
|
2017-04-02 21:51:11 +02:00
|
|
|
shared,
|
|
|
|
|
coursierPrefix,
|
|
|
|
|
libs += Deps.okhttpUrlConnection
|
2016-08-22 00:40:01 +02:00
|
|
|
)
|
|
|
|
|
|
2017-02-27 16:15:15 +01:00
|
|
|
lazy val jvm = project
|
2017-05-15 15:32:48 +02:00
|
|
|
.dummy
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2017-02-27 16:15:15 +01:00
|
|
|
.aggregate(
|
|
|
|
|
coreJvm,
|
|
|
|
|
testsJvm,
|
2017-05-31 18:49:48 +02:00
|
|
|
`proxy-tests`,
|
2017-06-09 18:13:13 +02:00
|
|
|
paths,
|
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,
|
2017-12-11 01:25:50 +01:00
|
|
|
`sbt-shared`,
|
2017-02-27 16:15:15 +01:00
|
|
|
`sbt-coursier`,
|
2017-06-06 19:51:38 +02:00
|
|
|
`sbt-pgp-coursier`,
|
2017-02-27 16:15:15 +01:00
|
|
|
`sbt-shading`,
|
2018-01-29 20:45:28 +01:00
|
|
|
readme,
|
2017-12-26 23:56:02 +01:00
|
|
|
okhttp
|
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-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
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
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
2017-05-31 15:24:53 +02:00
|
|
|
.aggregate(
|
|
|
|
|
coreJvm,
|
|
|
|
|
cache,
|
|
|
|
|
extra,
|
2017-12-11 01:25:50 +01:00
|
|
|
`sbt-shared`,
|
2017-05-31 15:24:53 +02:00
|
|
|
`sbt-coursier`,
|
2017-06-06 19:51:38 +02:00
|
|
|
`sbt-pgp-coursier`,
|
2017-05-31 15:24:53 +02:00
|
|
|
`sbt-shading`
|
|
|
|
|
)
|
|
|
|
|
.settings(
|
|
|
|
|
shared,
|
2018-01-10 17:24:16 +01:00
|
|
|
pluginOverrideCrossScalaVersion,
|
2017-05-31 15:24:53 +02:00
|
|
|
dontPublish
|
|
|
|
|
)
|
|
|
|
|
|
2017-04-02 21:51:11 +02:00
|
|
|
lazy val coursier = project
|
2017-05-15 15:32:48 +02:00
|
|
|
.in(root)
|
2017-10-26 14:53:18 +02:00
|
|
|
.disablePlugins(ScriptedPlugin)
|
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-06-09 18:13:13 +02:00
|
|
|
paths,
|
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-12-11 01:25:50 +01:00
|
|
|
`sbt-shared`,
|
2017-02-02 02:06:04 +01:00
|
|
|
`sbt-coursier`,
|
2017-06-06 19:51:38 +02:00
|
|
|
`sbt-pgp-coursier`,
|
2017-01-30 23:28:45 +01:00
|
|
|
`sbt-shading`,
|
|
|
|
|
web,
|
2018-01-29 20:45:28 +01:00
|
|
|
readme,
|
2017-01-30 23:28:45 +01:00
|
|
|
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 = {
|
2017-06-12 01:54:24 +02:00
|
|
|
|
|
|
|
|
import java.nio.file.Files
|
|
|
|
|
|
|
|
|
|
packageBin.in(Compile) := {
|
|
|
|
|
val bootstrapJar = packageBin.in(bootstrap).in(Compile).value
|
|
|
|
|
val source = packageBin.in(Compile).value
|
|
|
|
|
|
|
|
|
|
val dest = source.getParentFile / (source.getName.stripSuffix(".jar") + "-with-bootstrap.jar")
|
|
|
|
|
|
|
|
|
|
ZipUtil.addToZip(source, dest, Seq(
|
|
|
|
|
"bootstrap.jar" -> Files.readAllBytes(bootstrapJar.toPath)
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
dest
|
|
|
|
|
}
|
2017-04-02 21:51:11 +02:00
|
|
|
}
|
2017-01-30 23:28:45 +01:00
|
|
|
|
2017-04-02 21:51:11 +02:00
|
|
|
lazy val addBootstrapInProguardedJar = {
|
2017-06-01 13:04:49 +02:00
|
|
|
|
|
|
|
|
import java.nio.charset.StandardCharsets
|
|
|
|
|
import java.nio.file.Files
|
|
|
|
|
|
2017-10-20 02:48:12 +02:00
|
|
|
proguard.in(Proguard) := {
|
2017-04-02 21:51:11 +02:00
|
|
|
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-06-01 13:04:49 +02:00
|
|
|
val dest0 = source.getParentFile / (source.getName.stripSuffix(".jar") + "-with-bootstrap-and-prelude.jar")
|
|
|
|
|
|
|
|
|
|
// TODO Get from cli original JAR
|
|
|
|
|
val manifest =
|
|
|
|
|
s"""Manifest-Version: 1.0
|
|
|
|
|
|Implementation-Title: ${name.value}
|
|
|
|
|
|Implementation-Version: ${version.value}
|
|
|
|
|
|Specification-Vendor: ${organization.value}
|
|
|
|
|
|Specification-Title: ${name.value}
|
|
|
|
|
|Implementation-Vendor-Id: ${organization.value}
|
|
|
|
|
|Specification-Version: ${version.value}
|
|
|
|
|
|Implementation-URL: ${homepage.value.getOrElse("")}
|
|
|
|
|
|Implementation-Vendor: ${organization.value}
|
|
|
|
|
|Main-Class: ${mainClass.in(Compile).value.getOrElse(sys.error("Main class not found"))}
|
|
|
|
|
|""".stripMargin
|
|
|
|
|
|
|
|
|
|
ZipUtil.addToZip(source, dest, Seq(
|
|
|
|
|
"bootstrap.jar" -> Files.readAllBytes(bootstrapJar.toPath),
|
|
|
|
|
"META-INF/MANIFEST.MF" -> manifest.getBytes(StandardCharsets.UTF_8)
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
ZipUtil.addPrelude(dest, dest0)
|
|
|
|
|
|
|
|
|
|
Seq(dest0)
|
2017-01-30 23:28:45 +01:00
|
|
|
}
|
2017-04-02 21:51:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lazy val proguardedCli = Seq(
|
2017-10-20 02:48:12 +02:00
|
|
|
proguardVersion.in(Proguard) := SharedVersions.proguard,
|
|
|
|
|
proguardOptions.in(Proguard) ++= Seq(
|
2017-04-02 21:51:11 +02:00
|
|
|
"-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"
|
|
|
|
|
),
|
2017-10-20 02:48:12 +02:00
|
|
|
javaOptions.in(Proguard, proguard) := Seq("-Xmx3172M"),
|
|
|
|
|
artifactPath.in(Proguard) := proguardDirectory.in(Proguard).value / "coursier-standalone.jar",
|
2017-04-02 21:51:11 +02:00
|
|
|
artifacts ++= {
|
|
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
|
|
|
|
Seq(proguardedArtifact.value)
|
|
|
|
|
else
|
|
|
|
|
Nil
|
|
|
|
|
},
|
|
|
|
|
addBootstrapInProguardedJar,
|
2017-10-24 17:47:29 +02:00
|
|
|
addProguardedJar
|
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"
|
|
|
|
|
}
|
2017-06-09 18:13:13 +02:00
|
|
|
|
2017-10-27 14:35:01 +02:00
|
|
|
// Using directly the sources of directories, rather than depending on it.
|
|
|
|
|
// This is required to use it from the bootstrap module, whose jar is launched as is (so shouldn't require dependencies).
|
|
|
|
|
// This is done for the other use of it too, from the cache module, not to have to manage two ways of depending on it.
|
|
|
|
|
lazy val addDirectoriesSources = {
|
|
|
|
|
unmanagedSourceDirectories.in(Compile) += baseDirectory.in(LocalRootProject).value / "directories" / "src" / "main" / "java"
|
2017-06-09 18:13:13 +02:00
|
|
|
}
|
2017-10-27 14:35:01 +02:00
|
|
|
|
|
|
|
|
lazy val addPathsSources = Seq(
|
|
|
|
|
addDirectoriesSources,
|
|
|
|
|
unmanagedSourceDirectories.in(Compile) ++= unmanagedSourceDirectories.in(Compile).in(paths).value
|
|
|
|
|
)
|