Skip to content

Commit 6c00f0e

Browse files
committed
Make command now accepts sources to compile.
1 parent a6cb3ac commit 6c00f0e

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

Diff for: src/Compiler/Backend.gren

+21-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import FileSystem
3535
import FileSystem.Path as Path exposing (Path)
3636
import Compiler.PackageName as PackageName exposing (PackageName)
3737
import Compiler.Platform as Platform exposing (Platform)
38+
import Compiler.Outline as Outline exposing (Outline)
3839
import SemanticVersion exposing (SemanticVersion)
3940
import ChildProcess exposing (Shell(..))
4041
import Json.Encode as Json
@@ -186,7 +187,7 @@ isCached permission platform envVars homeDir =
186187
type Command
187188
= Init InitFlags
188189
| Repl ReplFlags
189-
| Make { flags : MakeFlags, paths : (Array Path) }
190+
| Make MakeFlags
190191
| Docs DocsFlags
191192
| PackageInstall (Maybe PackageName)
192193
| PackageUninstall PackageName
@@ -215,6 +216,11 @@ type alias MakeFlags =
215216
, sourcemaps : Bool
216217
, output : Maybe MakeOutput
217218
, report : Maybe {}
219+
, projectPath : Path
220+
, entryPoints : Array Path
221+
, outline : Outline
222+
, rootSources : Dict String String
223+
, dependencies : Dict String { outline : Outline, sources : Dict String String }
218224
}
219225

220226

@@ -307,14 +313,26 @@ commandEncoder interactive pathToString command =
307313
, { key = "intepreter" , value = maybeEncoder Json.string flags.interpreter }
308314
]
309315

310-
Make { flags, paths } ->
316+
Make flags ->
317+
let
318+
depsToJson : { outline : Outline, sources : Dict String String } -> Json.Value
319+
depsToJson dep =
320+
Json.object
321+
[ { key = "outline", value = Outline.toJson dep.outline }
322+
, { key = "sources", value = Json.dict identity Json.string dep.sources }
323+
]
324+
in
311325
Json.object
312326
[ { key = "command", value = Json.string "make" }
313327
, { key = "optimize", value = Json.bool flags.optimize }
314328
, { key = "sourcemaps", value = Json.bool flags.sourcemaps }
315329
, { key = "output", value = maybeEncoder makeOutputEncoder flags.output }
316330
, { key = "report-json", value = maybeToBool flags.report }
317-
, { key = "paths", value = Json.array (pathToString >> Json.string) paths }
331+
, { key = "project-path", value = Json.string <| pathToString flags.projectPath }
332+
, { key = "entry-points", value = Json.array (Json.string << pathToString) flags.entryPoints }
333+
, { key = "project-outline", value = Outline.toJson flags.outline }
334+
, { key = "sources", value = Json.dict identity Json.string flags.rootSources }
335+
, { key = "dependencies", value = Json.dict identity depsToJson flags.dependencies }
318336
]
319337

320338
Docs flags ->

0 commit comments

Comments
 (0)