Skip to content

Commit

Permalink
fixes #173; use default(compile) configuration for deps as default (#270
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rockjam authored Apr 1, 2018
1 parent 9a7ce4a commit bbd162d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scalalib/src/mill/scalalib/Dep.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ sealed trait Dep {
}
object Dep{

val DefaultConfiguration = "default(compile)"

implicit def parse(signature: String) = {
val parts = signature.split(';')
val module = parts.head
Expand All @@ -41,15 +43,15 @@ object Dep{
}).configure(attributes = attributes)
}
def apply(org: String, name: String, version: String, cross: Boolean): Dep = {
this(coursier.Dependency(coursier.Module(org, name), version), cross)
this(coursier.Dependency(coursier.Module(org, name), version, DefaultConfiguration), cross)
}
case class Java(dep: coursier.Dependency, cross: Boolean) extends Dep {
def configure(attributes: coursier.Attributes): Dep = copy(dep = dep.copy(attributes = attributes))
}
object Java{
implicit def rw: RW[Java] = macroRW
def apply(org: String, name: String, version: String, cross: Boolean): Dep = {
Java(coursier.Dependency(coursier.Module(org, name), version), cross)
Java(coursier.Dependency(coursier.Module(org, name), version, DefaultConfiguration), cross)
}
}
implicit def default(dep: coursier.Dependency): Dep = new Java(dep, false)
Expand All @@ -60,7 +62,7 @@ object Dep{
object Scala{
implicit def rw: RW[Scala] = macroRW
def apply(org: String, name: String, version: String, cross: Boolean): Dep = {
Scala(coursier.Dependency(coursier.Module(org, name), version), cross)
Scala(coursier.Dependency(coursier.Module(org, name), version, DefaultConfiguration), cross)
}
}
case class Point(dep: coursier.Dependency, cross: Boolean) extends Dep {
Expand All @@ -69,7 +71,7 @@ object Dep{
object Point{
implicit def rw: RW[Point] = macroRW
def apply(org: String, name: String, version: String, cross: Boolean): Dep = {
Point(coursier.Dependency(coursier.Module(org, name), version), cross)
Point(coursier.Dependency(coursier.Module(org, name), version, DefaultConfiguration), cross)
}
}
implicit def rw = RW.merge[Dep](
Expand Down
8 changes: 8 additions & 0 deletions scalalib/test/src/mill/scalalib/ResolveDepsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ object ResolveDepsTests extends TestSuite {
assert(paths.items.next.path.toString.contains("natives-macos"))
}

'resolveTransitiveRuntimeDeps - {
val deps = Agg(ivy"org.mockito:mockito-core:2.7.22")
val Success(paths) = evalDeps(deps)
assert(paths.nonEmpty)
assert(paths.exists(_.path.toString.contains("objenesis")))
assert(paths.exists(_.path.toString.contains("byte-buddy")))
}

'excludeTransitiveDeps - {
val deps = Agg(ivy"com.lihaoyi::pprint:0.5.3".exclude("com.lihaoyi" -> "fansi_2.12"))
val Success(paths) = evalDeps(deps)
Expand Down

0 comments on commit bbd162d

Please sign in to comment.