Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions builder/src/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ import qualified Reporting.Render.Type.Localizer as L
import qualified Stuff


import Lamdera



-- ENVIRONMENT

Expand Down Expand Up @@ -1121,6 +1124,8 @@ crawlRoot env@(Env _ _ projectType _ buildID _ _) mvar root =
do let deps = map Src.getImportName imports
let local = Details.Local path time deps (any isMain values) buildID buildID
crawlDeps env mvar deps (SOutsideOk local source modul)
& Lamdera.alternativeImplementationWhen (lamderaIsLiveHarnessModule modul)
(crawlDeps (lamderaLiveHarnessEnv env) mvar deps (SOutsideOk local source modul))

Left syntaxError ->
return $ SOutsideErr $
Expand Down Expand Up @@ -1249,3 +1254,21 @@ addOutside root modules =
ROutsideOk name iface objs -> Fresh name iface objs : modules
ROutsideErr _ -> modules
ROutsideBlocked -> modules



-- @LAMDERA


{- Alternative implementation extended with support for additional
source directories when compiling the Lamdera Live harness module
-}
lamderaIsLiveHarnessModule :: Src.Module -> Bool
lamderaIsLiveHarnessModule modul =
Src.getName modul == "LocalDev"


lamderaLiveHarnessEnv :: Env -> Env
lamderaLiveHarnessEnv env =
-- adds the Lamdera cache directory as an additional source directory
env { _srcDirs = AbsoluteSrcDir (Lamdera.lamderaCache $ _root env) : _srcDirs env }
5 changes: 2 additions & 3 deletions builder/src/Elm/Outline.hs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ read root shouldCheckLamdera =
then Left Exit.OutlineNoPkgCore
else Right outline

App (AppOutline version srcDirs@(NE.List srcHead srcTail) direct indirect testDirect testIndirect)
App (AppOutline _ srcDirs direct indirect _ _)
| Map.notMember Pkg.core direct ->
return $ Left Exit.OutlineNoAppCore

Expand All @@ -219,9 +219,8 @@ read root shouldCheckLamdera =
do maybeDups <- detectDuplicates root (NE.toList srcDirs)
case maybeDups of
Nothing ->
let newSrcDirs = NE.List srcHead (AbsoluteSrcDir (Lamdera.lamderaCache root) : srcTail) in
Lamdera.alternativeImplementationPassthrough (Lamdera.Checks.runChecks root shouldCheckLamdera direct) $
return $ Right (App (AppOutline version newSrcDirs direct indirect testDirect testIndirect))
return $ Right outline

Just (canonicalDir, (dir1,dir2)) ->
return $ Left (Exit.OutlineHasDuplicateSrcDirs canonicalDir dir1 dir2)
Expand Down