Skip to content

Don't introduce unnecessary dependencies for top-level requirements #832

@hlverstoep

Description

@hlverstoep

Given:

main = shake shakeOptions $ do
    action $ do
        b <- doesFileExist "file.src"
        when b $ need ["file.out"]
    ...
    action $ do
        need ["file2.out"]

file2.out is now built strictly after file.out (this can be observed during builds, and seen in the report). However, the actions are independent so there should not be a dependency. This is even more confusing if the actions are not defined so close to each other. I suspect actions are aggregated using parallel, which would cause the same behaviour.

If this is difficult to fix, perhaps an alternative style should be suggested in the documentation for actions such that shake can evaluate the actions independently:

main = shake shakeOptions $ do
    want ["toplevel1"]
    phony "toplevel1" $ do
        b <- doesFileExist "file.src"
        when b $ need ["file.out"]
    ...
    want ["toplevel2"]
    phony "toplevel2" $ do
        need ["file2.out"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions