shake-build-system

Can I "force" parallel execution of dependent targets?


Say I have a target A that depends on B, but I can run A and B in parallel. Is this possible with Shake? It seems like need ... makes actions sequential which totally makes sense, of course, but this is a "special" case.


Solution

  • Given:

    "A" %> \_ -> do need ["B"]; ...
    "B" %> \_ -> ...
    

    If you do need ["A","B"] then it will start A and B in parallel, but the A action will immediately pause until B is complete. For what reason is it safe to run A and B in parallel? If the action computed by A needs to rerun when B changes, but doesn't actually use B itself you can reorder to be:

    "A" %> \_ -> do ...; need ["B"]
    

    However, if the action in A actually uses B then there is no real way to run them in parallel.