File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
cabal-install/src/Distribution/Client Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 12
12
module Distribution.Client.CmdExec
13
13
( execAction
14
14
, execCommand
15
+ -- Utility function exposed for run command
16
+ , pathAdditions
15
17
) where
16
18
17
19
import Distribution.Client.DistDirLayout
@@ -263,6 +265,12 @@ withTempEnvFile verbosity baseCtx buildCtx buildStatus action = do
263
265
action envOverrides
264
266
)
265
267
268
+ -- | Get paths to all dependency executables to be included in PATH.
269
+ --
270
+ -- The filepaths need to be passed to the executable for example
271
+ -- by 'modifyProgramSearchPath' if you are using 'ProgramDb'
272
+ -- or more directly by passing them to 'progInvokePathEnv'
273
+ -- if you are using 'ProgramInvocation'.
266
274
pathAdditions :: Verbosity -> ProjectBaseContext -> ProjectBuildContext -> IO [FilePath ]
267
275
pathAdditions verbosity ProjectBaseContext {.. } ProjectBuildContext {.. } = do
268
276
info verbosity . unlines $
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import Distribution.Client.CmdErrorMessages
35
35
, targetSelectorFilter
36
36
, targetSelectorPluralPkgs
37
37
)
38
+ import Distribution.Client.CmdExec (pathAdditions )
38
39
import Distribution.Client.Errors
39
40
import Distribution.Client.GlobalFlags
40
41
( defaultGlobalFlags
@@ -230,6 +231,9 @@ runAction flags@NixStyleFlags{..} targetAndArgs globalFlags =
230
231
elaboratedPlan
231
232
return (elaboratedPlan', targets)
232
233
234
+ -- Some dependencies may have executables. Let's put those on the PATH.
235
+ extraPaths <- pathAdditions verbosity baseCtx buildCtx
236
+
233
237
(selectedUnitId, selectedComponent) <-
234
238
-- Slight duplication with 'runProjectPreBuildPhase'.
235
239
singleExeOrElse
@@ -300,6 +304,7 @@ runAction flags@NixStyleFlags{..} targetAndArgs globalFlags =
300
304
dataDirsEnvironmentForPlan
301
305
(distDirLayout baseCtx)
302
306
elaboratedPlan
307
+ , progInvokePathEnv = extraPaths
303
308
}
304
309
where
305
310
(targetStr, args) = splitAt 1 targetAndArgs
You can’t perform that action at this time.
0 commit comments