-
-
Notifications
You must be signed in to change notification settings - Fork 646
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[export-dep-as-jar] Respect strict_deps in
libraries
field (#9145)
### Problem The libraries field of a target didn't respect the strict_deps of the target, making it not correct. ### Solution Precalculate a set of "things we want in the classpath", which takes strict_deps into account. Predicate including something in the libraries field, so that we only include things from this set. ### Result The test introduced in the third commit failed before the change, succeeds after.
- Loading branch information
Showing
8 changed files
with
106 additions
and
8 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
examples/src/scala/org/pantsbuild/example/strict_deps/A.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package a | ||
|
||
class Foo |
3 changes: 3 additions & 0 deletions
3
examples/src/scala/org/pantsbuild/example/strict_deps/B.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package b | ||
|
||
class Foo |
32 changes: 32 additions & 0 deletions
32
examples/src/scala/org/pantsbuild/example/strict_deps/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
scala_library( | ||
name = "a", | ||
sources = ["A.scala"], | ||
) | ||
|
||
scala_library( | ||
name = "b", | ||
sources = ["B.scala"], | ||
) | ||
|
||
scala_library( | ||
name = "c", | ||
sources = ["C.scala"], | ||
dependencies = [":a"], | ||
) | ||
|
||
scala_library( | ||
name = "d", | ||
sources = ["D.scala"], | ||
dependencies = [":b", ":c"], | ||
strict_deps = True, | ||
) | ||
|
||
scala_library( | ||
name = "e", | ||
sources = ["E.scala"], | ||
dependencies = [":b", ":c"], | ||
strict_deps = False, | ||
) |
5 changes: 5 additions & 0 deletions
5
examples/src/scala/org/pantsbuild/example/strict_deps/C.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package a | ||
|
||
class C { | ||
val implementationDetail: Any = new a.Foo() | ||
} |
8 changes: 8 additions & 0 deletions
8
examples/src/scala/org/pantsbuild/example/strict_deps/D.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package d | ||
|
||
import a._ | ||
import b._ | ||
|
||
class App { | ||
val foo: Foo = new Foo() | ||
} |
7 changes: 7 additions & 0 deletions
7
examples/src/scala/org/pantsbuild/example/strict_deps/E.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package e | ||
|
||
import a.Foo | ||
|
||
class App { | ||
val foo: Foo = new Foo() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters