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

Feature request: build in mtime order #30

Open
prez opened this issue Jan 7, 2020 · 2 comments
Open

Feature request: build in mtime order #30

prez opened this issue Jan 7, 2020 · 2 comments
Labels
extension Request for feature not present in ninja

Comments

@prez
Copy link

prez commented Jan 7, 2020

See ninja-build/ninja#1570.
For example, with

rule cmd
    command = true
    description = $in

build ax: cmd a
build bx: cmd b
build cx: cmd c
build all: phony ax bx cx

and touch a c; sleep 1; touch b, samu would build b -> c -> a instead of c -> b -> a.

@markus-oberhumer
Copy link

markus-oberhumer commented Dec 18, 2020

This would indeed be a very welcome feature!

And given that this has been proposed for Ninja back in 2011 ( ninja-build/ninja#60 ) without any further action it might even be a nice "selling point" for people to try samurai.

@michaelforney michaelforney added the extension Request for feature not present in ninja label May 5, 2021
@michaelforney
Copy link
Owner

I think this should be easy to implement by using a priority queue for the pending work instead of a stack.

However, I'm not sure exactly how to decide which build actions should be run first. The example in the linked bug suggests that if a header and source file are changed, the unique object that depends on the source file should be built before the many objects that depend on the header. As far as ninja/samurai is concerned, both are inputs to the action.

If we simply used the metric that actions who have a newer input get built first, then if the header was modified later than the source file, we'd still build those 299 objects first. Perhaps we should prioritize first the actions with newest explicit dependencies (perhaps followed by newest implicit dependencies)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension Request for feature not present in ninja
Projects
None yet
Development

No branches or pull requests

3 participants