Skip to content

--only-dependencies should work if not using --only-dependencies would work #7226

Closed
@newhoggy

Description

@newhoggy

Describe the bug
If a project P depends on A depends on B depends on C and a git reference is supplied in cabal.project for project B (for example to test a patch), then using --dependencies-only will fail.

To Reproduce

See this build failure:

https://github.com/input-output-hk/cardano-ledger-specs/runs/1648708803?check_suite_focus=true

The error reported is:

cabal: Cannot select only the dependencies (as requested by the
'--only-dependencies' flag), the package ListLike-4.7.3 is required by a
dependency of one of the other targets.

Expected behavior
Expected behaviour. If the project should build without --dependencies-only then it should also build with --dependencies-only.

The reason this is useful is because it is common in CI to build with --dependencies-only and then cache the cabal store. This helps ensure that something is cached in the project even if the project itself fails to build.

System information
All operating systems, versions of cabal and ghc.

Additional context
To make this work, cabal can choose to build the minimal number of additional components outside of the the "dependencies only" set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions