Skip to content

Commit c165aa7

Browse files
committed
Add a limitations section
1 parent ed0b0b5 commit c165aa7

1 file changed

Lines changed: 37 additions & 29 deletions

File tree

doc/how-to-freeze-versions.rst

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -454,35 +454,6 @@ will use the exact same set of dependencies, regardless of any updates (even
454454
patches) that might get published for these dependencies in the meantime.
455455
Therefore, we have effectively "frozen" the dependencies in place.
456456

457-
Project environments
458-
^^^^^^^^^^^^^^^^^^^^
459-
460-
If a package is built in several environments, such as a development
461-
environment, a staging environment and a production environment, it may be
462-
necessary or desirable to ensure that the same dependency versions are selected
463-
in each environment. While this can be done with a **freeze file** there are
464-
limitations.
465-
466-
Freezing limitations
467-
^^^^^^^^^^^^^^^^^^^^
468-
469-
There's a lot to consider before deciding to add a ``cabal.project.freeze`` file
470-
to source control due to limitations of ``cabal freeze``. A freeze is specific
471-
for a single Cabal dependency solver run within the current environment. A good
472-
many packages have platform-specific dependencies and will vary their
473-
dependencies based on the operating system. The index state of the local package
474-
index will also change the list of possible dependencies available to the
475-
solver.
476-
477-
The solver can only solve for the platform and environment that it is running on
478-
and within so the generated ``cabal.project.freeze`` file has no ``os(name)``,
479-
``arch(name)`` or ``impl(compiler)`` conditionals. This is why a ``.freeze``
480-
file is not a true lock file.
481-
482-
For a software product that is developed and built for production on the same
483-
platform and environment, committing the freeze file to source control may make
484-
sense.
485-
486457
.. Tip::
487458

488459
To freeze but also build your project with different versions of GHC; fix
@@ -497,3 +468,40 @@ sense.
497468
498469
Common configuration can be shared between projects by using project
499470
imports.
471+
472+
Freezing limitations
473+
^^^^^^^^^^^^^^^^^^^^
474+
475+
A freeze is specific for a single Cabal dependency solver run within the current
476+
environment. There's a lot to consider before deciding to add a
477+
``cabal.project.freeze`` file to source control due to limitations of ``cabal
478+
freeze``.
479+
480+
Environment Limitation
481+
The solver can only solve for the environment that it is running within so
482+
the generated ``cabal.project.freeze`` file has no ``os(name)``,
483+
``arch(name)`` or ``impl(compiler)`` conditionals. This is why a ``.freeze``
484+
file is not a true lock file.
485+
486+
A good many packages have platform-specific dependencies and will vary their
487+
dependencies based on the operating system.
488+
489+
Index State Limitation
490+
The index state of the local package index will also change the list of
491+
possible dependencies available to the solver.
492+
493+
Revision Limitation
494+
A version constraint cannot include a package revision, neither by revision
495+
number nor hash. These constraints do not have sufficient granularity to
496+
guarantee picking a specific revision. To work around this limitation a
497+
project file will often fix the index state and so hide future revisions
498+
that a freeze file's equality constraints cannot specify.
499+
500+
Index State Limitation
501+
Aside from revisions, the index state of the local package index will also
502+
change the list of possible dependency versions available to the solver.
503+
504+
Despite all of those limitations, for a software product that is always
505+
developed on the same platform and environment, committing the freeze file to
506+
source control may make sense. Even then, a production build would likely need
507+
to avoid such a freeze file.

0 commit comments

Comments
 (0)