Skip to content

Commit

Permalink
Prepare to release v0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperl committed Jan 5, 2022
1 parent 4f711a8 commit 8402641
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 34 deletions.
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ jag-macos-sign:
.PHONY: snapshot
snapshot: $(BUILD_DIR)/jaguar.snapshot

.PHONY: $(TOIT_REPO_PATH)/build/host/sdk/bin/toitpkg
$(TOIT_REPO_PATH)/build/host/sdk/bin/toitpkg:
make -C $(TOIT_REPO_PATH) build/host/sdk/bin/toitpkg
.PHONY: $(TOIT_REPO_PATH)/build/host/sdk/bin/toit.pkg
$(TOIT_REPO_PATH)/build/host/sdk/bin/toit.pkg:
make -C $(TOIT_REPO_PATH) build/host/sdk/bin/toit.pkg

.packages: $(JAG_TOIT_PATH)/bin/toitpkg $(TOIT_SOURCE)
$(JAG_TOIT_PATH)/bin/toitpkg pkg install
.packages: $(JAG_TOIT_PATH)/bin/toit.pkg $(TOIT_SOURCE)
$(JAG_TOIT_PATH)/bin/toit.pkg pkg install

.PHONY: $(TOIT_REPO_PATH)/build/host/sdk/bin/toitc
$(TOIT_REPO_PATH)/build/host/sdk/bin/toitc:
make -C $(TOIT_REPO_PATH) build/host/sdk/bin/toitc
.PHONY: $(TOIT_REPO_PATH)/build/host/sdk/bin/toit.compiler
$(TOIT_REPO_PATH)/build/host/sdk/bin/toit.compiler:
make -C $(TOIT_REPO_PATH) build/host/sdk/bin/toit.compiler

$(BUILD_DIR)/jaguar.snapshot: $(JAG_TOIT_PATH)/bin/toitc $(TOIT_SOURCE) $(BUILD_DIR) .packages
$(JAG_TOIT_PATH)/bin/toitc -w ./$@ ./src/jaguar.toit
$(BUILD_DIR)/jaguar.snapshot: $(JAG_TOIT_PATH)/bin/toit.compiler $(TOIT_SOURCE) $(BUILD_DIR) .packages
$(JAG_TOIT_PATH)/bin/toit.compiler -w ./$@ ./src/jaguar.toit

IDF_PATH ?= $(TOIT_REPO_PATH)/third_party/esp-idf
.PHONY: $(TOIT_REPO_PATH)/build/host/esp32/
Expand Down
2 changes: 1 addition & 1 deletion cmd/jag/commands/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func DecodeCmd() *cobra.Command {
snapshot = filepath.Join(snapshotsCache, device.ID+".snapshot")
}

decodeCmd := sdk.Toitvm(ctx, sdk.SystemMessageSnapshotPath(), snapshot, "-b", args[0])
decodeCmd := sdk.ToitRun(ctx, sdk.SystemMessageSnapshotPath(), snapshot, "-b", args[0])
decodeCmd.Stderr = os.Stderr
decodeCmd.Stdout = os.Stdout
return decodeCmd.Run()
Expand Down
2 changes: 1 addition & 1 deletion cmd/jag/commands/flash.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func FlashCmd() *cobra.Command {
return err
}

injectCmd := sdk.Toitvm(ctx, sdk.InjectConfigPath(), configFile.Name(), binTmpFile.Name())
injectCmd := sdk.ToitRun(ctx, sdk.InjectConfigPath(), configFile.Name(), binTmpFile.Name())
injectCmd.Stderr = os.Stderr
injectCmd.Stdout = os.Stdout
if err := injectCmd.Run(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/jag/commands/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func CheckPort(port string) (string, error) {

func pickPort(all bool) (string, error) {
ports, err := getPorts(all)
if ports.Len() == 0 {
if err != nil || ports.Len() == 0 {
return "", fmt.Errorf("no serial ports detected. Have you installed the driver to the ESP32 you have connected?")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/jag/commands/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func SimulateCmd() *cobra.Command {
return err
}

simCmd := sdk.Toitvm(ctx, "-b", "none", snapshot, strconv.Itoa(int(port)), id.String(), name)
simCmd := sdk.ToitRun(ctx, "-b", "none", snapshot, strconv.Itoa(int(port)), id.String(), name)
simCmd.Stderr = os.Stderr
simCmd.Stdout = os.Stdout
return simCmd.Run()
Expand Down
2 changes: 1 addition & 1 deletion cmd/jag/commands/toit.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func ToitLspCmd() *cobra.Command {
}

cmd.SilenceErrors = true
toitLsp := sdk.ToitLsp(ctx, append([]string{"--toitc", sdk.ToitcPath()}, args...))
toitLsp := sdk.ToitLsp(ctx, append([]string{"--toitc", sdk.ToitCompilePath()}, args...))
toitLsp.Stdin = os.Stdin
toitLsp.Stdout = os.Stdout
toitLsp.Stderr = os.Stderr
Expand Down
31 changes: 18 additions & 13 deletions cmd/jag/commands/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,20 @@ func GetSDK(ctx context.Context) (*SDK, error) {
return res, res.validate(info, ok)
}

func (s *SDK) ToitcPath() string {
return filepath.Join(s.Path, "bin", directory.Executable("toitc"))
func (s *SDK) ToitCompilePath() string {
return filepath.Join(s.Path, "bin", directory.Executable("toit.compile"))
}

func (s *SDK) ToitvmPath() string {
return filepath.Join(s.Path, "bin", directory.Executable("toitvm"))
func (s *SDK) ToitRunPath() string {
return filepath.Join(s.Path, "bin", directory.Executable("toit.run"))
}

func (s *SDK) ToitRunSnapshotPath() string {
return filepath.Join(s.Path, "bin", directory.Executable("run_boot.snapshot"))
}

func (s *SDK) ToitLspPath() string {
return filepath.Join(s.Path, "bin", directory.Executable("toitlsp"))
return filepath.Join(s.Path, "bin", directory.Executable("toit.lsp"))
}

func (s *SDK) VersionPath() string {
Expand Down Expand Up @@ -98,8 +102,9 @@ func (s *SDK) validate(info Info, skipSDKVersionCheck bool) error {
}

paths := []string{
s.ToitcPath(),
s.ToitvmPath(),
s.ToitCompilePath(),
s.ToitRunPath(),
s.ToitRunSnapshotPath(),
s.ToitLspPath(),
s.VersionPath(),
s.SystemMessageSnapshotPath(),
Expand Down Expand Up @@ -127,12 +132,12 @@ func checkFilepath(p string, invalidMsg string) error {
return nil
}

func (s *SDK) Toitc(ctx context.Context, args ...string) *exec.Cmd {
return exec.CommandContext(ctx, s.ToitcPath(), args...)
func (s *SDK) ToitCompile(ctx context.Context, args ...string) *exec.Cmd {
return exec.CommandContext(ctx, s.ToitCompilePath(), args...)
}

func (s *SDK) Toitvm(ctx context.Context, args ...string) *exec.Cmd {
return exec.CommandContext(ctx, s.ToitvmPath(), args...)
func (s *SDK) ToitRun(ctx context.Context, args ...string) *exec.Cmd {
return exec.CommandContext(ctx, s.ToitRunPath(), args...)
}

func (s *SDK) ToitLsp(ctx context.Context, args []string) *exec.Cmd {
Expand All @@ -146,7 +151,7 @@ func (s *SDK) Build(ctx context.Context, device *Device, entrypoint string) ([]b
}
snapshot := filepath.Join(snapshotsCache, device.ID+".snapshot")

buildSnap := s.Toitc(ctx, "-w", snapshot, entrypoint)
buildSnap := s.ToitCompile(ctx, "-w", snapshot, entrypoint)
buildSnap.Stderr = os.Stderr
buildSnap.Stdout = os.Stdout
if err := buildSnap.Run(); err != nil {
Expand All @@ -165,7 +170,7 @@ func (s *SDK) Build(ctx context.Context, device *Device, entrypoint string) ([]b
bits = "-m64"
}

buildImage := s.Toitvm(ctx, s.SnapshotToImagePath(), "--binary", bits, snapshot, image.Name())
buildImage := s.ToitRun(ctx, s.SnapshotToImagePath(), "--binary", bits, snapshot, image.Name())
buildImage.Stderr = os.Stderr
buildImage.Stdout = os.Stdout
if err := buildImage.Run(); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/jag/commands/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func newWatcher() (*watcher, error) {
}

func (w *watcher) Close() error {
return w.Close()
return w.watcher.Close()
}

func (w *watcher) Events() chan fsnotify.Event {
Expand Down Expand Up @@ -164,7 +164,7 @@ func onWatchChanges(ctx context.Context, watcher *watcher, device *Device, sdk *
if tmpFile, err := ioutil.TempFile("", "*.txt"); err == nil {
defer os.Remove(tmpFile.Name())
tmpFile.Close()
cmd := sdk.Toitc(ctx, "--dependency-file", tmpFile.Name(), "--dependency-format", "plain", "--analyze", entrypoint)
cmd := sdk.ToitCompile(ctx, "--dependency-file", tmpFile.Name(), "--dependency-format", "plain", "--analyze", entrypoint)
if err := cmd.Run(); err == nil {
if b, err := ioutil.ReadFile(tmpFile.Name()); err == nil {
paths = parseDependeniesToDirs(b)
Expand Down
6 changes: 3 additions & 3 deletions cmd/jag/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
)

var (
date = "2021-12-30T08:02:05Z"
version = "v0.5.0"
sdkVersion = "v0.12.0"
date = "2022-01-05T05:22:00Z"
version = "v0.5.1"
sdkVersion = "v0.13.1"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion third_party/toit
Submodule toit updated 141 files

0 comments on commit 8402641

Please sign in to comment.