forked from haskell-hvr/packunused
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackunused.cabal
86 lines (83 loc) · 3.01 KB
/
packunused.cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: packunused
version: 0.1.1.4
synopsis: Tool for detecting redundant Cabal package dependencies
homepage: https://github.com/hvr/packunused
bug-reports: https://github.com/hvr/packunused/issues
license: BSD3
license-file: LICENSE
author: Herbert Valerio Riedel
maintainer: Herbert Valerio Riedel <[email protected]>
copyright: © 2014 Herbert Valerio Riedel
category: Distribution
build-type: Simple
cabal-version: >=1.10
description:
This simple CLI tool allows to find out which of the packages listed as
@build-depends@ in a Cabal package description file are redundant.
.
@packunused@ works by taking advantage of GHC's
@-ddump-minimal-imports@ feature which creates @.import@ files for
each compiled module containing a /minimal/ set of explicit import
declarations. These @.import@ files together with Cabal's generated
package configuration meta-data is analyzed by @packunused@ to
detect potentially redundant package dependencies.
.
In order to use @packunused@ you have to configure the package as
usual. See the example session below:
.
> cabal clean
> rm *.imports
> cabal configure -O0 --disable-library-profiling
> cabal build --ghc-option=-ddump-minimal-imports
> packunused
.
Alternatively:
.
> # stack setup --upgrade-cabal' # necessary only when stack's global "Cabal" installation is out of date
> stack clean
> stack build --ghc-options '-ddump-minimal-imports -O0'
> packunused
.
The @-O0 --disable-library-profiling@ options are just to speed up
compilation. In some cases you might want to pass additional options
to the @configure@ step, such as @--enable-benchmark@ or
@--enable-tests@.
.
When run, @packunused@ prints a report to standard output listing
its findings for each component built. The following is an example
for the @packunused@ package itself, with a redundant dependency
added for demonstration on purpose:
.
> detected package components
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> - executable(s): packunused
>
> (component names suffixed with '*' are not configured to be built)
>
> executable(packunused)
> ~~~~~~~~~~~~~~~~~~~~~~
>
> The following package dependencies seem redundant:
>
> - criterion-0.6.2.0-9dd4d764629a47662168743b2dfda9bc
>
extra-source-files: changelog.md
source-repository head
type: git
location: https://github.com/hvr/packunused.git
executable packunused
main-is: packunused.hs
other-modules: Paths_packunused
default-language: Haskell2010
other-extensions: CPP, RecordWildCards
ghc-options: -Wall -fwarn-tabs -fno-warn-unused-do-bind
build-depends:
base >=4.5 && <4.9,
Cabal >=1.14 && <1.23,
optparse-applicative >=0.8,
directory >=1.1 && <1.3,
filepath >=1.3 && <1.5,
haskell-src-exts >=1.13,
split ==0.2.*,
process