Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add respect strict dep option for export-dep-as-jar (pantsbuild#9482)
### Problem ``` $ cat helloworld/BUILD scala_library( name = "b", dependencies = ["x/y/z/"], sources = ["b/**/*.scala"], strict_deps = True ) scala_library( name = "c", dependencies = [":b"], sources = ["c/**/*.scala"], strict_deps = True ) ``` Exporting only {{helloworld/:c}} yields: ``` { "version": "1.1.0", "targets": { "helloworld:c": { "targets": [], "source_dependencies_in_classpath": [], "libraries": [ "org.scala-lang:scala-library:2.12.10", "org.scala-lang.modules:scala-collection-compat_2.12:2.1.2", "helloworld.b" ], ... } }, ... } ``` There is no mention of the dependency from `helloworld:c` to `x/y/z`. We need this information in order to create the runtime classpath for `helloworld:c`. ### Workaround Temporarily disable respecting strict deps. ### Result Example: ``` $ ./pants export-dep-as-jar --no-respect-strict-deps examples/src/scala/org/pantsbuild/example/strict_deps:d { "version": "1.1.0", "targets": { "examples/src/scala/org/pantsbuild/example/strict_deps:d": { "targets": [], "source_dependencies_in_classpath": [ "examples/src/scala/org/pantsbuild/example/strict_deps:d" ], "libraries": [ "org.scala-lang:scala-library:2.12.8", "examples.src.scala.org.pantsbuild.example.strict_deps.c", "examples.src.scala.org.pantsbuild.example.strict_deps.b", "examples.src.scala.org.pantsbuild.example.strict_deps.a" ], "roots": [ { "source_root": "/Users/yic/workspace/pants/examples/src/scala/org/pantsbuild/example/strict_deps", "package_prefix": "org.pantsbuild.example.strict_deps" } ], ... $ ./pants export-dep-as-jar --respect-strict-deps examples/src/scala/org/pantsbuild/example/strict_deps:d { "version": "1.1.0", "targets": { "examples/src/scala/org/pantsbuild/example/strict_deps:d": { "targets": [], "source_dependencies_in_classpath": [], "libraries": [ "examples.src.scala.org.pantsbuild.example.strict_deps.b", "org.scala-lang:scala-library:2.12.8", "examples.src.scala.org.pantsbuild.example.strict_deps.c" ], "roots": [ { "source_root": "/Users/yic/workspace/pants/examples/src/scala/org/pantsbuild/example/strict_deps", "package_prefix": "org.pantsbuild.example.strict_deps" } ], "id": "examples.src.scala.org.pantsbuild.example.strict_deps.d", "target_type": "SOURCE", "is_synthetic": false, .. ``` # Delete this line to force CI to run Clippy and the Rust tests. [ci skip-rust-tests] # No Rust changes made.
- Loading branch information