diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-02-06 13:03:36 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-04 15:06:30 -0500 |
commit | 974942db43ff2d1fa7ba71ad60f9bb9eae2d8631 (patch) | |
tree | d7235df9d4d6a67753dc2a20ab6bfcb7a24dc74c /coursier/Coursier.scala | |
download | cbt-974942db43ff2d1fa7ba71ad60f9bb9eae2d8631.tar.gz cbt-974942db43ff2d1fa7ba71ad60f9bb9eae2d8631.tar.bz2 cbt-974942db43ff2d1fa7ba71ad60f9bb9eae2d8631.zip |
CBT Version 1.0-BETA
Diffstat (limited to 'coursier/Coursier.scala')
-rw-r--r-- | coursier/Coursier.scala | 47 |
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 |