geetarista/ST2-Arduino

Upload build command should compile if there a changes

Closed this issue ยท 11 comments

If I am working on an Arduino sketch, I currently need to switch between "Arduino-Compile" and "Arduino-Upload", as the upload command doesn't check for changes and recompiles if there are changes.

Sounds like we need something like a "Compile and Upload" command. My question is should we change the upload command to do this or are there ever cases where people want to upload without compiling? I'm fine either way, but I don't know what the majority use case is.

You could start with making a separate "Compile and Upload" command and then later remove the current upload command, if nobody uses it.

I've added a new compile/upload command. Let me know if it works for you.

It doesn't work as I get the following error:

usage: ino [-h] {build,clean,init,list-models,preproc,serial,upload} ...
ino: error: too few arguments
[Finished in 0.1s with exit code 2]

I don't think you can run 2 build commands using a semicolon like that.

You also have a trailing comma in the windows build command and the ino command is build and not compile.

Derp. Try it again with the latest commit. I looked up building with multiple commands and it looks like this is the only way to do it. Hopefully it works...

It doesn't work, I get the same error.
You should probably create a shell script that does this and call that, eg.:

#!/bin/bash
ino build
ino upload

Yeah, I was hoping to avoid that since it's not cross-platform. I'm going to try one last thing before I resort to that.

OK, I just pushed something else. Sorry for the back and forth, but my Arduino is at home so I can't really test these out.

It works now, If you fix the syntax errors ๐Ÿ˜„:

{
  "cmd": ["sh", "-c", "ino build && ino upload"],
  "windows": {
    "shell": true,
    "cmd": ["ino", "build", "&;", "ino", "upload"]
  },
  "selector": "source.c++.arduino",
  "working_dir": "$file_path/..",
  "path": "/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
}

Gah, sorry, it's still way too early. ๐Ÿ˜›

No problem and thank you for the quick support ๐Ÿ‘