Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We allow rules to generate build edges that carry additional dependencies such as implicit dependencies and build-order dependencies. This is used when creating in-place format rules to return something that carries an additional build-order dependency on the formatting finishing so that all build edges using this as an input will wait on the formatting to finish before reading the file.
Currently our linting steps (which is just
biome lint
at the moment, but there is need for a formatting check rule) requires us to pass a function to thevalidations
property - see theformatAndLint
function used within./configure.mjs
. Below is a simplified version,assuming we wanted to format and lint
foo.js
and then copy it toout.js
, we would generate something like the following ninja file,which guarantees that we only copy
foo.js
once formatting is done, and whenever we try to format we have a validation on the linting, meaning it can be done in parallel to the copy.If we can allow the output to carry
validations
dependencies too then we can write,and we would generate something like the following ninja file,
noticing that the
out.js
build edge is the thing that carries the validation rule. If we had multiple build edges built up from the return value offormatAndLint
they would all add both the order-only dependency on formatting and the validation step on linting. This is more verbose than the previous solution, but it is unlikely to cause issues for the majority of people. It allows slightly more flexibility to run ninja on just the format target without requiring linting. We also have a nice topological order of all of the edges.