From 91b21889d016524152f1f63a717036bf02167971 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 22 Sep 2015 11:13:37 +0200 Subject: [PATCH 1/3] Update name of executable in .gitignore Signed-off-by: Matthijs Kooijman --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 69b7b949..e26379ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ bin src/github.com src/golang.org -go-arduino-compiler +arduino-builder # Created by .ignore support plugin (hsz.mobi) ### Go template From 19e325c3bdaa9315c7f241b10cae2a1cb2736c03 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 22 Sep 2015 11:30:00 +0200 Subject: [PATCH 2/3] Print errors to stderr Previously, errors would be dumped to stdout, which of course is not ideal. Moreover, when the Arduino IDE runs arduino-builder --dump-prefs, the errors would end up intermixed with the preferences, or be completely ignored by the IDE when a fatal error occured. Printing errors to stderr causes them to be printed properly by the IDE. Signed-off-by: Matthijs Kooijman --- main.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index 11659bcf..2daa92a1 100644 --- a/main.go +++ b/main.go @@ -119,7 +119,7 @@ func main() { dumpPrefs := *dumpPrefsFlag if compile && dumpPrefs { - fmt.Println("You can either specify --compile or --dump-prefs, not both") + fmt.Fprintln(os.Stderr, "You can either specify --compile or --dump-prefs, not both") defer os.Exit(1) return } @@ -138,7 +138,7 @@ func main() { } if len(hardware) == 0 { - fmt.Println("Parameter 'hardware' is mandatory") + fmt.Fprintln(os.Stderr, "Parameter 'hardware' is mandatory") flag.Usage() defer os.Exit(1) return @@ -153,7 +153,7 @@ func main() { } if len(tools) == 0 { - fmt.Println("Parameter 'tools' is mandatory") + fmt.Fprintln(os.Stderr, "Parameter 'tools' is mandatory") flag.Usage() defer os.Exit(1) return @@ -184,7 +184,7 @@ func main() { } if fqbn == "" { - fmt.Println("Parameter 'fqbn' is mandatory") + fmt.Fprintln(os.Stderr, "Parameter 'fqbn' is mandatory") flag.Usage() defer os.Exit(1) return @@ -201,7 +201,7 @@ func main() { if buildPath != "" { _, err := os.Stat(buildPath) if err != nil { - fmt.Println(err) + fmt.Fprintln(os.Stderr, err) defer os.Exit(1) return } @@ -216,7 +216,7 @@ func main() { context[constants.CTX_BUILD_PATH] = buildPath if compile && flag.NArg() == 0 { - fmt.Println("Last parameter must be the sketch to compile") + fmt.Fprintln(os.Stderr, "Last parameter must be the sketch to compile") flag.Usage() defer os.Exit(1) return @@ -264,10 +264,10 @@ func main() { if err != nil { err = utils.WrapError(err) - fmt.Println(err) + fmt.Fprintln(os.Stderr, err) if utils.DebugLevel(context) >= 10 { - fmt.Println(err.(*errors.Error).ErrorStack()) + fmt.Fprintln(os.Stderr, err.(*errors.Error).ErrorStack()) } exitCode = toExitCode(err) @@ -299,5 +299,5 @@ func toSliceOfUnquoted(value slice) ([]string, error) { func printCompleteError(err error) { err = utils.WrapError(err) - fmt.Println(err.(*errors.Error).ErrorStack()) + fmt.Fprintln(os.Stderr, err.(*errors.Error).ErrorStack()) } From 0bc1e53d250ba483783f2e296f29c05db7feaf8a Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 22 Sep 2015 11:45:38 +0200 Subject: [PATCH 3/3] Fix (harmless) typo in constant value Signed-off-by: Matthijs Kooijman --- src/arduino.cc/builder/constants/constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arduino.cc/builder/constants/constants.go b/src/arduino.cc/builder/constants/constants.go index c35eb49e..cb7732fa 100644 --- a/src/arduino.cc/builder/constants/constants.go +++ b/src/arduino.cc/builder/constants/constants.go @@ -81,7 +81,7 @@ const CTX_DEBUG_LEVEL = "debugLevel" const CTX_FIRST_FUNCTION_AT_LINE = "firstFunctionAtLine" const CTX_FQBN = "fqbn" const CTX_GCC_MINUS_E_SOURCE = "gccMinusESource" -const CTX_GCC_MINUS_M_OUTPUT = "gccMinusMOutout" +const CTX_GCC_MINUS_M_OUTPUT = "gccMinusMOutput" const CTX_HARDWARE_FOLDERS = "hardwareFolders" const CTX_HARDWARE = "hardware" const CTX_HEADER_TO_LIBRARIES = "headerToLibraries"