https://pantsbuild.org/ logo
#general
Title
# general
w

witty-family-13337

05/16/2022, 2:05 PM
What are your thoughts on allowing some of the JVM targets, the ones that are runnable (i.e. junit/scalatest tests,
deploy_jar
, etc), to have dependencies on
file
targets as well as in
resources
? The case that I’m thinking of is one in which I would like to launch a subprocess (generated at an earlier stage) at the start of a test suite. Being a runnable file, I can not run it from inside a JAR so I can’t use a dependency on a `resource`…
so in the case of a
scalatest_test
target having a dependency on a
file
target (or any target with a
FileSourceField
) would be to have those files in the same process sandbox as where the test is running, but not part of the classpath
w

witty-crayon-22786

05/16/2022, 5:32 PM
What are your thoughts on allowing some of the JVM targets, the ones that are runnable (i.e. junit/scalatest tests,
deploy_jar
, etc), to have dependencies on
file
targets as well as in
resources
?
currently the way to do that would be with an
archive
target: the archive would end up containing your loose file, as well as the
deploy_jar
not exactly sure how that would interact with a test… i believe that the
archive
would be pulled into the test sandbox as a file, but then you would then need to extract the
archive
so in the case of a
scalatest_test
target having a dependency on a
file
target (or any target with a
FileSourceField
) would be to have those files in the same process sandbox as where the test is running, but not part of the classpath
ah… so, i think that the issue with this currently is just that file dependencies are not transitive from JVM tests in v2
they were transitive in v1
w

witty-family-13337

05/16/2022, 6:08 PM
oh i see… mm, well, I think I could workaround that and make them direct using a macro
is there a reason it was decided to make them non-transitive in v2 or is it just a feature gap…?
w

witty-crayon-22786

05/16/2022, 6:09 PM
i expect that your usecase is fairly common… files should live near the code that depends on them, so it shouldn’t be necessary to make the deps direct
just a gap i think: sorry about that. a patch would be very welcome
w

witty-family-13337

05/16/2022, 6:10 PM
ok, think I could get one, doesn't look too complicated
🙌 1