Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #173; use default(compile) configuration for deps as default #270

Merged
merged 1 commit into from
Apr 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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