Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/haskell/Cabal. Pull mirroring updated .
  1. Feb 17, 2024
    • Rodrigo Mesquita's avatar
      Merge the two Globbing modules in cabal and cabal-install · e2019f5a
      Rodrigo Mesquita authored
      We use the datatype representation from the globbing in cabal-install,
      but preserve a standalone parser for globs present in cabal files, whose
      specification is constrained by the cabal specification. The
      implementations are merged taking the best parts of each.
      
      We also make sure sdist is robust to accidentally-listed directories,
      as the refactor of the globbing modules re-uncovered this issue, and
      required a prompt fix for the refactor not to break some things.
      
      Fixes #5349
      e2019f5a
  2. Feb 07, 2024
  3. Jan 17, 2024
  4. Jan 11, 2024
    • sheaf's avatar
      Split up LocalBuildInfo · 37779f65
      sheaf authored
      The aim of this commit is to modularise LocalBuildInfo to better
      reflect implicit invariants.
      
      The top-level split
      
        data LocalBuildInfo =
          NewLocalBuildInfo
            { localBuildDescr  :: LocalBuildDescr
            , localBuildConfig :: LocalBuildConfig
            }
      
      reflects which part of a LocalBuildInfo are set in stone by Cabal
      (the LocalBuildDescr), while LocalBuildConfig contains options that
      can be controlled/modified by the user in some way.
      
      The split
      
        data LocalBuildDescr =
          LocalBuildDescr
          { packageBuildDescr :: PackageBuildDescr
          , componentBuildDescr :: ComponentBuildDescr
          }
      
      reflects that some parts of the information determined at configuration
      time resides at the package level, while other pieces of information
      are pertinent to individual components.
      
      Finally the structure of LocalBuildConfig is aimed to reduce code
      duplication between the Cabal library and cabal-install.
      37779f65
  5. Jan 10, 2024
    • f-a's avatar
      Add “Ignore warning” option to cabal check · 08591a99
      f-a authored
      * Introduce `-i/--ignore` command-line option.
          e.g.  cabal check --ignore=missing-upper-bounds  will not display
          “Missing upper bounds” warnings.
      
      * Additionally, a filterPackageChecksById function is now exported
        in Distribution.PackageDescription.Check.Warning; this can be
        used by third party tools.
      
      * Add CheckExplanationIDString to `cabal check` messages.
          e.g. from
            Error: The 'license' field is missing or is NONE.
          to
            Error: [license-none] The 'license' field is missing or is NONE.
      
          This makes using the cabal check `--ignore` option more immediate.
      
      * Spool `MissingField` into separate constructors.
        Introducing five new constructors for `CheckExplanation`
          MissingFieldCategory
          MissingFieldMaintainer
          MissingFieldSynopsis
          MissingFieldDescription
          MissingFieldSynOrDesc
        This provides better ergonomic for `cabal check --ignore` and makes
        it easier to update the manual if the need arises.
      
      * Add tests for desiderable `--ignore` string qualities (not too long,
        without too many '-', unique).
      
      * Warn when `--ignore` string is not recognised.
          Also add a test for this.
      
      * Add documentation.
      
      * Add changelog.
      08591a99
  6. Jan 07, 2024
    • f-a's avatar
      Relax `tar` upper bound · 51e6483f
      f-a authored and f-a's avatar f-a committed
      * Add a `Compat` module to accomodate two different `tar` interfaces.
      * Tweak `-Wunused-packages` conditional (thanks Phil de Joux)
      51e6483f
  7. Dec 19, 2023
  8. Dec 18, 2023
    • Rodrigo Mesquita's avatar
      HPC artifacts are written and read from pkg-db · d6e38041
      Rodrigo Mesquita authored
      This commit re-designs the mechanism by which we make the .mix files of
      libraries available to produce the Haskell Program Coverage report after
      running testsuites.
      
      The idea, for the Cabal library, is:
      
      * Cabal builds libraries with -fhpc, and store the hpc artifacts in
        build </> `extraCompilationArtifacts`
      * At Cabal install time, `extraCompilationArtifacts` is copied into the
        package database
      * At Cabal configure time, we both
          - receive as --coverage-for flags unit-ids of library components
            from the same package (ultimately, when #9493 is resolved, we will
            receive unit ids of libraries in other packages in the same
            project too),
          - and, when configuring a whole package instead of just a testsuite
            component, we determine the unit-ids of libraries in the package
        these unit-ids are written into `configCoverageFor` in `ConfigFlags`
      * At Cabal test time, for each library to cover (stored in
        `configCoverageFor`), we look in the package database for the hpc
        dirs, which we eventually pass along to the `hpc markup` call as
        `--hpcdir` flags
      
      As for cabal-install:
      
      * After a plan has been elaborated, we select the packages which can be
        covered and pass them to Cabal's ./Setup configure as
        --coverage-for=<unit-id> flags.
          - Notably, valid libraries are non-indefinite and
            non-instantiations, since HPC does not support backpack.
          - Furthermore, we only include libraries in the same package as the
            component being configured, despite possibly there being
            more library components in other packages of the same project.
            When #9493 is resolved, we could lift this restriction and pass
            all libraries local to the package as --coverage-for. See
            `determineCoverageFor` and `shouldCoverPkg` in Distribution.Client.ProjectPlanning.
      
      Detail:
          We no longer pass the path to the testsuite's mix dirs to `hpc
          markup` because we only ever include modules in libraries, which
          means they were previously unused.
      
      Fixes #6440 (internal libs coverage), #6397 (backpack breaks coverage),
      doesn't yet fix #8609 (multi-package coverage report) which is tracked
      in #9493, and fixes in a new way the previously fixed #4798, #5213.
      d6e38041
    • f-a's avatar
      Guard PackageInfo behind `cabal-version` ≥ 3.12 (#9481) · f3eafa75
      f-a authored
      
      * Add `cabal-version` 3.12
      
      * Add test for #9331
      
      - `cabal check`: Guard Paths_* behind `cabal-version: 3.12` or higher,
        “fail” and “succeed” tests.
      - `cabal build`: Guard Paths_* behind `cabal-version: 3.12` or higher,
        “fail” test.
      
      * Guard PackageInfo behind cabal-version ≥ 3.12
      
      ---------
      
      Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
      f3eafa75
  9. Dec 12, 2023
  10. Dec 02, 2023
  11. Nov 29, 2023
    • Matthew Pickering's avatar
      testsuite: Introduce Cabal-tests library for common testsuite functions · 624fb7b0
      Matthew Pickering authored
      I noticed that Distribution.Utils.TempTestDir was only used in the
      testsuite but defined in the Cabal library. Rather than expose this in
      the public interface of the `Cabal` library, it is cleaner to refactor
      it into a separate library (`Cabal-tests`) which can be used by any
      testsuite component.
      
      Also, in future it gives a clearer place to put utility functions which
      need to be shared across the testsuite but not exposed in Cabal.
      Cabal-tests can also freely add dependencies (such as exceptions) which
      we might want to avoid adding to the Cabal library.
      
      Fixes #9453
      624fb7b0
  12. Nov 18, 2023
    • glaubitz's avatar
      Add support for 64-bit SPARC as a separate architecture · 5ae4f2eb
      glaubitz authored
      Previously, sparc64 was defined as an alias for the 32-bit SPARC
      architecture which was true while SPARC mainland was mostly 32
      bits. More recently, 64-bit SPARC has become a port of its own,
      so it needs to be treated as a separate architecture.
      5ae4f2eb
  13. Nov 13, 2023
    • f-a's avatar
      Reimplement `cabal check` (#8427) · 21b858f1
      f-a authored
      * Fix Semigroup target instance
      
      When two target names are the same, `mappend`ing them should not
      error but just pick the first name.
      
      * Add `desugarBuildToolSimple`
      
      * Reimplement cabal check
      
      * Reorder test output
      
      * Fix autogen modules tests .cabal files
      
      * Add a number of tests
      
      * Add test for #7423
      
      i.e. Do not warn on -O2 if under off-by-default package configuration
      flag conditional.
      
      * Add a regression for:
      
          * Add another -WErrr test
              This is to make sure we do *not* report it if it is under
              a user, off-by-default flag.
          * Add test for non manual user flags.
          * Add “absolute path in extra-lib-dirs” test
          * Add if/else test
          * Add “dircheck on abspath” check
          * Add Package version internal test
          * Add PackageVersionsStraddle test
      
      * Add changelog for #8427
      
      * Integrate various reviews
      
      * Integrate Artem’s review
      
      (review) Clarify `combineNames` documentation
      
      By explaining the way it operates (working if the two names are equal
      or one is empty) and renaming the function from `combineName` to
      `combineNames`.
      
      (review) Use guards instead of if/then/else
      
      (review) Match inside argument list
      
      (review) Replace “white” with “allow”
      
      (review) Fix typo in comment
      
      (review) Fix typo in Check module documentation
      
      (review) Harmonise indentation for `data` decls
      
      First field goes in a new line than the data constructor, so we
      have more space.
      
      (review) Rename `Prim` module to `Types`
      
      (review) Add checkPackageFilesGPD
      
      `checkPackageFiles` — which works on PD — was used to perform IO. We
      introduce a function that does the same thing but works on GPD (which
      is more principled).
      
      `checkPackageFiles` cannot just be removed, since it is part of the
      interface of Distribution.PackageDescription.Check. Deprecation can
      be planned once “new check” is up and running.
      
      * Integrate Andreas’ review
      
      (review) Add named section to missing upper bound check
      
      “miss upper bound” checks will now list target type and name (“On
      executable 'myexe', these packages miss upper bounds”) for easier
      fixing by the user.
      
      (review) remove `cabal gen-bounds` suggestion
      
      Reasonable as `cabal gen-bounds` is stricter than `cabal check`, see
      https://github.com/haskell/cabal/pull/8427#issuecomment-1446712486
      
      
      Once `gen-bounds` behaves in line with `check` we can readd the
      suggestion.
      
      (review) Do not warn on shared bounds
      
      When a target which depends on an internal library shares some
      dependencies with the latter, do not warn on upper bounds.
      
      An example is clearer
      
          library
           build-depends: text < 5
          ⁝
           build-depends: myPackage,        ← no warning, internal
                          text,             ← no warning, shared bound
                          monadacme         ← warning!
      
      * Integrate Artem’s review /II
      
      (review) Split Check.hs
      
      Check.hs has been split in multiple file, each une sub 1000 lines:
      
      Check              857 lines
      Check.Common       147 lines
      Check.Conditional  204 lines
      Check.Monad        352 lines
      Check.Paths        387 lines
      Check.Target       765 lines
      Check.Warning      865 lines
      
      Migration guide:
      - Check              GPD/PD checks plus work-tree checks.
      - Check.Common       common types and functions that are
                           *not* part of monadic checking setup.
      - Check.Conditional  checks on CondTree and related matter
                           (variables, duplicate modules).
      - Check.Monad        Backbone of the checks, monadic inter-
                           face and related functions.
      - Check.Paths        Checks on files, directories, globs.
      - Check.Target       Checks on realised targets (libraries,
                           executables, benchmarks, testsuites).
      - Check.Warning      Datatypes and strings for warnings
                           and severities.
      
      (review) remove useless section header
      
      (review) Fix typo
      
      (review) Add warnings documentation (list)
      
      For each warning, we document constructor/brief description
      in the manual.  This might not be much useful as not but it
      will come handy when introducing `--ignore=WARN` and similar
      flags.
      
      * (review Andreas) Clarify CheckExplanation comment
      
      Whoever modifies `CheckExplanation` data constructors needs to be
      aware that the documentation in  doc/cabal-commands.rst  has to be
      updated too.
      
      * Move internal Check modules to `other-modules`
      
      No need to expose Distribution.PackageDescription.Check.*
      to the world. API for checking, for cabal-install and other
      tools, should be in Distribution.PackageDescription.Check.
      
      * Make fourmolu happy
      
      Cabal codebase has now a formatter/style standard (see #8950).
      
      “Ravioli ravioli, give me the formuoli”
      
      * Do not check for OptO in scripts
      
      See #8963 for reason and clarification requests.
      
      * Remove useless PackageId parameter
      
      It is now in the Reader part of CheckM monad.
      
      * Do not check PVP on internal targets
      
      Internal: testsuite, benchmark.
      See #8361.
      
      * Make hlint happy
      
      * Fix #9122
      
      When checking internal version ranges, we need to make sure we
      are not mistaking a libraries with the same name but from different
      packages. See #9132.
      
      * Fix grammar
      
      neither…nor, completing what done in #9162
      
      * Integrate Brandon’s review: grammar
      
      * Remove unnecessary `-fvia-C` check
      
      Brandon’s review/II.
      
      ---------
      
      Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
      21b858f1
  14. Nov 02, 2023
  15. Sep 08, 2023
  16. Sep 04, 2023
  17. Jul 02, 2023
  18. Jun 22, 2023
    • Oleg Grenrus's avatar
      Make readFields warn about inconsistent indentation. · 3e17cec9
      Oleg Grenrus authored and f-a's avatar f-a committed
      This is affect of using indentOfAtLeast method:
      any indentation greater than current offset is fine.
      
      That behavior is desirable to parsing multiline field contents,
      but it is a bit surprising for fields, which we expect to be aligned.
      
      Such insonsistency seems to be always a mistake, and it's easy to fix once
      a machine points it out.
      3e17cec9
  19. Jun 14, 2023
  20. Jun 10, 2023
  21. May 28, 2023
    • Matthew Pickering's avatar
      Add support for loading multiple components into one repl session · e61b658d
      Matthew Pickering authored and Francesco Gazzetta's avatar Francesco Gazzetta committed
      There are several parts to this patch which are logically distinct but
      work together to support the overal goal of starting a GHCi session with
      multiple packages loaded at once.
      
      1. When a user writes "cabal repl <target>" then if the user is using a
         compiler > ghc-9.4.* then we will attempt to start a multi-session
         which loads the selected targets into one multi-package session of
         GHC.
      1a. The closure property states that in order to load components `p` and `q` into
          the same session that if `p` depends on `z` and `z` depends on `q`
          then `z` must also be loaded into the session.
      1b. Only inplace packages are able to be loaded into a multi session (if a component
          `z` exists then it is already made into an inplace package by
          cabal). Therefore cabal has already engineered that there is source
          code locally available for all packages which we will want to load
          into a session.
      
      2. The solver is unmodified, the solver is given the repl targets and
         creates a build plan as before. After the solver is completed then in
         `setRootTargets` and `pruneInstallPlan` we modify the install plan to
         enforce the closure property and mark which dependencies need to be
         promised.
      
         * Mark the current components as `BuildInPlaceOnly InMemory`, which
           indicates to the compiler that it is to be built in a GHC
           multi-session.
         * Augment the component repl targets to indicate that components
           required by the closure property (in addition to normal targets)
           will be loaded into the repl.
         * Modify the dependency edges in `compLibDependencies` to indicate
           which dependencies are the promised ones (which is precisely
           components which are `BuildInPlaceOnly InMemory` build styles).
           This is the field which is eventually used to populate the
           `--dependency` argument to `./Setup configure`.
      
      Fixes #8491
      e61b658d
  22. May 25, 2023
  23. Apr 26, 2023
  24. Apr 01, 2023
  25. Feb 23, 2023
  26. Feb 19, 2023
  27. Jan 20, 2023
  28. Jan 05, 2023
  29. Dec 04, 2022
    • Jappie Klooster's avatar
      Add upper bound check to all (#8361) · 5d43746f
      Jappie Klooster authored
      * Add check for upper bound on any package
      
      fixes https://github.com/haskell/cabal/issues/8291
      presumably this will make it nag at anyone for forgetting
      to add upper bounds to their packages.
      
      add changelog
      
      (presumably)
      
      wait what?
      
      move toDependencyVersionsMap to utils section
      
      add nicer error message
      
      simplify checking logic, add more comments
      
      only emit missing upper bounds if bigger then one
      
      don't add bound to internal libraries
      
      filter out self from the dependency map
      
      I think this is an external library so it needs an upper bound now?
      
      add test for multilib
      
      fix test suite by ignoring the warning
      
      ... probably not the best approach
      
      change link to pvp instead of parsonsmatt
      
      better wording on missing upper bound error
      
      remove spurious parenthesis
      
      change map creation from monad to list comprehension
      
      use foldmap to get rid of maybe, fix compile error
      
      rewrite from do notation to list comprehension
      
      fix test suite failing
      
      fix compile error
      
      factor out double filter call in a && expression
      
      * set expectation
      
      * Modify test so it gives a list of expected libs
      
      rename public-multilib-3 to all-upper-bound
      the test had little to do with multilib.
      
      * Update comment on ignoring warnigns
      
      * use map instead of if
      
      * Undo map change
      
      add comment on why that doesn't work
      
      * Add description and maintainer fields
      
      * make description longer then synopsis in all-upper-bound.cabal
      5d43746f
  30. Oct 09, 2022
  31. Sep 30, 2022
    • Ross Paterson's avatar
      add DeepSubsumption and TypeData language extensions (ghc proposals 511 & 106) (#8493) · f13a1896
      Ross Paterson authored
      
      * add TypeData language extension (ghc proposal 106)
      
      * changelog entry for PR 8493
      
      * add TypeData to cabal.vim
      
      * update MD5 hashes
      
      * Update changelog.d/pr-8493
      
      adjusted wording
      
      Co-authored-by: default avatarArtem Pelenitsyn <a.pelenitsyn@gmail.com>
      
      * add DeepSubsumption as suggesterd by Artem Pelenitsyn
      
      * update MD5sums
      
      Co-authored-by: default avatarArtem Pelenitsyn <a.pelenitsyn@gmail.com>
      f13a1896
    • Athas's avatar
      Adopt XDG Base Directory Specification (#7386) · 9f7dc559
      Athas authored
      
      * Move towards using XDG directories.
      
      * Install binaries in $HOME/.local/bin.
      
      * Fix tests.
      
      * Ensure config file is where it should be.
      
      * Require newer directory for XdgState.
      
      * Put world file in XDG_STATE_HOME.
      
      * Oops, forgot to import.
      
      * Remove uses of getCabalDir.
      
      * These all need directory-1.3.7.0 now.
      
      * Oh right, not a builtin anymore.
      
      If this works I will also change the other .json files.
      
      * Try it by hand.
      
      * Haskell is better than JSON.
      
      * Bump directory in all jsons.
      
      * Put directory first.
      
      * Let us assume that getConfigFilePath gets this right.
      
      * Implement backwards compatibility.
      
      * This is now elsewhere.
      
      * We need to create parents as well because ~/.local might not exist.
      
      * Put scripts-build in distinct cache directory.
      
      * Document XDG behaviour.
      
      * Remove help text references to ~/.cabal.
      
      * Remove references to .cabla/bin.
      
      * Backwards compatible install paths.
      
      * Remove more references to ~/.cabal.
      
      * Fix typo.
      
      * Fix ~/.cabal paths making their way into default config.
      
      * Reduce duplication.
      
      * Add changelog entry.
      
      * Also note install dir change.
      
      * It is the cabal-install config file.
      
      * Avoid dependending on cabal-install in Hackage-tests.
      
      * ALso respect CABAL_DIR here.
      
      * Try leaving InstallDirs alone.
      
      * Also need duplication here.
      
      * Add missing newline.
      
      * Fix doc typos.
      
      * Make this a Haddock comment.
      
      * Revision field must not be null.
      
      * Link directories.
      
      * Update doc/config.rst
      
      Co-authored-by: default avatarArtem Pelenitsyn <a.pelenitsyn@gmail.com>
      
      * No need for this.
      
      * We install foreign libraries here now.
      
      * Clarify Nothing case.
      
      * Avoid using ~/.config/cabal in manual.
      
      Co-authored-by: default avatarMikolaj Konarski <mikolaj@well-typed.com>
      Co-authored-by: default avatarArtem Pelenitsyn <a.pelenitsyn@gmail.com>
      9f7dc559
  32. Aug 31, 2022
    • Alexey Radkov's avatar
      Remove warning on option -threaded when building libraries (#8432) · 1003ed66
      Alexey Radkov authored
      * Remove warning on option -threaded when building libraries
      
      Fixes #8431. Accompanied by option -flink-rts, option -threaded defines
      the flavour of the ghc RTS library the built library will be linked
      against. Note that bare ghc does not warn when option -threaded is used
      for building a library either.
      
      * Cabal no longer warns on -threaded option when building libraries
      
      Note that this commit modifies regression check for issue #774.
      
      * A small changelog was added
      1003ed66
  33. Aug 07, 2022
  34. Jul 28, 2022
  35. Jun 15, 2022
  36. May 30, 2022
  37. May 25, 2022
Loading