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

Add interface to get run and test deps #98

Merged
merged 1 commit into from
Feb 7, 2023
Merged

Conversation

Javier-varez
Copy link
Contributor

@Javier-varez Javier-varez commented Feb 7, 2023

Since tests are identified as a single command, dependencies for tests and run are implicitly assumed to be the same as for the Build step, including the target binary. This is, however not correct because it doesn't account for the fact that we may want to use a different test runner or some additional target that must be compiled before testing, but not necessarily in the build step of the target.

With this purpose this change introduces an extendedTestInterface and extendedRunInteface where the user may also specify a TestDeps() or RunDeps() function to get the dependencies of the test/run step.

I have made the decision of creating a new interface rather than extending the exiting one because:
a) Not all targets may have additional dependencies.
b) By creating a breaking change in the interface we could potentially miss some run/test targets that now don't satisfy the new interface and therefore it is silently ignored. I find this is a bit of a design issue in rules (or in golang, actually) that does not allow us to say: I want this target to implement interface X, and rather relies on the methods existing.

Since tests are identified as a single command, dependencies for tests
and run are implicitly assumed to be the same as for the Build step,
including the target binary. This is, however not correct because it
doesn't account for the fact that we may want to use  a different test
runner or some additional target that must be compiled before testing,
but not necessarily in the build step of the target.

With this purpose this change introduces an extendedTestInterface
and extendedRunInteface where the user may also specify a TestDeps() or
RunDeps() function to get the dependencies of the test/run step.
@Javier-varez Javier-varez merged commit 58d40c8 into master Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants