@@ -45,7 +45,10 @@ module Distribution.Simple.Setup (
45
45
HaddockFlags (.. ), emptyHaddockFlags , defaultHaddockFlags , haddockCommand ,
46
46
HscolourFlags (.. ), emptyHscolourFlags , defaultHscolourFlags , hscolourCommand ,
47
47
BuildFlags (.. ), emptyBuildFlags , defaultBuildFlags , buildCommand ,
48
- showBuildInfoCommand ,
48
+
49
+ showBuildInfoCommand ,
50
+ writeAutogenFilesCommand ,
51
+ WriteAutogenFilesFlags (.. ),
49
52
buildVerbose ,
50
53
ReplFlags (.. ), defaultReplFlags , replCommand ,
51
54
CleanFlags (.. ), emptyCleanFlags , defaultCleanFlags , cleanCommand ,
@@ -1623,49 +1626,6 @@ instance Monoid CleanFlags where
1623
1626
instance Semigroup CleanFlags where
1624
1627
(<>) = gmappend
1625
1628
1626
- -- ------------------------------------------------------------
1627
- -- * show-build-info flags
1628
- -- ------------------------------------------------------------
1629
-
1630
- showBuildInfoCommand :: ProgramConfiguration -> CommandUI BuildFlags
1631
- showBuildInfoCommand progConf = CommandUI
1632
- { commandName = " show-build-info"
1633
- , commandSynopsis = " Emit details about how a package would be built."
1634
- , commandDescription = Just $ \ _ -> wrapText $
1635
- " Components encompass executables, tests, and benchmarks.\n "
1636
- ++ " \n "
1637
- ++ " Affected by configuration options, see `configure`.\n "
1638
- , commandNotes = Just $ \ pname ->
1639
- " Examples:\n "
1640
- ++ " " ++ pname ++ " show-build-info "
1641
- ++ " All the components in the package\n "
1642
- ++ " " ++ pname ++ " show-build-info foo "
1643
- ++ " A component (i.e. lib, exe, test suite)\n\n "
1644
- ++ programFlagsDescription progConf
1645
- -- TODO: re-enable once we have support for module/file targets
1646
- -- ++ " " ++ pname ++ " show-build-info Foo.Bar "
1647
- -- ++ " A module\n"
1648
- -- ++ " " ++ pname ++ " show-build-info Foo/Bar.hs"
1649
- -- ++ " A file\n\n"
1650
- -- ++ "If a target is ambiguous it can be qualified with the component "
1651
- -- ++ "name, e.g.\n"
1652
- -- ++ " " ++ pname ++ " show-build-info foo:Foo.Bar\n"
1653
- -- ++ " " ++ pname ++ " show-build-info testsuite1:Foo/Bar.hs\n"
1654
- , commandUsage = usageAlternatives " show-build-info" $
1655
- [ " [FLAGS]"
1656
- , " COMPONENTS [FLAGS]"
1657
- ]
1658
- , commandDefaultFlags = defaultBuildFlags
1659
- , commandOptions = \ showOrParseArgs ->
1660
- [ optionVerbosity
1661
- buildVerbosity (\ v flags -> flags { buildVerbosity = v })
1662
-
1663
- , optionDistPref
1664
- buildDistPref (\ d flags -> flags { buildDistPref = d }) showOrParseArgs
1665
- ]
1666
- ++ buildOptions progConf showOrParseArgs
1667
- }
1668
-
1669
1629
-- ------------------------------------------------------------
1670
1630
-- * Build flags
1671
1631
-- ------------------------------------------------------------
@@ -2256,6 +2216,81 @@ optionNumJobs get set =
2256
2216
| otherwise -> Right (Just n)
2257
2217
_ -> Left " The jobs value should be a number or '$ncpus'"
2258
2218
2219
+
2220
+ -- ------------------------------------------------------------
2221
+ -- * ghc-mod support flags
2222
+ -- ------------------------------------------------------------
2223
+
2224
+ showBuildInfoCommand :: ProgramDb -> CommandUI BuildFlags
2225
+ showBuildInfoCommand progDb = CommandUI
2226
+ { commandName = " show-build-info"
2227
+ , commandSynopsis = " Emit details about how a package would be built."
2228
+ , commandDescription = Just $ \ _ -> wrapText $
2229
+ " Components encompass executables, tests, and benchmarks.\n "
2230
+ ++ " \n "
2231
+ ++ " Affected by configuration options, see `configure`.\n "
2232
+ , commandNotes = Just $ \ pname ->
2233
+ " Examples:\n "
2234
+ ++ " " ++ pname ++ " show-build-info "
2235
+ ++ " All the components in the package\n "
2236
+ ++ " " ++ pname ++ " show-build-info foo "
2237
+ ++ " A component (i.e. lib, exe, test suite)\n\n "
2238
+ ++ programFlagsDescription progDb
2239
+ -- TODO: re-enable once we have support for module/file targets
2240
+ -- ++ " " ++ pname ++ " show-build-info Foo.Bar "
2241
+ -- ++ " A module\n"
2242
+ -- ++ " " ++ pname ++ " show-build-info Foo/Bar.hs"
2243
+ -- ++ " A file\n\n"
2244
+ -- ++ "If a target is ambiguous it can be qualified with the component "
2245
+ -- ++ "name, e.g.\n"
2246
+ -- ++ " " ++ pname ++ " show-build-info foo:Foo.Bar\n"
2247
+ -- ++ " " ++ pname ++ " show-build-info testsuite1:Foo/Bar.hs\n"
2248
+ , commandUsage = usageAlternatives " show-build-info" $
2249
+ [ " [FLAGS]"
2250
+ , " COMPONENTS [FLAGS]"
2251
+ ]
2252
+ , commandDefaultFlags = defaultBuildFlags
2253
+ , commandOptions = \ showOrParseArgs ->
2254
+ [ optionVerbosity
2255
+ buildVerbosity (\ v flags -> flags { buildVerbosity = v })
2256
+
2257
+ , optionDistPref
2258
+ buildDistPref (\ d flags -> flags { buildDistPref = d }) showOrParseArgs
2259
+ ]
2260
+ ++ buildOptions progDb showOrParseArgs
2261
+ }
2262
+
2263
+ writeAutogenFilesCommand :: ProgramDb -> CommandUI WriteAutogenFilesFlags
2264
+ writeAutogenFilesCommand progDb = CommandUI
2265
+ { commandName = " write-autogen-files"
2266
+ , commandSynopsis = " Generate and write out the Paths_<pkg>.hs and cabal_macros.h files"
2267
+ , commandDescription = Just $ \ _ -> wrapText $
2268
+ " Components encompass executables, tests, and benchmarks.\n "
2269
+ ++ " \n "
2270
+ ++ " Affected by configuration options, see `configure`.\n "
2271
+ , commandNotes = Just $ \ pname ->
2272
+ " Examples:\n "
2273
+ ++ " " ++ pname ++ " write-autogen-files "
2274
+ ++ " All the components in the package\n "
2275
+ ++ " " ++ pname ++ " write-autogen-files foo "
2276
+ ++ " A component (i.e. lib, exe, test suite)\n\n "
2277
+ ++ programFlagsDescription progDb
2278
+ , commandUsage = usageAlternatives " write-autogen-files" $
2279
+ [ " [FLAGS]" ]
2280
+ , commandDefaultFlags = WriteAutogenFilesFlags NoFlag (toFlag normal)
2281
+ , commandOptions = \ showOrParseArgs ->
2282
+ [ optionVerbosity
2283
+ wafVerbosity (\ v flags -> flags { wafVerbosity = v })
2284
+
2285
+ , optionDistPref
2286
+ wafDistPref (\ d flags -> flags { wafDistPref = d }) showOrParseArgs
2287
+ ]
2288
+ }
2289
+
2290
+ data WriteAutogenFilesFlags = WriteAutogenFilesFlags {
2291
+ wafDistPref :: Flag FilePath ,
2292
+ wafVerbosity :: Flag Verbosity
2293
+ } deriving Show
2259
2294
-- ------------------------------------------------------------
2260
2295
-- * Other Utils
2261
2296
-- ------------------------------------------------------------
0 commit comments