From 674e43033d22d1f8b87f27d5a0922003421dec5b Mon Sep 17 00:00:00 2001 From: Kasper Lund Date: Tue, 10 Dec 2024 08:55:38 +0100 Subject: [PATCH] Use 'toit analyze' to gather dependencies (#582) --- cmd/jag/commands/util.go | 4 ++++ cmd/jag/commands/watch.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/jag/commands/util.go b/cmd/jag/commands/util.go index 1e45af3..036ed25 100644 --- a/cmd/jag/commands/util.go +++ b/cmd/jag/commands/util.go @@ -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...)...) } diff --git a/cmd/jag/commands/watch.go b/cmd/jag/commands/watch.go index 17f3f20..e9ff594 100644 --- a/cmd/jag/commands/watch.go +++ b/cmd/jag/commands/watch.go @@ -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)