Skip to content

Commit 4069066

Browse files
authored
Merge pull request #67 from lamdera/pit-localdev-fix
Fix modified elm.json bug introduced in #46
2 parents 086ec97 + b8d7ff2 commit 4069066

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

builder/src/Build.hs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ import qualified Reporting.Render.Type.Localizer as L
5858
import qualified Stuff
5959

6060

61+
import Lamdera
62+
63+
6164

6265
-- ENVIRONMENT
6366

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

11251130
Left syntaxError ->
11261131
return $ SOutsideErr $
@@ -1249,3 +1254,21 @@ addOutside root modules =
12491254
ROutsideOk name iface objs -> Fresh name iface objs : modules
12501255
ROutsideErr _ -> modules
12511256
ROutsideBlocked -> modules
1257+
1258+
1259+
1260+
-- @LAMDERA
1261+
1262+
1263+
{- Alternative implementation extended with support for additional
1264+
source directories when compiling the Lamdera Live harness module
1265+
-}
1266+
lamderaIsLiveHarnessModule :: Src.Module -> Bool
1267+
lamderaIsLiveHarnessModule modul =
1268+
Src.getName modul == "LocalDev"
1269+
1270+
1271+
lamderaLiveHarnessEnv :: Env -> Env
1272+
lamderaLiveHarnessEnv env =
1273+
-- adds the Lamdera cache directory as an additional source directory
1274+
env { _srcDirs = AbsoluteSrcDir (Lamdera.lamderaCache $ _root env) : _srcDirs env }

builder/src/Elm/Outline.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ read root shouldCheckLamdera =
202202
then Left Exit.OutlineNoPkgCore
203203
else Right outline
204204

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

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

226225
Just (canonicalDir, (dir1,dir2)) ->
227226
return $ Left (Exit.OutlineHasDuplicateSrcDirs canonicalDir dir1 dir2)

0 commit comments

Comments
 (0)