Skip to content

Commit

Permalink
Merge pull request #91 from Duhemm/different-targets-same-deps
Browse files Browse the repository at this point in the history
Fix missing targets when deps are duplicated
  • Loading branch information
eed3si9n authored Jun 3, 2021
2 parents 7b45d77 + 6713733 commit d9f52fa
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ final case class ThirdpartyConfig(
def coursierDeps: List[(DependencyConfig, Dependency)] =
dependencies2
.flatMap(d => d.coursierDependencies(scala).map(cd => d -> cd))
.distinctBy(_._2)
.distinctBy { case (d, cd) => (d.targets.sorted, cd) }
def relaxedForAllModules: Seq[(ModuleMatchers, Reconciliation)] =
Vector((ModuleMatchers.all, Reconciliation.Relaxed))

Expand Down
34 changes: 34 additions & 0 deletions tests/src/test/scala/tests/commands/ExportCommandSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -766,4 +766,38 @@ class ExportCommandSuite extends tests.BaseSuite with tests.ConfigSyntax {
|""".stripMargin,
expectedExit = 1
)

checkMultipleDeps(
"different targets with the same dependencies",
deps(
dep("org.apiguardian:apiguardian-api:1.1.1")
.target("apiguardian"),
dep("org.apiguardian:apiguardian-api:1.1.1")
.target("apiguardian-2"),
dep("io.netty:netty:3.10.1.Final")
.target("netty"),
dep("commons-codec:commons-codec:1.9")
.target("target-0")
.transitive(false)
.dependency("netty")
.dependency("apiguardian-2")
.force(false),
dep("commons-codec:commons-codec:1.8")
.target("target-1")
.transitive(false)
.dependency("apiguardian")
.dependency("netty")
.force(true)
),
queries = List(
allJars("@maven//:target-0") ->
"""|@maven//:commons-codec/commons-codec/commons-codec-1.8.jar
|@maven//:io.netty/netty/netty-3.10.1.Final.jar
|@maven//:org.apiguardian/apiguardian-api/apiguardian-api-1.1.1.jar""".stripMargin,
allJars("@maven//:target-1") ->
"""|@maven//:commons-codec/commons-codec/commons-codec-1.8.jar
|@maven//:io.netty/netty/netty-3.10.1.Final.jar
|@maven//:org.apiguardian/apiguardian-api/apiguardian-api-1.1.1.jar""".stripMargin,
)
)
}

0 comments on commit d9f52fa

Please sign in to comment.