-
Notifications
You must be signed in to change notification settings - Fork 259
/
check.go
39 lines (33 loc) · 919 Bytes
/
check.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package daemon
import (
"encr.dev/cli/daemon/run"
daemonpb "encr.dev/proto/encore/daemon"
)
// Check checks the app for compilation errors.
func (s *Server) Check(req *daemonpb.CheckRequest, stream daemonpb.Daemon_CheckServer) error {
slog := &streamLog{stream: stream, buffered: false}
log := newStreamLogger(slog)
app, err := s.apps.Track(req.AppRoot)
if err != nil {
log.Error().Err(err).Msg("failed to resolve app")
streamExit(stream, 1)
return nil
}
buildDir, err := s.mgr.Check(stream.Context(), run.CheckParams{
App: app,
WorkingDir: req.WorkingDir,
CodegenDebug: req.CodegenDebug,
Environ: req.Environ,
Tests: req.ParseTests,
})
exitCode := 0
if err != nil {
exitCode = 1
log.Error().Msg(err.Error())
}
if req.CodegenDebug && buildDir != "" {
log.Info().Msgf("wrote generated code to: %s", buildDir)
}
streamExit(stream, exitCode)
return nil
}