@@ -77,7 +77,7 @@ import Obelisk.CliApp (
77 withSpinner,
77 withSpinner,
79import Obelisk.Command.Nix
79import Obelisk.Command.Nix
80−import Obelisk.Command.Project (nixShellWithoutPkgs, withProjectRoot, findProjectAssets, bashEscape)
80+import Obelisk.Command.Project (nixShellWithoutPkgs, withProjectRoot, findProjectAssets, bashEscape, getHaskellManifestProjectPath)
81import Obelisk.Command.Thunk (attrCacheFileName)
81import Obelisk.Command.Thunk (attrCacheFileName)
82import Obelisk.Command.Utils (findExePath, ghcidExePath)
82import Obelisk.Command.Utils (findExePath, ghcidExePath)
@@ -164,8 +164,9 @@ run :: MonadObelisk m => FilePath -> PathTree Interpret -> m ()
164run root interpretPaths = do
164run root interpretPaths = do
165 pkgs <- getParsedLocalPkgs root interpretPaths
165 pkgs <- getParsedLocalPkgs root interpretPaths
166 assets <- findProjectAssets root
166 assets <- findProjectAssets root
167+ manifestPkg <- parsePackagesOrFail . (:[]) . T.unpack =<< getHaskellManifestProjectPath root
167 putLog Debug $ "Assets impurely loaded from: " <> assets
168 putLog Debug $ "Assets impurely loaded from: " <> assets
168− ghciArgs <- getGhciSessionSettings pkgs root True
169+ ghciArgs <- getGhciSessionSettings (pkgs <> manifestPkg) root True
169 freePort <- getFreePort
170 freePort <- getFreePort
170 withGhciScriptArgs pkgs $ \dotGhciArgs -> do
171 withGhciScriptArgs pkgs $ \dotGhciArgs -> do
171 runGhcid root True (ghciArgs <> dotGhciArgs) pkgs $ Just $ unwords
172 runGhcid root True (ghciArgs <> dotGhciArgs) pkgs $ Just $ unwords
@@ -222,7 +223,12 @@ getLocalPkgs root interpretPaths = do
222 let rootsAndExclusions = calcIntepretFinds "" interpretPaths
223 let rootsAndExclusions = calcIntepretFinds "" interpretPaths
224 fmap fold $ for (MMap.toAscList rootsAndExclusions) $ \(interpretPathRoot, exclusions) ->
225 fmap fold $ for (MMap.toAscList rootsAndExclusions) $ \(interpretPathRoot, exclusions) ->
225− let allExclusions = obeliskPackageExclusions <> exclusions <> Set.singleton ("*" </> attrCacheFileName)
226+ let allExclusions = obeliskPackageExclusions
228+ <> Set.singleton ("*" </> attrCacheFileName)
229+ <> Set.singleton ("*" </> "lib/asset/manifest") -- NB: obelisk-asset-manifest is excluded because it generates
230+ -- a module that in turn imports it. This will cause ob run to
231+ -- fail in its current implementation.
226 in fmap (Set.fromList . map normalise) $ runFind $
232 in fmap (Set.fromList . map normalise) $ runFind $
227 ["-L", interpretPathRoot, "(", "-name", "*.cabal", "-o", "-name", Hpack.packageConfig, ")", "-a", "-type", "f"]
233 ["-L", interpretPathRoot, "(", "-name", "*.cabal", "-o", "-name", Hpack.packageConfig, ")", "-a", "-type", "f"]
228 <> concat [["-not", "-path", p </> "*"] | p <- toList allExclusions]
234 <> concat [["-not", "-path", p </> "*"] | p <- toList allExclusions]
@@ -400,7 +406,8 @@ withGhciScriptArgs
400 => f CabalPackageInfo -- ^ List of packages to load into ghci
406 => f CabalPackageInfo -- ^ List of packages to load into ghci
401 -> ([String] -> m ()) -- ^ Action to run with the extra ghci arguments
407 -> ([String] -> m ()) -- ^ Action to run with the extra ghci arguments
403−withGhciScriptArgs packageInfos f = withGhciScript loadPreludeManually packageInfos $ \fp -> f ["-XNoImplicitPrelude", "-ghci-script", fp]
409+withGhciScriptArgs packageInfos f = withGhciScript loadPreludeManually packageInfos $ \fp ->
410+ f ["-XNoImplicitPrelude", "-ghci-script", fp]
405 -- These lines must be first and allow the session to support a custom Prelude when @-XNoImplicitPrelude@
412 -- These lines must be first and allow the session to support a custom Prelude when @-XNoImplicitPrelude@
406 -- is passed to the ghci session.
413 -- is passed to the ghci session.
@@ -458,6 +465,7 @@ getGhciSessionSettings (toList -> packageInfos) pathBase useRelativePaths = do
460 $ baseGhciOptions
467 $ baseGhciOptions
468+ <> ["-DOBELISK_ASSET_PASSTHRU"] -- For passthrough static assets
461 <> ["-F", "-pgmF", selfExe, "-optF", preprocessorIdentifier]
469 <> ["-F", "-pgmF", selfExe, "-optF", preprocessorIdentifier]
462 <> concatMap (\p -> ["-optF", p]) pkgFiles
470 <> concatMap (\p -> ["-optF", p]) pkgFiles
463 <> [ "-i" <> intercalate ":" (concatMap toList pkgSrcPaths) ]
471 <> [ "-i" <> intercalate ":" (concatMap toList pkgSrcPaths) ]