This project is mirrored from https://github.com/haskell/Cabal. Pull mirroring updated .
  1. 08 Jul, 2018 1 commit
  2. 08 Feb, 2018 1 commit
  3. 08 Nov, 2017 1 commit
    • Duncan Coutts's avatar
      Remove reundant args of selectComponentTarget functions · b0f7a9b6
      Duncan Coutts authored
      The PackageId and ComponentName are already part of the existing
      AvailableTarget record argument.
      
      We need to eliminate this redundancy because for new kinds of target
      selectors we will not have the PackageId and ComponentName from the
      selector, only from the AvailableTarget selected.
      b0f7a9b6
  4. 05 Nov, 2017 1 commit
    • Duncan Coutts's avatar
      Don't paramaterise the TargetSelector type · 11872e57
      Duncan Coutts authored
      Previously the TargetSelector type had a type param for the type of the
      package that it referred to. In particular we used it with types like:
      
      type Matcher  = ... -> Match (TargetSelector KnownPackage)
      type Renderer = TargetSelector PackageId -> ...
      
      However we are about to extend the TargetSelector so that it does not
      just refer to one form of package (e.g. KnownPackage) but can refer to
      packages via various different forms and partial information. So it no
      longer makes sense to have TargetSelector be paramaterised by the
      different states of the one kind of package it refers to, as there are
      now many kinds. So in preparation for that we simplify it so that it is
      equivalent to always using TargetSelector PackageId, and we remove the
      type paramater.
      11872e57
  5. 14 Oct, 2017 1 commit
  6. 02 Aug, 2017 1 commit
  7. 20 Jul, 2017 2 commits
    • Francesco Gazzetta's avatar
      Remove polymorphism from runProjectPreBuildPhase · 484bb6cb
      Francesco Gazzetta authored
      Return a monomorphic TargetsMap from selectPlanSubset and put it in the
      final ProjectBuildContext.
      
      This causes slight duplication in CmdRun.hs, but not as bas as when we
      didn't return anything. In exchange, the final return type is much
      simpler.
      
      Note that CmdConfigure returns an empty TargetsMap, as configure doesn't
      accept targets.
      484bb6cb
    • Francesco Gazzetta's avatar
      Reduce duplication in CmdRun · 7ea22b0f
      Francesco Gazzetta authored
      Previously, the extraction of the target from the targetStrings was done
      twice: inside the function passed to 'runProjectPreBuildPhase' and right
      after it.
      
      Now 'runProjectPreBuildPhase' is able to return information from that
      function, and the duplication was removed, along with some assumptions
      about the number of targets.
      7ea22b0f
  8. 07 Mar, 2017 7 commits
    • Duncan Coutts's avatar
      Add error messages for all the target resolution errors · def073a7
      Duncan Coutts authored
      Formatting into reasonably readable error messages for all of the
      TargetProblem cases for each command. There's quite a bit of overlap
      possible here which we put into common code in a new module.
      
      Also take the opportunity to move some other error formatting into the
      shared module.
      def073a7
    • Duncan Coutts's avatar
      Add integration tests for the target resolving for each command · 6ede1f2b
      Duncan Coutts authored
      This covers some of the positive cases of target selector resolution
      and pretty much all of the negative cases for each command.
      6ede1f2b
    • Duncan Coutts's avatar
      Remove done TODO about no targets in the Cmd* modules · c5cc3b9a
      Duncan Coutts authored
      The case of there being no targets at all is now handled by the target
      selector stage.
      c5cc3b9a
    • Duncan Coutts's avatar
      Add sub-component check for test, bench, run commands · b2381e5d
      Duncan Coutts authored
      Asking to test/bench/run a file or module does not make sense.
      Users can only ask for a whole component.
      b2381e5d
    • Duncan Coutts's avatar
      Rewrite and document the selectPackageTargets for each command · 0a0dff33
      Duncan Coutts authored
      This is the function that implements the semantics of the target
      selector matching for each command.
      
      Introduce and use utils for target filtering and selection.
      
      Rename several of the error constructors to be consistent. For the test,
      bench and run commands, add a distinction between there being no targets
      at all and none of the right kind.
      
      Document the selectPackageTargets top level and cases, and
      selectComponentTarget. Also document the TargetProblem and constructors.
      0a0dff33
    • Duncan Coutts's avatar
      Adjust args to selectComponentTarget functions · 8072ee82
      Duncan Coutts authored
      Previously they took a TargetSelector that would always be a
      TargetComponent constructor, which meant that if we were interested in
      the content then we'd have to do partial pattern matching. Instead they
      now take all the contents of the TargetComponent as separate args which
      means no partial patterns and easy access to the parts.
      
      Also where relevant, put the TargetComponent contents into the
      TargetProblemCommon and TargetProblem constructors.
      8072ee82
    • Duncan Coutts's avatar
      Rename TargetProblem types and change a few related things · a8489be7
      Duncan Coutts authored
      Each Cmd* module defines its own type for representing the error
      conditions in selecting package and component targets. Each one has a
      constructor for the problems that are common to them all, which is
      shared in the ProjectOrchestration module.
      
      Rename these types so that ProjectOrchestration defines the type
      TargetProblemCommon and each of the others defines their own local type
      each named TargetProblem.
      
      Also make one step closer to proper error reporting for all these types
      by using die' and verbosity appropriately. Remove the old unused and
      incomplete error reproting code for TargetProblemCommon.
      
      Add a few Eq and Ord instances while we're at it. They'll be needed for
      testing and other things.
      a8489be7
  9. 27 Feb, 2017 10 commits
    • Duncan Coutts's avatar
      Extend DistDirLayout with project root and cabal.project · 2b26e75b
      Duncan Coutts authored
      So the DistDirLayout now contains the root dir of the project as a
      whole, which eliminates the need to pass it separately in several cases.
      It also contains the location of the cabal.project file, which again
      avoids having to pass it around.
      
      In part these changes were to allow the elimination of uses of the
      legacy config types in the new-build code. The idea is that the legacy
      config types are only used by conversion into the new config types, and
      then only the new types are used in the new code.
      2b26e75b
    • Duncan Coutts's avatar
      Share a bit of repeated command line --help text · f033164f
      Duncan Coutts authored
      The stuff about the new-build/nix-local-build beta
      f033164f
    • Duncan Coutts's avatar
      Add a new 'all' form of target selector · df8ccce1
      Duncan Coutts authored
      Extend TargetSelector with a TargetAllPackages constructor with the
      corresponding concrete command line syntax 'all'. The interpretation of
      this is extended for all commands to be the same as if the list of all
      packages local to the project were given.
      
      Since the concrete syntax for the meta-target 'all' can in principle
      clash with a package 'all' or a component 'all', this short form of
      syntax is made to be ambigious with the existing short forms for
      packages or components, and new more qualified forms are added.
      
      This means that a user writing 'cabal build all' in a project where
      there is a local package 'all' or a component 'all' in the package in
      the cwd (but not any package 'all' as a dependency or any component
      'all' in any package other than the one in the cwd), will be informed
      that the syntax is ambigious and will be told the more qualified forms
      of the possible targets. These would be ':all' and 'pkg:all'. The use of
      the usual ':' separator with an empty string is the explicit indicator
      of a meta namespace. Since 'pkg:all' itself is also potentially
      ambigious with a package named 'pkg' containing a component 'all' then
      there is a further qualified form ':pkg:all' to select the package named
      'all'.
      
      This more qualified syntax need only be used in these highly unusual
      ambigious cases and the user will be informed. The intention, as has
      been the case previously, is to allow a normal syntax that is short and
      convenient but potentially ambigious in rare cases, while still allowing
      all cases to be expressed unambigiously.
      df8ccce1
    • Duncan Coutts's avatar
      Consolodate error reporting in readTargetSelectors · d0b7cce7
      Duncan Coutts authored
      So there's now just one error type rather than two, and errors are
      returned rather than reported directly.
      
      Now that we have squashed together the two phases of the target
      selector parsing and resolving, we also want to do the same with the
      error reporting for the two phases. And to make it possible to customise
      the error messages for different commands we have the reporting being
      done explicitly and separately.
      d0b7cce7
    • Duncan Coutts's avatar
      Move target selector reading before project planning · e2738469
      Duncan Coutts authored
      This means that in the majority of cases we can report errors in the
      command line arguments prior to running the solver. This is a much
      better state of affairs. Previously we had to wait many seconds (or
      sometime more) before being able to report problems. Worse, with the
      previous scheme the solver may fail to find a solution and so we'd
      end up reporting that rather than the problem with the user's target.
      e2738469
    • Duncan Coutts's avatar
      Split early steps out of runProjectPreBuildPhase · 692d6878
      Duncan Coutts authored
      This is part of the refactoring to resolve command line build targets
      without first having to run the solver and produce the elaborated
      install plan.
      
      Previously runProjectPreBuildPhase would do all the early steps
      including finding the project root and establishing the project
      config and the local packages. This patch splits those early steps
      out into a separate pass in the project orchestration. It also
      eliminates the need for the hookPrePlanning and since there's then
      only one hook left we don't bother to name the PreBuildHooks.
      692d6878
    • Duncan Coutts's avatar
      Rename BuildTarget to TargetSelector · af37405c
      Duncan Coutts authored
      We're going to generalise it and the name will no longer be appropriate.
      We'll add the ability to select all packages, or to select only certain
      kinds of components in a package. So this makes it less like a resolved
      target and more or an expression that needs further work to resolve to
      a set of targets.
      af37405c
    • Duncan Coutts's avatar
      Add initial templates for new run & bench commands · f2a8bdf4
      Duncan Coutts authored
      So far they just build the exe bench and don't do the next steps,
      but they do at least select the right components to build.
      
      Also bring the existing test command into sync with the others.
      f2a8bdf4
    • Duncan Coutts's avatar
      Rewrite resolveTargets for flexibility and error handling · cf6a076f
      Duncan Coutts authored
      Instead of expressing the intention in terms of PackageTargets, it now
      takes helper functions that select the components to use for a package
      target or a component target. These helpers are given the set of
      AvailableTargets and they can do error checking and return failures.
      
      This allows the build,configure,haddock,repl implementations to have
      their own behaviour and error checking and reporting for selecting
      targets.
      
      The full details of error reporting are not covered yet.
      cf6a076f
    • Duncan Coutts's avatar
      Refactor selectTargets and rename to resolveTargets · fb3e69f5
      Duncan Coutts authored
      selectTargets would also prune to to the targets, and optionally prune
      to dependencies only. These aspects are now pulled out into the callers
      in the various Cmd{Build,Repl,etc} modules.
      
      It will make more sense to do it this way once we're doing more explicit
      error checking in the callers.
      fb3e69f5
  10. 19 Feb, 2017 1 commit
  11. 26 Jan, 2017 1 commit