From 4902d4635a43ed3b9b1d598dc67380d9b72ac14f Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 2 Jan 2025 07:15:01 -0500 Subject: [PATCH] Add cabal target docs --- doc/cabal-commands.rst | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/doc/cabal-commands.rst b/doc/cabal-commands.rst index 7045a46c35f..869e0461a5b 100644 --- a/doc/cabal-commands.rst +++ b/doc/cabal-commands.rst @@ -213,6 +213,8 @@ Arguments and flags common to some or all commands are: Already generated `build-info.json` files will be removed since they would be stale otherwise. +.. _target-forms: + Target Forms ------------ @@ -735,6 +737,40 @@ Examples: be used without arguments, in that case major version bumps are ignored for all packages. +cabal target +^^^^^^^^^^^^ + +``cabal target [TARGETS]`` discloses fully-qualified targets from a selection of +targets and is useful for discovering targets in a project for use with other +commands taking [TARGETS]. This command can also check if a :ref:`target +form` is unique as some commands require a unique TARGET. + +Any target forms except for a script target can be used with ``cabal target``. + +.. code-block:: console + + $ cabal run cabal-install:exe:cabal -- target all:tests + ... + Fully qualified target forms: + - Cabal-tests:test:check-tests + - Cabal-tests:test:custom-setup-tests + - Cabal-tests:test:hackage-tests + - Cabal-tests:test:no-thunks-test + - Cabal-tests:test:parser-tests + - Cabal-tests:test:rpmvercmp + - Cabal-tests:test:unit-tests + - cabal-benchmarks:test:cabal-benchmarks + - cabal-install-solver:test:unit-tests + - cabal-install:test:integration-tests2 + - cabal-install:test:long-tests + - cabal-install:test:mem-use-tests + - cabal-install:test:unit-tests + - solver-benchmarks:test:unit-tests + +For a package, all, module or filepath target, cabal target [TARGETS] will +**only** show ``libs`` and ``exes`` of the [TARGETS]. To also show tests and +benchmarks, enable them with ``--enable-tests`` and ``--enable-benchmarks``. + .. _command-group-build: Project building and installing