aboutsummaryrefslogtreecommitdiff
path: root/coursier
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-02-06 13:03:36 -0500
committerChristopher Vogt <oss.nsp@cvogt.org>2016-03-04 15:06:30 -0500
commit974942db43ff2d1fa7ba71ad60f9bb9eae2d8631 (patch)
treed7235df9d4d6a67753dc2a20ab6bfcb7a24dc74c /coursier
downloadcbt-974942db43ff2d1fa7ba71ad60f9bb9eae2d8631.tar.gz
cbt-974942db43ff2d1fa7ba71ad60f9bb9eae2d8631.tar.bz2
cbt-974942db43ff2d1fa7ba71ad60f9bb9eae2d8631.zip
CBT Version 1.0-BETA
Diffstat (limited to 'coursier')
-rw-r--r--coursier/Coursier.scala47
1 files changed, 47 insertions, 0 deletions
diff --git a/coursier/Coursier.scala b/coursier/Coursier.scala
new file mode 100644
index 0000000..a2f5f39
--- /dev/null
+++ b/coursier/Coursier.scala
@@ -0,0 +1,47 @@
+/*
+package cbt
+object Coursier{
+ implicit class CoursierDependencyResolution(d: MavenDependency){
+ import d._
+ def resolveCoursier = {
+ import coursier._
+ val repositories = Seq(
+ Cache.ivy2Local,
+ MavenRepository("https://repo1.maven.org/maven2")
+ )
+
+ val start = Resolution(
+ Set(
+ MavenDependency(
+ Module(groupId, artifactId), version
+ )
+ )
+ )
+
+ val fetch = Fetch.from(repositories, Cache.fetch())
+
+
+ val resolution = start.process.run(fetch).run
+
+ val errors: Seq[(MavenDependency, Seq[String])] = resolution.errors
+
+ if(errors.nonEmpty) throw new Exception(errors.toString)
+
+ import java.io.File
+ import scalaz.\/
+ import scalaz.concurrent.Task
+
+ val localArtifacts: Seq[FileError \/ File] = Task.gatherUnordered(
+ resolution.artifacts.map(Cache.file(_).run)
+ ).run
+
+ val files = localArtifacts.map(_.toEither match {
+ case Left(error) => throw new Exception(error.toString)
+ case Right(file) => file
+ })
+
+ resolution.dependencies.map( d => cbt.MavenDependency(d.module.organization,d.module.name, d.version)).to[collection.immutable.Seq]
+ }
+ }
+}
+*/ \ No newline at end of file