diff --git a/arduino/builder/builder.go b/arduino/builder/builder.go index 02f264c383a..59e3ff8a02e 100644 --- a/arduino/builder/builder.go +++ b/arduino/builder/builder.go @@ -19,18 +19,22 @@ import ( "crypto/md5" "encoding/hex" "os" - "path/filepath" "strings" + "github.com/arduino/go-paths-helper" "github.com/pkg/errors" ) -// GenBuildPath generates a suitable name for the build folder -func GenBuildPath(sketchPath string) string { - md5SumBytes := md5.Sum([]byte(sketchPath)) +// GenBuildPath generates a suitable name for the build folder. +// The sketchPath, if not nil, is also used to furhter differentiate build paths. +func GenBuildPath(sketchPath *paths.Path) *paths.Path { + path := "" + if sketchPath != nil { + path = sketchPath.String() + } + md5SumBytes := md5.Sum([]byte(path)) md5Sum := strings.ToUpper(hex.EncodeToString(md5SumBytes[:])) - - return filepath.Join(os.TempDir(), "arduino-sketch-"+md5Sum) + return paths.TempDir().Join("arduino-sketch-" + md5Sum) } // EnsureBuildPathExists creates the build path if doesn't already exists. diff --git a/arduino/builder/builder_test.go b/arduino/builder/builder_test.go index 2048f75876d..f172ff9f469 100644 --- a/arduino/builder/builder_test.go +++ b/arduino/builder/builder_test.go @@ -23,6 +23,7 @@ import ( "testing" "github.com/arduino/arduino-cli/arduino/builder" + "github.com/arduino/go-paths-helper" "github.com/stretchr/testify/assert" ) @@ -36,7 +37,10 @@ func tmpDirOrDie() string { func TestGenBuildPath(t *testing.T) { want := filepath.Join(os.TempDir(), "arduino-sketch-ACBD18DB4CC2F85CEDEF654FCCC4A4D8") - assert.Equal(t, want, builder.GenBuildPath("foo")) + assert.Equal(t, want, builder.GenBuildPath(paths.New("foo")).String()) + + want = filepath.Join(os.TempDir(), "arduino-sketch-D41D8CD98F00B204E9800998ECF8427E") + assert.Equal(t, want, builder.GenBuildPath(nil).String()) } func TestEnsureBuildPathExists(t *testing.T) { diff --git a/commands/compile/compile.go b/commands/compile/compile.go index 9b0a1f380f9..c61ac091bd3 100644 --- a/commands/compile/compile.go +++ b/commands/compile/compile.go @@ -95,7 +95,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W } if toolsDir, err := config.BundleToolsDirectories(); err == nil { - builderCtx.ToolsDirs = toolsDir + builderCtx.BuiltInToolsDirs = toolsDir } else { return nil, fmt.Errorf("cannot get bundled tools directories: %s", err) } diff --git a/go.mod b/go.mod index 048f2ce8093..8427598d575 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( bou.ke/monkey v1.0.1 github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c - github.com/arduino/go-paths-helper v0.0.0-20190214132331-c3c98d1bf2e1 + github.com/arduino/go-paths-helper v1.0.1 github.com/arduino/go-properties-orderedmap v0.0.0-20190828172252-05018b28ff6c github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b @@ -43,6 +43,7 @@ require ( go.bug.st/serial.v1 v0.0.0-20180827123349-5f7892a7bb45 golang.org/x/net v0.0.0-20190311183353-d8887717615a golang.org/x/text v0.3.0 + google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190327125643-d831d65fe17d // indirect google.golang.org/grpc v1.21.1 gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect diff --git a/go.sum b/go.sum index 4eba75e81d5..cf37ea685b6 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c h1:agh2JT9 github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c/go.mod h1:HK7SpkEax/3P+0w78iRQx1sz1vCDYYw9RXwHjQTB5i8= github.com/arduino/go-paths-helper v0.0.0-20190214132331-c3c98d1bf2e1 h1:S0NpDSqjlkNA510vmRCP5Cq9mPgu3rWDSdeN4SI1Mwc= github.com/arduino/go-paths-helper v0.0.0-20190214132331-c3c98d1bf2e1/go.mod h1:OGL+FS3aTrS01YsBAJJhkGuxtEGsFRSgZYo8b3vefdc= +github.com/arduino/go-paths-helper v1.0.1 h1:utYXLM2RfFlc9qp/MJTIYp3t6ux/xM6mWjeEb/WLK4Q= +github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck= github.com/arduino/go-properties-orderedmap v0.0.0-20190828172252-05018b28ff6c h1:4z4PJqNH8WGXtm9ix2muUOAP7gxTGBOdQTuKEDyCnsA= github.com/arduino/go-properties-orderedmap v0.0.0-20190828172252-05018b28ff6c/go.mod h1:kiSuHm7yz3chiy8rb2MphC7ECn3MlkQFAIe4SXmQg6o= github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b h1:9hDi4F2st6dbLC3y4i02zFT5quS4X6iioWifGlVwfy4= diff --git a/legacy/builder/builder.go b/legacy/builder/builder.go index 39be76bbafb..98efad782c0 100644 --- a/legacy/builder/builder.go +++ b/legacy/builder/builder.go @@ -43,7 +43,6 @@ import ( "github.com/arduino/arduino-cli/legacy/builder/phases" "github.com/arduino/arduino-cli/legacy/builder/types" "github.com/arduino/arduino-cli/legacy/builder/utils" - "github.com/arduino/go-paths-helper" ) var MAIN_FILE_VALID_EXTENSIONS = map[string]bool{".ino": true, ".pde": true} @@ -58,7 +57,7 @@ type Builder struct{} func (s *Builder) Run(ctx *types.Context) error { if ctx.BuildPath == nil { - ctx.BuildPath = paths.New(bldr.GenBuildPath(ctx.SketchLocation.String())) + ctx.BuildPath = bldr.GenBuildPath(ctx.SketchLocation) } if err := bldr.EnsureBuildPathExists(ctx.BuildPath.String()); err != nil { @@ -150,7 +149,7 @@ type Preprocess struct{} func (s *Preprocess) Run(ctx *types.Context) error { if ctx.BuildPath == nil { - ctx.BuildPath = paths.New(bldr.GenBuildPath(ctx.SketchLocation.String())) + ctx.BuildPath = bldr.GenBuildPath(ctx.SketchLocation) } if err := bldr.EnsureBuildPathExists(ctx.BuildPath.String()); err != nil { @@ -186,7 +185,7 @@ type ParseHardwareAndDumpBuildProperties struct{} func (s *ParseHardwareAndDumpBuildProperties) Run(ctx *types.Context) error { if ctx.BuildPath == nil { - ctx.BuildPath = paths.New(bldr.GenBuildPath(ctx.SketchLocation.String())) + ctx.BuildPath = bldr.GenBuildPath(ctx.SketchLocation) } commands := []types.Command{ diff --git a/legacy/builder/container_setup.go b/legacy/builder/container_setup.go index b5d5eef1fc0..01c5f655342 100644 --- a/legacy/builder/container_setup.go +++ b/legacy/builder/container_setup.go @@ -63,19 +63,21 @@ func (s *ContainerSetupHardwareToolsLibsSketchAndProps) Run(ctx *types.Context) } } - // get abs path to sketch - sketchLocation, err := ctx.SketchLocation.Abs() - if err != nil { - return i18n.WrapError(err) - } + if ctx.SketchLocation != nil { + // get abs path to sketch + sketchLocation, err := ctx.SketchLocation.Abs() + if err != nil { + return i18n.WrapError(err) + } - // load sketch - sketch, err := bldr.SketchLoad(sketchLocation.String(), ctx.BuildPath.String()) - if err != nil { - return i18n.WrapError(err) + // load sketch + sketch, err := bldr.SketchLoad(sketchLocation.String(), ctx.BuildPath.String()) + if err != nil { + return i18n.WrapError(err) + } + ctx.SketchLocation = paths.New(sketch.MainFile.Path) + ctx.Sketch = types.SketchToLegacy(sketch) } - ctx.SketchLocation = paths.New(sketch.MainFile.Path) - ctx.Sketch = types.SketchToLegacy(sketch) commands = []types.Command{ &SetupBuildProperties{}, diff --git a/legacy/builder/grpc/rpc.go b/legacy/builder/grpc/rpc.go index fd38a58f9ca..d135d03900a 100644 --- a/legacy/builder/grpc/rpc.go +++ b/legacy/builder/grpc/rpc.go @@ -57,7 +57,7 @@ type builderServer struct { } func (s *builderServer) watch() { - folders := []paths.PathList{s.ctx.HardwareDirs, s.ctx.ToolsDirs, s.ctx.BuiltInLibrariesDirs, s.ctx.OtherLibrariesDirs} + folders := []paths.PathList{s.ctx.HardwareDirs, s.ctx.BuiltInToolsDirs, s.ctx.BuiltInLibrariesDirs, s.ctx.OtherLibrariesDirs} for _, category := range folders { for _, folder := range category { @@ -84,7 +84,7 @@ func (s *builderServer) DropCache(ctx context.Context, args *pb.VerboseParams) ( func (s *builderServer) Autocomplete(ctx context.Context, args *pb.BuildParams) (*pb.Response, error) { s.ctx.HardwareDirs = paths.NewPathList(strings.Split(args.HardwareFolders, ",")...) - s.ctx.ToolsDirs = paths.NewPathList(strings.Split(args.ToolsFolders, ",")...) + s.ctx.BuiltInToolsDirs = paths.NewPathList(strings.Split(args.ToolsFolders, ",")...) s.ctx.BuiltInLibrariesDirs = paths.NewPathList(strings.Split(args.BuiltInLibrariesFolders, ",")...) s.ctx.OtherLibrariesDirs = paths.NewPathList(strings.Split(args.OtherLibrariesFolders, ",")...) s.ctx.SketchLocation = paths.New(args.SketchLocation) @@ -128,7 +128,7 @@ func (s *builderServer) Autocomplete(ctx context.Context, args *pb.BuildParams) func (s *builderServer) Build(args *pb.BuildParams, stream pb.Builder_BuildServer) error { s.ctx.HardwareDirs = paths.NewPathList(strings.Split(args.HardwareFolders, ",")...) - s.ctx.ToolsDirs = paths.NewPathList(strings.Split(args.ToolsFolders, ",")...) + s.ctx.BuiltInToolsDirs = paths.NewPathList(strings.Split(args.ToolsFolders, ",")...) s.ctx.BuiltInLibrariesDirs = paths.NewPathList(strings.Split(args.BuiltInLibrariesFolders, ",")...) s.ctx.OtherLibrariesDirs = paths.NewPathList(strings.Split(args.OtherLibrariesFolders, ",")...) s.ctx.SketchLocation = paths.New(args.SketchLocation) diff --git a/legacy/builder/test/builder_test.go b/legacy/builder/test/builder_test.go index 4f2d5f582b1..b7dc59cada9 100644 --- a/legacy/builder/test/builder_test.go +++ b/legacy/builder/test/builder_test.go @@ -242,7 +242,7 @@ func TestBuilderBridgeRedBearLab(t *testing.T) { ctx := prepareBuilderTestContext(t, paths.New("downloaded_libraries", "Bridge", "examples", "Bridge", "Bridge.ino"), "RedBearLab:avr:blend") ctx.HardwareDirs = append(ctx.HardwareDirs, paths.New("downloaded_board_manager_stuff")) - ctx.ToolsDirs = append(ctx.ToolsDirs, paths.New("downloaded_board_manager_stuff")) + ctx.BuiltInToolsDirs = append(ctx.BuiltInToolsDirs, paths.New("downloaded_board_manager_stuff")) buildPath := SetupBuildPath(t, ctx) defer buildPath.RemoveAll() @@ -277,7 +277,7 @@ func TestBuilderSketchNoFunctions(t *testing.T) { ctx := prepareBuilderTestContext(t, paths.New("sketch_no_functions", "main.ino"), "RedBearLab:avr:blend") ctx.HardwareDirs = append(ctx.HardwareDirs, paths.New("downloaded_board_manager_stuff")) - ctx.ToolsDirs = append(ctx.ToolsDirs, paths.New("downloaded_board_manager_stuff")) + ctx.BuiltInToolsDirs = append(ctx.BuiltInToolsDirs, paths.New("downloaded_board_manager_stuff")) buildPath := SetupBuildPath(t, ctx) defer buildPath.RemoveAll() @@ -293,7 +293,7 @@ func TestBuilderSketchWithBackup(t *testing.T) { ctx := prepareBuilderTestContext(t, paths.New("sketch_with_backup_files", "sketch.ino"), "arduino:avr:uno") ctx.HardwareDirs = append(ctx.HardwareDirs, paths.New("downloaded_board_manager_stuff")) - ctx.ToolsDirs = append(ctx.ToolsDirs, paths.New("downloaded_board_manager_stuff")) + ctx.BuiltInToolsDirs = append(ctx.BuiltInToolsDirs, paths.New("downloaded_board_manager_stuff")) buildPath := SetupBuildPath(t, ctx) defer buildPath.RemoveAll() diff --git a/legacy/builder/test/create_build_options_map_test.go b/legacy/builder/test/create_build_options_map_test.go index eabbcec343d..9361ed08265 100644 --- a/legacy/builder/test/create_build_options_map_test.go +++ b/legacy/builder/test/create_build_options_map_test.go @@ -41,7 +41,7 @@ import ( func TestCreateBuildOptionsMap(t *testing.T) { ctx := &types.Context{ HardwareDirs: paths.NewPathList("hardware", "hardware2"), - ToolsDirs: paths.NewPathList("tools"), + BuiltInToolsDirs: paths.NewPathList("tools"), OtherLibrariesDirs: paths.NewPathList("libraries"), SketchLocation: paths.New("sketchLocation"), FQBN: parseFQBN(t, "my:nice:fqbn"), @@ -55,15 +55,15 @@ func TestCreateBuildOptionsMap(t *testing.T) { err := create.Run(ctx) NoError(t, err) - require.Equal(t, "{\n"+ - " \"additionalFiles\": \"\",\n"+ - " \"builtInLibrariesFolders\": \"\",\n"+ - " \"customBuildProperties\": \"\",\n"+ - " \"fqbn\": \"my:nice:fqbn\",\n"+ - " \"hardwareFolders\": \"hardware,hardware2\",\n"+ - " \"otherLibrariesFolders\": \"libraries\",\n"+ - " \"runtime.ide.version\": \"ideVersion\",\n"+ - " \"sketchLocation\": \"sketchLocation\",\n"+ - " \"toolsFolders\": \"tools\"\n"+ - "}", ctx.BuildOptionsJson) + require.Equal(t, `{ + "additionalFiles": "", + "builtInLibrariesFolders": "", + "builtInToolsFolders": "tools", + "customBuildProperties": "", + "fqbn": "my:nice:fqbn", + "hardwareFolders": "hardware,hardware2", + "otherLibrariesFolders": "libraries", + "runtime.ide.version": "ideVersion", + "sketchLocation": "sketchLocation" +}`, ctx.BuildOptionsJson) } diff --git a/legacy/builder/test/load_vid_pid_specific_properties_test.go b/legacy/builder/test/load_vid_pid_specific_properties_test.go index 7ff250207e1..cee99439076 100644 --- a/legacy/builder/test/load_vid_pid_specific_properties_test.go +++ b/legacy/builder/test/load_vid_pid_specific_properties_test.go @@ -44,7 +44,7 @@ func TestLoadVIDPIDSpecificPropertiesWhenNoVIDPIDAreProvided(t *testing.T) { ctx := &types.Context{ HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"), - ToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"), + BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"), SketchLocation: paths.New("sketch1", "sketch.ino"), FQBN: parseFQBN(t, "arduino:avr:micro"), ArduinoAPIVersion: "10600", @@ -74,7 +74,7 @@ func TestLoadVIDPIDSpecificProperties(t *testing.T) { ctx := &types.Context{ HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"), - ToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"), + BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"), SketchLocation: paths.New("sketch1", "sketch.ino"), FQBN: parseFQBN(t, "arduino:avr:micro"), ArduinoAPIVersion: "10600", diff --git a/legacy/builder/test/merge_sketch_with_bootloader_test.go b/legacy/builder/test/merge_sketch_with_bootloader_test.go index 4ad70c8e137..29d6cae0ea6 100644 --- a/legacy/builder/test/merge_sketch_with_bootloader_test.go +++ b/legacy/builder/test/merge_sketch_with_bootloader_test.go @@ -46,7 +46,7 @@ func TestMergeSketchWithBootloader(t *testing.T) { ctx := &types.Context{ HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"), - ToolsDirs: paths.NewPathList("downloaded_tools"), + BuiltInToolsDirs: paths.NewPathList("downloaded_tools"), BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"), OtherLibrariesDirs: paths.NewPathList("libraries"), SketchLocation: paths.New("sketch1", "sketch.ino"), @@ -88,7 +88,7 @@ func TestMergeSketchWithBootloaderSketchInBuildPath(t *testing.T) { ctx := &types.Context{ HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"), - ToolsDirs: paths.NewPathList("downloaded_tools"), + BuiltInToolsDirs: paths.NewPathList("downloaded_tools"), BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"), OtherLibrariesDirs: paths.NewPathList("libraries"), SketchLocation: paths.New("sketch1", "sketch.ino"), @@ -130,7 +130,7 @@ func TestMergeSketchWithBootloaderWhenNoBootloaderAvailable(t *testing.T) { ctx := &types.Context{ HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"), - ToolsDirs: paths.NewPathList("downloaded_tools"), + BuiltInToolsDirs: paths.NewPathList("downloaded_tools"), BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"), OtherLibrariesDirs: paths.NewPathList("libraries"), SketchLocation: paths.New("sketch1", "sketch.ino"), @@ -168,7 +168,7 @@ func TestMergeSketchWithBootloaderPathIsParameterized(t *testing.T) { ctx := &types.Context{ HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware", "user_hardware"), - ToolsDirs: paths.NewPathList("downloaded_tools"), + BuiltInToolsDirs: paths.NewPathList("downloaded_tools"), BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"), OtherLibrariesDirs: paths.NewPathList("libraries"), SketchLocation: paths.New("sketch1", "sketch.ino"), diff --git a/legacy/builder/test/store_build_options_map_test.go b/legacy/builder/test/store_build_options_map_test.go index 79ec8400fb9..0e0296c1bdb 100644 --- a/legacy/builder/test/store_build_options_map_test.go +++ b/legacy/builder/test/store_build_options_map_test.go @@ -42,7 +42,7 @@ import ( func TestStoreBuildOptionsMap(t *testing.T) { ctx := &types.Context{ HardwareDirs: paths.NewPathList("hardware"), - ToolsDirs: paths.NewPathList("tools"), + BuiltInToolsDirs: paths.NewPathList("tools"), BuiltInLibrariesDirs: paths.NewPathList("built-in libraries"), OtherLibrariesDirs: paths.NewPathList("libraries"), SketchLocation: paths.New("sketchLocation"), @@ -73,15 +73,15 @@ func TestStoreBuildOptionsMap(t *testing.T) { bytes, err := buildPath.Join(constants.BUILD_OPTIONS_FILE).ReadFile() NoError(t, err) - require.Equal(t, "{\n"+ - " \"additionalFiles\": \"\",\n"+ - " \"builtInLibrariesFolders\": \"built-in libraries\",\n"+ - " \"customBuildProperties\": \"custom=prop\",\n"+ - " \"fqbn\": \"my:nice:fqbn\",\n"+ - " \"hardwareFolders\": \"hardware\",\n"+ - " \"otherLibrariesFolders\": \"libraries\",\n"+ - " \"runtime.ide.version\": \"ideVersion\",\n"+ - " \"sketchLocation\": \"sketchLocation\",\n"+ - " \"toolsFolders\": \"tools\"\n"+ - "}", string(bytes)) + require.Equal(t, `{ + "additionalFiles": "", + "builtInLibrariesFolders": "built-in libraries", + "builtInToolsFolders": "tools", + "customBuildProperties": "custom=prop", + "fqbn": "my:nice:fqbn", + "hardwareFolders": "hardware", + "otherLibrariesFolders": "libraries", + "runtime.ide.version": "ideVersion", + "sketchLocation": "sketchLocation" +}`, string(bytes)) } diff --git a/legacy/builder/tools_loader.go b/legacy/builder/tools_loader.go index c7bd8be6469..82b5256f0da 100644 --- a/legacy/builder/tools_loader.go +++ b/legacy/builder/tools_loader.go @@ -30,9 +30,6 @@ package builder import ( - "fmt" - "strings" - "github.com/arduino/arduino-cli/legacy/builder/types" "github.com/arduino/go-paths-helper" ) @@ -45,28 +42,9 @@ func (s *ToolsLoader) Run(ctx *types.Context) error { return nil } - folders := paths.NewPathList() builtinFolders := paths.NewPathList() - - if ctx.BuiltInToolsDirs != nil || len(ctx.BuiltInLibrariesDirs) == 0 { - folders = ctx.ToolsDirs + if ctx.BuiltInToolsDirs != nil { builtinFolders = ctx.BuiltInToolsDirs - } else { - // Auto-detect built-in tools folders (for arduino-builder backward compatibility) - // this is a deprecated feature and will be removed in the future - builtinHardwareFolder, err := ctx.BuiltInLibrariesDirs[0].Join("..").Abs() - - if err != nil { - fmt.Println("Error detecting ") - } - - for _, folder := range ctx.ToolsDirs { - if !strings.Contains(folder.String(), builtinHardwareFolder.String()) { // TODO: make a function to check for subfolders - folders = append(folders, folder) - } else { - builtinFolders = append(builtinFolders, folder) - } - } } pm := ctx.PackageManager diff --git a/legacy/builder/types/context.go b/legacy/builder/types/context.go index 1a8a6b5c788..8238ed98c3f 100644 --- a/legacy/builder/types/context.go +++ b/legacy/builder/types/context.go @@ -24,7 +24,6 @@ type ProgressStruct struct { type Context struct { // Build options HardwareDirs paths.PathList - ToolsDirs paths.PathList BuiltInToolsDirs paths.PathList BuiltInLibrariesDirs paths.PathList OtherLibrariesDirs paths.PathList @@ -122,7 +121,7 @@ type Context struct { func (ctx *Context) ExtractBuildOptions() *properties.Map { opts := properties.NewMap() opts.Set("hardwareFolders", strings.Join(ctx.HardwareDirs.AsStrings(), ",")) - opts.Set("toolsFolders", strings.Join(ctx.ToolsDirs.AsStrings(), ",")) + opts.Set("builtInToolsFolders", strings.Join(ctx.BuiltInToolsDirs.AsStrings(), ",")) opts.Set("builtInLibrariesFolders", strings.Join(ctx.BuiltInLibrariesDirs.AsStrings(), ",")) opts.Set("otherLibrariesFolders", strings.Join(ctx.OtherLibrariesDirs.AsStrings(), ",")) opts.SetPath("sketchLocation", ctx.SketchLocation) @@ -146,7 +145,7 @@ func (ctx *Context) ExtractBuildOptions() *properties.Map { func (ctx *Context) InjectBuildOptions(opts *properties.Map) { ctx.HardwareDirs = paths.NewPathList(strings.Split(opts.Get("hardwareFolders"), ",")...) - ctx.ToolsDirs = paths.NewPathList(strings.Split(opts.Get("toolsFolders"), ",")...) + ctx.BuiltInToolsDirs = paths.NewPathList(strings.Split(opts.Get("builtInToolsFolders"), ",")...) ctx.BuiltInLibrariesDirs = paths.NewPathList(strings.Split(opts.Get("builtInLibrariesFolders"), ",")...) ctx.OtherLibrariesDirs = paths.NewPathList(strings.Split(opts.Get("otherLibrariesFolders"), ",")...) ctx.SketchLocation = opts.GetPath("sketchLocation")