Skip to content

Commit

Permalink
Use 'toit analyze' to gather dependencies (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperl authored Dec 10, 2024
1 parent dce04da commit 674e430
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/jag/commands/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ func checkFilepath(p string, invalidMsg string) error {
return nil
}

func (s *SDK) ToitAnalyze(ctx context.Context, args ...string) *exec.Cmd {
return exec.CommandContext(ctx, s.ToitPath(), append([]string{"analyze"}, args...)...)
}

func (s *SDK) ToitCompile(ctx context.Context, args ...string) *exec.Cmd {
return exec.CommandContext(ctx, s.ToitPath(), append([]string{"compile"}, args...)...)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/jag/commands/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func onWatchChanges(
if tmpFile, err := os.CreateTemp("", "*.txt"); err == nil {
defer os.Remove(tmpFile.Name())
tmpFile.Close()
cmd := sdk.ToitCompile(ctx, "--dependency-file", tmpFile.Name(), "--dependency-format", "plain", "--analyze", entrypoint)
cmd := sdk.ToitAnalyze(ctx, "--dependency-file", tmpFile.Name(), "--dependency-format", "plain", entrypoint)
if err := cmd.Run(); err == nil {
if b, err := os.ReadFile(tmpFile.Name()); err == nil {
paths = parseDependeniesToDirs(b)
Expand Down

0 comments on commit 674e430

Please sign in to comment.