Skip to content

Instantly share code, notes, and snippets.

@alexarchambault
Last active August 17, 2016 20:48
Show Gist options
  • Select an option

  • Save alexarchambault/fb6c08405e98836286ecae4de1a296a8 to your computer and use it in GitHub Desktop.

Select an option

Save alexarchambault/fb6c08405e98836286ecae4de1a296a8 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"8 new artifact(s)"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"9 new artifacts in macro\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"9 new artifacts in runtime\n",
"9 new artifacts in compile\n"
]
},
{
"data": {
"text/plain": []
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"classpath.add(\n",
" \"io.get-coursier\" %% \"coursier\" % \"1.0.0-M13\",\n",
" \"io.get-coursier\" %% \"coursier-cache\" % \"1.0.0-M13\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[32mimport \u001b[36mcoursier._\u001b[0m"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import coursier._"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[36mstart\u001b[0m: \u001b[32mResolution\u001b[0m = \u001b[33mResolution\u001b[0m(\n",
" \u001b[33mSet\u001b[0m(\n",
" \u001b[33mDependency\u001b[0m(\n",
" org.typelevel:cats-core_2.11,\n",
" \u001b[32m\"0.6.1\"\u001b[0m,\n",
" \u001b[32m\"\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" )\n",
" ),\n",
" \u001b[33mSet\u001b[0m(),\n",
" \u001b[33mMap\u001b[0m(),\n",
" \u001b[33mSet\u001b[0m(),\n",
" \u001b[33mMap\u001b[0m(),\n",
" \u001b[33mMap\u001b[0m(),\n",
" \u001b[33mMap\u001b[0m(),\n",
" None,\n",
" None\n",
"\u001b[33m...\u001b[0m"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"val start = Resolution(\n",
" Set(\n",
" Dependency(\n",
" Module(\"org.typelevel\", \"cats-core_2.11\"), \"0.6.1\"\n",
" )\n",
" )\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[36mrepositories\u001b[0m: \u001b[32mSeq\u001b[0m[\u001b[32mRepository\u001b[0m] = \u001b[33mList\u001b[0m(\n",
" IvyRepository(Pattern(List(Const(file:/Users/alexandre/.ivy2/local/), Var(organisation), Const(/), Var(module), Const(/), Opt(WrappedArray(Const(scala_), Var(scalaVersion), Const(/))), Opt(WrappedArray(Const(sbt_), Var(sbtVersion), Const(/))), Var(revision), Const(/), Var(type), Const(s/), Var(artifact), Opt(WrappedArray(Const(-), Var(classifier))), Const(.), Var(ext))),None,None,true,true,true,true,None),\n",
" MavenRepository(https://repo1.maven.org/maven2,None,false,None)\n",
")"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"val repositories = Seq(\n",
" Cache.ivy2Local,\n",
" MavenRepository(\"https://repo1.maven.org/maven2\")\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[36mfetch\u001b[0m: \u001b[32mSeq\u001b[0m[(\u001b[32mModule\u001b[0m, \u001b[32mString\u001b[0m)] => \u001b[32mscalaz\u001b[0m.\u001b[32mconcurrent\u001b[0m.\u001b[32mTask\u001b[0m[\u001b[32mFetch\u001b[0m.\u001b[32mMD\u001b[0m] = <function1>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"val fetch = Fetch.from(repositories, Cache.fetch())"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[36mresolution\u001b[0m: \u001b[32mResolution\u001b[0m = \u001b[33mResolution\u001b[0m(\n",
" \u001b[33mSet\u001b[0m(\n",
" \u001b[33mDependency\u001b[0m(\n",
" org.typelevel:cats-core_2.11,\n",
" \u001b[32m\"0.6.1\"\u001b[0m,\n",
" \u001b[32m\"\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" )\n",
" ),\n",
" \u001b[33mSet\u001b[0m(\n",
" \u001b[33mDependency\u001b[0m(\n",
" com.github.mpilquist:simulacrum_2.11,\n",
" \u001b[32m\"0.7.0\"\u001b[0m,\n",
" \u001b[32m\"compile\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
"\u001b[33m...\u001b[0m"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"val resolution = start.process.run(fetch).run"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mSet\u001b[0m(\n",
" \u001b[33mDependency\u001b[0m(\n",
" com.github.mpilquist:simulacrum_2.11,\n",
" \u001b[32m\"0.7.0\"\u001b[0m,\n",
" \u001b[32m\"compile\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" ),\n",
" \u001b[33mDependency\u001b[0m(\n",
" org.scala-lang:scala-reflect,\n",
" \u001b[32m\"2.11.7\"\u001b[0m,\n",
" \u001b[32m\"compile\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" ),\n",
" \u001b[33mDependency\u001b[0m(\n",
" org.typelevel:cats-core_2.11,\n",
" \u001b[32m\"0.6.1\"\u001b[0m,\n",
" \u001b[32m\"compile\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" ),\n",
" \u001b[33mDependency\u001b[0m(\n",
" org.typelevel:cats-kernel_2.11,\n",
" \u001b[32m\"0.6.1\"\u001b[0m,\n",
" \u001b[32m\"compile\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" ),\n",
" \u001b[33mDependency\u001b[0m(\n",
" org.scala-lang:scala-library,\n",
" \u001b[32m\"2.11.8\"\u001b[0m,\n",
" \u001b[32m\"compile\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\""
]
},
{
"data": {
"text/plain": []
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" ),\n",
" \u001b[33mDependency\u001b[0m(\n",
" org.typelevel:cats-macros_2.11,\n",
" \u001b[32m\"0.6.1\"\u001b[0m,\n",
" \u001b[32m\"compile\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" ),\n",
" \u001b[33mDependency\u001b[0m(\n",
" org.typelevel:machinist_2.11,\n",
" \u001b[32m\"0.4.1\"\u001b[0m,\n",
" \u001b[32m\"compile\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" ),\n",
" \u001b[33mDependency\u001b[0m(\n",
" org.typelevel:macro-compat_2.11,\n",
" \u001b[32m\"1.1.0\"\u001b[0m,\n",
" \u001b[32m\"compile\"\u001b[0m,\n",
" Set(),\n",
" \u001b[33mAttributes\u001b[0m(\u001b[32m\"jar\"\u001b[0m, \u001b[32m\"\"\u001b[0m),\n",
" \u001b[32mfalse\u001b[0m,\n",
" \u001b[32mtrue\u001b[0m\n",
" )\n",
")"
]
}
],
"source": [
"show(resolution.minDependencies)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[36mres7_0\u001b[0m: \u001b[32mSeq\u001b[0m[(\u001b[32mDependency\u001b[0m, \u001b[32mSeq\u001b[0m[\u001b[32mString\u001b[0m])] = \u001b[33mArrayBuffer\u001b[0m()\n",
"\u001b[36mres7_1\u001b[0m: \u001b[32mSet\u001b[0m[\u001b[32mDependency\u001b[0m] = \u001b[33mSet\u001b[0m()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"resolution.errors\n",
"resolution.conflicts"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[32mimport \u001b[36mscalaz.concurrent.Task\u001b[0m\n",
"\u001b[36mlocalArtifacts\u001b[0m: \u001b[32mList\u001b[0m[\u001b[32mscalaz\u001b[0m.\u001b[32m\\/\u001b[0m[\u001b[32mFileError\u001b[0m, \u001b[32mjava\u001b[0m.\u001b[32mio\u001b[0m.\u001b[32mFile\u001b[0m]] = \u001b[33mList\u001b[0m(\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/com/github/mpilquist/simulacrum_2.11/0.7.0/simulacrum_2.11-0.7.0.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.8/scala-library-2.11.8.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.11.7/scala-reflect-2.11.7.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/typelevel/macro-compat_2.11/1.1.0/macro-compat_2.11-1.1.0.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/typelevel/machinist_2.11/0.4.1/machinist_2.11-0.4.1.jar\n",
"\u001b[33m...\u001b[0m"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import scalaz.concurrent.Task\n",
"\n",
"val localArtifacts = Task.gatherUnordered(\n",
" resolution.artifacts.map(Cache.file(_).run)\n",
").run"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mList\u001b[0m(\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/com/github/mpilquist/simulacrum_2.11/0.7.0/simulacrum_2.11-0.7.0.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.8/scala-library-2.11.8.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.11.7/scala-reflect-2.11.7.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/typelevel/macro-compat_2.11/1.1.0/macro-compat_2.11-1.1.0.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/typelevel/machinist_2.11/0.4.1/machinist_2.11-0.4.1.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/typelevel/cats-macros_2.11/0.6.1/cats-macros_2.11-0.6.1.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/typelevel/cats-core_2.11/0.6.1/cats-core_2.11-0.6.1.jar\n",
" ),\n",
" \u001b[33m\\/-\u001b[0m(\n",
" /Users/alexandre/.coursier/cache/v1/https/repo1.maven.org/maven2/org/typelevel/cats-kernel_2.11/0.6.1/cats-kernel_2.11-0.6.1.jar\n",
" )\n",
")"
]
},
{
"data": {
"text/plain": []
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show(localArtifacts)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Scala 2.11",
"language": "scala211",
"name": "scala211"
},
"language_info": {
"codemirror_mode": "text/x-scala",
"file_extension": ".scala",
"mimetype": "text/x-scala",
"name": "scala211",
"pygments_lexer": "scala",
"version": "2.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment