Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/haskell/Cabal. Pull mirroring updated .
  1. May 14, 2024
  2. May 06, 2024
    • Teo Camarasu's avatar
      Downgrade NoLibraryFound from an error to a warning · 312a4124
      Teo Camarasu authored
      This makes Setup copy/install succeed if there's
      nothing to do because the package doesn't contain
      a library or executable.
      
      This allows downstream users of Cabal to avoid having to
      add workarounds for this edge case.
      
      Resolves #6750
      312a4124
  3. Apr 30, 2024
    • sheaf's avatar
      Reinstate 'initialBuildSteps' function · dd74e921
      sheaf authored
      This patch reinstates the 'initialBuildSteps' function, as it is
      used by stack in its implementation of the multi-repl feature.
      
      A deprecation warning has been added to that function: calling it does
      not suffice to prepare the sources for a package, as there are other
      steps that one might also need to perform:
      
        - running pre-processors (such as alex/happy)
        - running pre-build hooks or custom logic (in build-type: Hooks
          or build-type: Custom or Configure)
      
      Consumers wanting to prepare the sources of a package, e.g. in order to
      launch a REPL session, are advised to run
      `Setup repl --repl-multi-file=<fn>` instead.
      
      Fixes #9856
      dd74e921
  4. Apr 25, 2024
    • f-a's avatar
      Add release notes for Cabal 3.12 (#9920) · f27cd58a
      f-a authored
      * Add release notes for Cabal 3.12
      
      Forwardport of #9785, #9908
      
      Add changelog/release notes for Cabal 3.12 (#9785)
      
      - generated with
           git log --pretty=oneline --no-color cabal-install-v3.10.1.0..HEAD > 3.12.prlog
      - deduped
      - stored WIP “release notes” file for future `cabal-install` release
      
      3.12 changelogs updated (#9908)
      
      * Update changelog for 3.12
      
      (and for future WIP 3.12.1.0 cabal-install)
      
      * Remove changelog.d files
      
      * 3.12 changelog fixup (#9922)
      
      * Incorporate Brandon’s suggestions
      
      See #9920.
      
      * Incorporate Artem’s suggestions
      
      See #9920.
      
      * Do not repeat yourself
      
      * Fix whitespace
      
      * Fix release notes grammar
      
      See #9920.
  5. Apr 18, 2024
    • sheaf's avatar
      Introduce SetupHooks · c5f99331
      sheaf authored
      This commit introduces a new build-type, Hooks. A package using this
      build type should provide a SetupHooks.hs module which exports
      a value `setupHooks :: SetupHooks`. This is intended to replace the
      Custom setup type. This allows Cabal to have finer-grained information
      about the build, instead of having an opaque Setup executable to invoke.
      
      Tests include:
      
        - error when returning an invalid component diff in a
          per-component pre-configure hook
        - error when declaring pre-build rules whose dependency
          graph contains cycles
        - error when we cannot find a dependency of a pre-build rule
        - warning when there are pre-build rules that are declared but
          never demanded
        - correctness tests for SetupHooks, e.g. that
          pre-build rules are run in dependency order (see the
          `SetupHooksRuleOrdering` test)
      c5f99331
  6. Apr 15, 2024
    • Phil de Joux's avatar
      Show abbreviated mixed versions with suffix · 4a1f73c1
      Phil de Joux authored
      - Use independent package name in doctest
      - Add changelog entry
      - Still use showOption when linked
      - Typo, package is cabal-install-solver
      - Rename showIsOrVs to showOptions
      - Add linked doctests for showOptions
      4a1f73c1
  7. Apr 14, 2024
    • fendor's avatar
      Redesign 'cabal path' command to account for projects (#9583) · 4a8a7c5d
      fendor authored
      
      * Redesign 'cabal path' command to account for projects
      
      Previously, `cabal path` was only able to query from the global
      configuration file, e.g., `~/.cabal/config` or the XDG equivalent.
      Adding support for cabal project is a huge boost to usability.
      
      We take the foundations and turn them into `cabal v2-path` which takes
      project configuration, such as `cabal.project` into account.
      Note, the command is still named `cabal path`, but for the sake of
      disambiguation, we refer to this new iteration of the command as `cabal
      v2-path`.
      
      In addition, we add support for multiple output formats, such as
      key-value pairs and json.
      
      The key-value pair output prints a line for each queried key and its
      respective value:
      
          key1: value2
          key2: value2
      
      If only a single key is queried, we print only the
      value, for example:
      
          value1
      
      The json output format is versioned by the cabal-install version which
      is part of the json object.
      Thus, all result objects contain at least the key "cabal-install-version".
      
      We expand the `cabal v2-path` to also produce information of the
      compiler that is going to be used in a `cabal build` or `cabal repl` invocation.
      To do that, we rebuild the install plan and query for the configured
      compiler program.
      This is helpful for downstream tools, such as HLS, to figure out the GHC
      version required to compile a project with.
      
      We also add an exhaustive test suite for 'cabal path' cmd
      
      We test that each query honours cabal.project files, cli parameters, and
      is composable with the other query flags.
      
      We extend the test output normalisers for ghc compiler location and
      cabal-install version, as the 'cabal path' command outputs the exact ghc
      and ghc-pkg location. In addition, the json output format is versioned
      on the cabal-install version.
      
      Currently, we query the cabal-install version on each test normalisation
      run. This might be unnecessary expensive, and could be avoided by
      introducing a 'cabalProgram' that specifies how the program version can
      be found. This way, we can cache the version query.
      
      Add '--cache-home' flag thats shows the cabal's cache root
      
      Rename '--cache-dir' to the more correct '--remote-repo-dir'.
      
      * Update 'cabal path' documentation
      
      * Add changelog.d entry
      
      ---------
      
      Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  8. Apr 12, 2024
  9. Apr 06, 2024
  10. Apr 04, 2024
    • Phil de Joux's avatar
      Show provenance of import constraint · f8cd5634
      Phil de Joux authored
      With this change to the solver message rendering, I also fix some bugs around project imports, adding tests for those cases. Reviewers asked that the Y-shaped import checks (using IORef) be made on a separate pull request. Removing those lead to cascading deletions.
      
      - Regenerate expected .out files
      - Show tree provenance of import constraint
      - Add trimmed down PackageTests/VersionPriority
      - Add changelog entry
      - Use NonEmpty
      - Fix check for cyclical import
      - Use primes for next iteration
      - Remove unused LANGUAGE pragmas
      - Rename to projectConfigPathRoot
      - Docs for ProjectConfigPath and showProjectConfigPath
      - Renaming
      - Add cyclical import tests with 1 and 2 hops in cycle
      - Use full path for cyclical error message
      - Expected output has project with full project path
      - Add fullPath local function
      - Project directory as FilePath, not Maybe FilePath
      - Use (_, projectFileName) binding splitFileName
      - Need full path to project parsing legacy
      - Inline seenImports conversion
      - Add cyclical checks with same file names and hops
      - Add noncyclical tests that hop over folders
      - Add a project testing skipping in and out of a folder
      - Update expectations of cyclical tests
      - Use canonicalizePath for collapsing .. when possible
      - Capture trace for later
      - Add module for ProjectConfigPath
      - Move functions for ProjectConfigPath to its module
      - Fetch URI is not prefixed with ./https://etc
      - Document normaliseConfigPath
      - Add doctests for normaliseConfigPath
      - Add doctest of canonicalizeConfigPath
      - Show an example of canonical paths
      - Use importer and importee in canonicalizeConfigPaths
      - Add logging
      - Use normLocPath, drop -XMultiWayIf
      - Remove seenImports parameter from parseProject
      - Follow hlint suggestion: Move brackets to avoid $
      - Follow hlint warning: Use mapM
      - Follow hlint warning: Use traverse_
      - Follow hlint suggestion: Use <$>
      - Add failing test skipping across folder
      - Remove normaliseConfigPath
      - Add hasDuplicatesConfigPath
      - Remove lengthConfigPath and nubConfigPath
      - Mention cabal-install-solver in the changelog
      - Left align project import tree with other content
      - Rerun tests to generate left-aligned tree output
      - Don't show "constraint from project requires ..."
      - Regenerate test outputs without (constraint from project ...)
      - Move fail reason printing to project config path module
      - Minimize diff of showFR
      - Show an "imported by: " list instead of a tree
      - Update info logging, avoiding leading spaces
      - When logging I found leading spaces were trimmed
      - Don't log relative location and path
      - Use unicode tree symbol in haddocks
      - A duplicate importing tests
      - Add Y-forking import test
      - A test for detecting when the same config is imported via many different paths
      - Fix a typo with ../noncyclical-same-filename-b.config
      - Add an intercepting cabal-testsuite/cabal.project
      - Use IORef to detect seen imports
      - Get rid of seenImports
      - Use IORef [FilePath] of uniqueImports
      - Add consProjectConfigPath
      - Expand the haddocks of newtype ProjectConfigPath
      - Clarify, it's the project root directory
      - Rename a function to makeRelativeConfigPath
      - Fix whitespace
      - Update output snippet in changelog
      - Put the info logging together
      - Split cycles and duplicates detection
      - Add fixes and duplicate import to the change log
      - Better reporting of duplicate imports
      - Report cycles and duplicates using unique file name
      - This is after canonicalizeConfigPath, relative to the project directory
      - Get rid of fullLocPath, use normLocPath only
      - Do reporting using paths relative to the directory of the project
      - Issue a warning for Y-shaped duplicate imports
      - Add duplicateImportMsg
      - Use pretty printing for duplicate import message
      - Use pretty printing for all ProjectConfigPath printing
      - Drop a parameter from duplicateImportMsg
      - Correct haddocks on docProjectConfigPath
      - Satisfy fourmolu
      - Remove the surplus space in "imported by "
      - Log project parsing at the debug level, up from info
      - Simplify the changelog snippet
      - Use normalized paths for solver messages
      - Satisfy fourmolu
      - Relative to the directory of the project
      - Duplicate imports are reported as warnings
      - No need to mention v2-build
      - Remove IORef
      - Subdue a check for duplicate imports
      - TODO: Catch duplicates across different import paths. We know how to do this
      - Remove check for duplicate imports
      - Improve the canonicalizeConfigPath doctests
      - Add haddocks, drop configPath from go
      - Make importsBy NonEmpty
      - Use testDir in doctests
      - Use canonical test directory
      - Regenerate expected outputs
      - Assume head of the path is the duplicate
      - Get rid of duplicateImportMsg
      - Remove unused imports in ProjectConfigPath
      - Follow hlint suggestion: use fewer imports
      - Remove fullConfigPathRoot
      - Follow hlint suggestion: redundant bracket
      - Use the original "source" variable name
      - Put the source next to its contents
      - Go with the original "seenImports" variable name
      - Avoid -XMultiWayIf
      - Not needed since we aren't checking for duplicates right now
      - Be consistent in naming sources
      - Move project dir alongside related params
      - Rename to pathRequiresVersion
      - Add back "constraint from"
      - Talk only of cycles and not duplicates
      - Don't report line number for cyclical import
      - Remove 2nd example in changelog
      - Remove Y-forked duplicate import test
      - Add "imported by" to assertOutputContains
      - Cull excess doctests of canonicalizeConfigPath
      - Add deep path doctest
      - Update haddocks of canonicalizeConfigPath
      - remove idempotent speculation (it isn't idempotent)
      - use "indirection" to describe "." and ".."
      - makes the path relative to the given directory
      - Remove seenImports
      - Use Explicit ProjectConfigPath
      - Missed one "constraint from" in changelog example
      - Don't check (verbosity >= verbose) separately
      - While the same level of verbosity as info, it is clearer to not check the level separately.
      - Might calculate the path but not use it.
      - Add AbsoluteDir
      - Keep provenance normalised for display
      - Remove stale REVIEW comment
      - Storing provenance normalized avoids this
      - Fix whitespace
      - Satisfy HLint warning: Redundant flip
      - Gut the repo/hashable packages
      - Revert AbsoluteDir to FilePath
  11. Apr 03, 2024
    • sheaf's avatar
      Make Cabal agnostic about working directory · 7b905832
      sheaf authored
      This commit makes the library functions in Cabal agnostic of the working
      directory. In practice, this means that we distinguish `FilePath`s
      from un-interpreted `SymbolicPath`s. The latter may be paths that are
      relative to the working directory, and need to be interpreted with
      respect to a passed-in argument specifying the working directory,
      instead of using the working directory of the current process.
      See Note [Symbolic paths] in Distribution.Utils.Path.
      
      In particular, paths in the package description now use the SymbolicPath
      abstraction, which allows specifying whether they are allowed to be
      absolute, and, if they are relative, what they are relative to.
      For example, source files are relative to a source search directory,
      data files are relative to the data directory, and doc files are
      relative to the package root.
      
      Fixes #9702
      7b905832
  12. Mar 30, 2024
  13. Mar 17, 2024
  14. Mar 10, 2024
  15. Mar 08, 2024
  16. Feb 25, 2024
    • Matthew Pickering's avatar
      cabal-install: Clarify the semantics of package-db flag · d626ef87
      Matthew Pickering authored
      In this PR we make the `--package-db` flag apply only to the default
      immutable initial package stack rather than also applying to the store
      package database.
      
      There are two special package databases which cabal install knows about
      and treats specially.
      
      * The store directory, a global cache of installed packages where cabal
        builds and installs packages into.
      * The inplace directory, a local build folder for packages, where cabal
        builds local packages in.
      
      It is very important that cabal registers packages it builds into one of
      these two locations as there are many assumptions that packages will end
      up here.
      
      With the current design of the `--package-db` flag, you are apparently
      allowed to override the store location which should have the effect of
      making the last package database in the package stack the "store"
      directory. Perhaps this works out in theory but practically this
      behaviour was broken and things were always registered into the store
      directory that cabal knew about. (The assertion in
      `ProjectBuilding.UnpackedPackage` was failing (see added test)).
      
      With `--package-db` not being able to modify the location of the store
      directory then the interaction of `--package-db`, `--store-dir` and
      `--dist-dir` flags become easy to understand.
      
      * `--package-db` modify the initial package database stack, these
        package database will not be mutated by cabal and provide the initial
        package environment which is used by cabal.
      * `--store-dir` modify the location of the store directory
      * `--dist-dir` modify the location of the dist directory (and hence
        inplace package database)
      
      Treating the flags in this way also fix an assertion failure when
      building packages.
      
      Fixes #9678
      d626ef87
  17. Feb 22, 2024
  18. 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
  19. Feb 13, 2024
  20. Feb 08, 2024
  21. Jan 29, 2024
    • Andrea Bedini's avatar
      Drop sub-component targets (#8966) · 3f4c81fd
      Andrea Bedini authored
      This change removes support for building sub-component targets in
      cabal-install, since no versions of Cabal support this feature.
      
      The test RunMainBad is also dropped because without the concept of a
      file target, RunMainBad is the same test as ScriptBad.
  22. Jan 25, 2024
    • Tom Smeding's avatar
      Ignore invalid Unicode in pkg-config descriptions (#9609) · 0b34b4ea
      Tom Smeding authored
      * Ignore invalid Unicode in pkg-config descriptions
      
      Previously, if any of the pkg-config packages on the system had invalid
      Unicode in their description fields (like the Intel vpl package has at
      the time of writing, 2024-01-11, see #9608), cabal would crash because
      it tried to interpret the entire `pkg-config --list-all` output as
      Unicode.
      
      This change, as suggested by gbaz in
        https://github.com/haskell/cabal/issues/9608#issuecomment-1886120831
      
      
      switches to using a lazy ByteString for reading in the output, splitting
      on the first space in byte land, and then parsing only the package
      _name_ to a String.
      
      For further future-proofing, package names that don't parse as valid
      Unicode don't crash Cabal, but are instead ignored.
      
      * Add changelog entry
      
      * cabal-install-solver: Add bounds on 'text'
      
      * No literal ASCII values, use 'ord'
      
      * Address review comments re invalid unicode from pkg-config
      
      * Add test for invalid unicode from pkg-config
      
      * Compatibility with text-1.2.5.0
      
      * Align imports
      
      * Handle different exception type
      
      * Use only POSIX shell syntax
      
      * Add invalid-input handler in pkg-config shim
      
      This is to appease shellcheck
      
      * Actually implement all required stuff in the pkg-config shim
      
      * Less exception dance
      
      * Fix shebang lines
      
      MacOS doesn't have /usr/bin/sh, and /bin/sh is the standard (for a POSIX
      shell) anyway
      
      * Don't expect a particular representation of invalid characters
      
      ---------
      
      Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  23. Jan 19, 2024
    • Simon Hengel's avatar
      Include the GHC "Project Unit Id" in the cabal store path · b055abb5
      Simon Hengel authored
      - This allows the use of several **API incompatible builds of the same
        version of GHC** without corrupting the cabal store.
      - This relies on the "Project Unit Id" which is available since GHC
        9.8.1, older versions of GHC do not benefit from this change.
      
      [fixes #8114]
      b055abb5
  24. Jan 18, 2024
    • Ondřej Šebek's avatar
      Honor build-tool-depends in CmdRun · f06195d3
      Ondřej Šebek authored
      Similarly to CmdExec and CmdTest, get paths to all dependency binaries
      and add those to PATH. Unlike CmdExec, add just the explicitly required
      paths.
      f06195d3
    • Javier Sagredo's avatar
      Fix extra-prog-path propagation in the codebase. · 46df8ba7
      Javier Sagredo authored
      Extra prog paths were being handled in many different ways all thorugh
      the codebase. This PR introduces a unified way to look at them.
      
      Aiming for traceability, the addition of extra paths is now traced via
      `logExtraProgramSearchPath`. All appearances of
      `modifyProgramSearchPath` are replaced with `appendProgramSearchPath`
      which traces the added paths.
      
      `progInvokePathEnv` was only being set by GHC for some paths to
      executables in components and only under certain circumstances. Now
      every `ghcInvocation` sets the extra paths directly into `pkgInvokeEnv`.
      
      In particular this fixes PATH issues when running MinGW cabal in
      PowerShell, as usually for other OSes the system path contains most of
      the expected directories.
      46df8ba7
  25. Jan 17, 2024
  26. Jan 13, 2024
  27. Jan 12, 2024
  28. 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
  29. Jan 05, 2024
  30. Dec 18, 2023
  31. Dec 12, 2023
  32. Dec 09, 2023
  33. Dec 05, 2023
  34. 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
  35. Nov 26, 2023
    • Javier Sagredo's avatar
      Use Base16 hash for script path. · 97f99171
      Javier Sagredo authored
      Issue #9334 shows that `%` characters on Windows result in invalid
      paths, also `/` characters on Linux create invalid paths.
      
      This changes from using base64 to using base16 with the same length
      we use for unit-ids.
      97f99171
Loading