Skip to content

Commit 7f7eb7a

Browse files
author
Federico Fissore
committed
Adding -built-in-libraries command line param: this way built in libraries,
less important than those coming with cores and stored into user's sketchbook, are correctly prioritized Signed-off-by: Federico Fissore <[email protected]>
1 parent 2058479 commit 7f7eb7a

15 files changed

+205
-115
lines changed

Diff for: main.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const FLAG_DUMP_PREFS = "dump-prefs"
5454
const FLAG_BUILD_OPTIONS_FILE = "build-options-file"
5555
const FLAG_HARDWARE = "hardware"
5656
const FLAG_TOOLS = "tools"
57+
const FLAG_BUILT_IN_LIBRARIES = "built-in-libraries"
5758
const FLAG_LIBRARIES = "libraries"
5859
const FLAG_PREFS = "prefs"
5960
const FLAG_FQBN = "fqbn"
@@ -100,6 +101,7 @@ var dumpPrefsFlag *bool
100101
var buildOptionsFileFlag *string
101102
var hardwareFoldersFlag slice
102103
var toolsFoldersFlag slice
104+
var librariesBuiltInFoldersFlag slice
103105
var librariesFoldersFlag slice
104106
var customBuildPropertiesFlag slice
105107
var fqbnFlag *string
@@ -119,6 +121,7 @@ func init() {
119121
buildOptionsFileFlag = flag.String(FLAG_BUILD_OPTIONS_FILE, "", "Instead of specifying --"+FLAG_HARDWARE+", --"+FLAG_TOOLS+" etc every time, you can load all such options from a file")
120122
flag.Var(&hardwareFoldersFlag, FLAG_HARDWARE, "Specify a 'hardware' folder. Can be added multiple times for specifying multiple 'hardware' folders")
121123
flag.Var(&toolsFoldersFlag, FLAG_TOOLS, "Specify a 'tools' folder. Can be added multiple times for specifying multiple 'tools' folders")
124+
flag.Var(&librariesBuiltInFoldersFlag, FLAG_BUILT_IN_LIBRARIES, "Specify a built-in 'libraries' folder. These are low priority libraries. Can be added multiple times for specifying multiple built-in 'libraries' folders")
122125
flag.Var(&librariesFoldersFlag, FLAG_LIBRARIES, "Specify a 'libraries' folder. Can be added multiple times for specifying multiple 'libraries' folders")
123126
flag.Var(&customBuildPropertiesFlag, FLAG_PREFS, "Specify a custom preference. Can be added multiple times for specifying multiple custom preferences")
124127
fqbnFlag = flag.String(FLAG_FQBN, "", "fully qualified board name")
@@ -195,7 +198,14 @@ func main() {
195198
return
196199
}
197200

198-
err, printStackTrace = setContextSliceKeyOrLoadItFromOptions(context, librariesFoldersFlag, buildOptions, constants.CTX_LIBRARIES_FOLDERS, FLAG_LIBRARIES, false)
201+
err, printStackTrace = setContextSliceKeyOrLoadItFromOptions(context, librariesFoldersFlag, buildOptions, constants.CTX_OTHER_LIBRARIES_FOLDERS, FLAG_LIBRARIES, false)
202+
if err != nil {
203+
printError(err, printStackTrace)
204+
defer os.Exit(1)
205+
return
206+
}
207+
208+
err, printStackTrace = setContextSliceKeyOrLoadItFromOptions(context, librariesBuiltInFoldersFlag, buildOptions, constants.CTX_BUILT_IN_LIBRARIES_FOLDERS, FLAG_BUILT_IN_LIBRARIES, false)
199209
if err != nil {
200210
printError(err, printStackTrace)
201211
defer os.Exit(1)

Diff for: src/arduino.cc/builder/constants/constants.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const CTX_BUILD_OPTIONS_PREVIOUS_JSON = "buildOptionsPreviousJson"
8181
const CTX_BUILD_PATH = "buildPath"
8282
const CTX_BUILD_PROPERTIES = "buildProperties"
8383
const CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION = "runtime.ide.version"
84+
const CTX_BUILT_IN_LIBRARIES_FOLDERS = "builtInLibrariesFolders"
8485
const CTX_COLLECTED_SOURCE_FILES_QUEUE = "collectedSourceFilesQueue"
8586
const CTX_CORE_BUILD_PATH = "coreBuildPath"
8687
const CTX_CTAGS_OUTPUT = "ctagsOutput"
@@ -108,6 +109,7 @@ const CTX_LINE_OFFSET = "lineOffset"
108109
const CTX_LOGGER = "logger"
109110
const CTX_OBJECT_FILES_LIBRARIES = "objectFilesLibraries"
110111
const CTX_OBJECT_FILES_SKETCH = "objectFilesSketch"
112+
const CTX_OTHER_LIBRARIES_FOLDERS = "otherLibrariesFolders"
111113
const CTX_PLATFORM_KEYS_REWRITE = "platformKeysRewrite"
112114
const CTX_PREPROC_PATH = "preprocPath"
113115
const CTX_PROTOTYPE_SECTION = "prototypeSection"
@@ -194,8 +196,6 @@ const LIBRARY_SENTENCE = "sentence"
194196
const LIBRARY_URL = "url"
195197
const LIBRARY_VERSION = "version"
196198
const MSG_ARCH_FOLDER_NOT_SUPPORTED = "'arch' folder is no longer supported! See http://goo.gl/gfFJzU for more information"
197-
const MSG_WRONG_PROPERTIES_FILE = "Property line '{0}' in file {1} is invalid"
198-
const MSG_WRONG_PROPERTIES = "Property line '{0}' is invalid"
199199
const MSG_BOARD_UNKNOWN = "Board {0} (platform {1}, package {2}) is unknown"
200200
const MSG_BOOTLOADER_FILE_MISSING = "Bootloader file specified but missing: {0}"
201201
const MSG_BUILD_OPTIONS_CHANGED = "Build options changed, rebuilding all"
@@ -229,6 +229,8 @@ const MSG_WARNING_LIB_INVALID_CATEGORY = "WARNING: Category '{0}' in library {1}
229229
const MSG_WARNING_PLATFORM_MISSING_VALUE = "Warning: platform.txt from core '{0}' misses property '{1}', using default value '{2}'. Consider upgrading this core."
230230
const MSG_WARNING_PLATFORM_OLD_VALUES = "Warning: platform.txt from core '{0}' contains deprecated {1}, automatically converted to {2}. Consider upgrading this core."
231231
const MSG_WARNING_SPURIOUS_FILE_IN_LIB = "WARNING: Spurious {0} folder in '{1}' library"
232+
const MSG_WRONG_PROPERTIES_FILE = "Property line '{0}' in file {1} is invalid"
233+
const MSG_WRONG_PROPERTIES = "Property line '{0}' is invalid"
232234
const PACKAGE_NAME = "name"
233235
const PACKAGE_TOOLS = "tools"
234236
const PLATFORM_ARCHITECTURE = "architecture"

Diff for: src/arduino.cc/builder/create_build_options_map.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ func (s *CreateBuildOptionsMap) Run(context map[string]interface{}) error {
4545
buildOptionsMapKeys := []string{
4646
constants.CTX_HARDWARE_FOLDERS,
4747
constants.CTX_TOOLS_FOLDERS,
48-
constants.CTX_LIBRARIES_FOLDERS,
48+
constants.CTX_BUILT_IN_LIBRARIES_FOLDERS,
49+
constants.CTX_OTHER_LIBRARIES_FOLDERS,
4950
constants.CTX_FQBN,
5051
constants.CTX_SKETCH_LOCATION,
5152
constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION,

Diff for: src/arduino.cc/builder/includes_to_include_folders.go

+17-40
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (s *IncludesToIncludeFolders) Run(context map[string]interface{}) error {
5757
if utils.MapHas(context, constants.CTX_IMPORTED_LIBRARIES) {
5858
importedLibraries = context[constants.CTX_IMPORTED_LIBRARIES].([]*types.Library)
5959
}
60-
newlyImportedLibraries, err := resolveLibraries(includes, headerToLibraries, importedLibraries, []*types.Platform{platform, actualPlatform}, libraryResolutionResults)
60+
newlyImportedLibraries, err := resolveLibraries(includes, headerToLibraries, importedLibraries, []*types.Platform{actualPlatform, platform}, libraryResolutionResults)
6161
if err != nil {
6262
return utils.WrapError(err)
6363
}
@@ -114,7 +114,7 @@ func resolveLibraries(includes []string, headerToLibraries map[string][]*types.L
114114
}
115115

116116
func resolveLibrary(header string, headerToLibraries map[string][]*types.Library, markImportedLibrary map[*types.Library]bool, platforms []*types.Platform, libraryResolutionResults map[string]types.LibraryResolutionResult) {
117-
libraries := headerToLibraries[header]
117+
libraries := append([]*types.Library{}, headerToLibraries[header]...)
118118

119119
if libraries == nil || len(libraries) == 0 {
120120
return
@@ -129,17 +129,24 @@ func resolveLibrary(header string, headerToLibraries map[string][]*types.Library
129129
return
130130
}
131131

132+
reverse(libraries)
133+
132134
librariesInPlatforms := librariesInSomePlatform(libraries, platforms)
133-
librariesOutsidePlatforms := filterOutLibrariesFrom(libraries, librariesInPlatforms)
134135

135-
library := findBestLibraryOutsideAnyPlatform(header, librariesOutsidePlatforms, platforms)
136+
var library *types.Library
137+
138+
for _, platform := range platforms {
139+
if platform != nil && library == nil {
140+
library = findBestLibraryWithHeader(header, librariesCompatibleWithPlatform(libraries, platform))
141+
}
142+
}
136143

137144
if library == nil {
138-
library = findBestLibraryInPlatforms(header, librariesInPlatforms, platforms)
145+
library = findBestLibraryWithHeader(header, libraries)
139146
}
140147

141148
if library == nil {
142-
library = libraries[len(libraries)-1]
149+
library = libraries[0]
143150
}
144151

145152
library = useAlreadyImportedLibraryWithSameNameIfExists(library, markImportedLibrary)
@@ -150,31 +157,11 @@ func resolveLibrary(header string, headerToLibraries map[string][]*types.Library
150157
markImportedLibrary[library] = true
151158
}
152159

153-
func findBestLibraryInPlatforms(header string, librariesInPlatforms []*types.Library, platforms []*types.Platform) *types.Library {
154-
for _, platform := range platforms {
155-
if platform != nil {
156-
librariesWithinSpecifiedPlatform := librariesWithinPlatform(librariesInPlatforms, platform)
157-
library := findBestLibraryWithHeader(header, librariesWithinSpecifiedPlatform)
158-
if library != nil {
159-
return library
160-
}
161-
}
162-
}
163-
164-
return nil
165-
}
166-
167-
func findBestLibraryOutsideAnyPlatform(header string, librariesOutsidePlatforms []*types.Library, platforms []*types.Platform) *types.Library {
168-
for _, platform := range platforms {
169-
if platform != nil {
170-
library := findBestLibraryWithHeader(header, librariesCompatibleWithPlatform(librariesOutsidePlatforms, platform))
171-
if library != nil {
172-
return library
173-
}
174-
}
160+
//facepalm. sort.Reverse needs an Interface that implements Len/Less/Swap. It's a slice! What else for reversing it?!?
161+
func reverse(data []*types.Library) {
162+
for i, j := 0, len(data)-1; i < j; i, j = i+1, j-1 {
163+
data[i], data[j] = data[j], data[i]
175164
}
176-
177-
return findBestLibraryWithHeader(header, librariesOutsidePlatforms)
178165
}
179166

180167
func librariesInSomePlatform(libraries []*types.Library, platforms []*types.Platform) []*types.Library {
@@ -218,16 +205,6 @@ func filterOutLibraryFrom(libraries []*types.Library, libraryToRemove *types.Lib
218205
return filteredOutLibraries
219206
}
220207

221-
func filterOutLibrariesFrom(libraries []*types.Library, librariesToRemove []*types.Library) []*types.Library {
222-
filteredOutLibraries := []*types.Library{}
223-
for _, lib := range libraries {
224-
if findLibraryIn(librariesToRemove, lib) == nil {
225-
filteredOutLibraries = append(filteredOutLibraries, lib)
226-
}
227-
}
228-
return filteredOutLibraries
229-
}
230-
231208
func findLibraryIn(libraries []*types.Library, library *types.Library) *types.Library {
232209
for _, lib := range libraries {
233210
if lib == library {

Diff for: src/arduino.cc/builder/libraries_loader.go

+22-19
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,43 @@ import (
4343
type LibrariesLoader struct{}
4444

4545
func (s *LibrariesLoader) Run(context map[string]interface{}) error {
46-
librariesFolders := []string{}
47-
if utils.MapHas(context, constants.CTX_LIBRARIES_FOLDERS) {
48-
librariesFolders = context[constants.CTX_LIBRARIES_FOLDERS].([]string)
49-
}
50-
51-
platform := context[constants.CTX_TARGET_PLATFORM].(*types.Platform)
52-
debugLevel := utils.DebugLevel(context)
53-
logger := context[constants.CTX_LOGGER].(i18n.Logger)
46+
sortedLibrariesFolders := []string{}
5447

55-
librariesFolders, err := utils.AbsolutizePaths(librariesFolders)
48+
builtInLibrariesFolders := []string{}
49+
if utils.MapHas(context, constants.CTX_BUILT_IN_LIBRARIES_FOLDERS) {
50+
builtInLibrariesFolders = context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS].([]string)
51+
}
52+
builtInLibrariesFolders, err := utils.AbsolutizePaths(builtInLibrariesFolders)
5653
if err != nil {
5754
return utils.WrapError(err)
5855
}
56+
sortedLibrariesFolders = utils.AppendIfNotPresent(sortedLibrariesFolders, builtInLibrariesFolders...)
5957

60-
librariesFolders = prependPathToLibrariesFolders(librariesFolders, filepath.Join(platform.Folder, constants.FOLDER_LIBRARIES))
58+
platform := context[constants.CTX_TARGET_PLATFORM].(*types.Platform)
59+
debugLevel := utils.DebugLevel(context)
60+
logger := context[constants.CTX_LOGGER].(i18n.Logger)
6161

6262
actualPlatform := context[constants.CTX_ACTUAL_PLATFORM].(*types.Platform)
6363
if actualPlatform != platform {
64-
librariesFolders = prependPathToLibrariesFolders(librariesFolders, filepath.Join(actualPlatform.Folder, constants.FOLDER_LIBRARIES))
64+
sortedLibrariesFolders = appendPathToLibrariesFolders(sortedLibrariesFolders, filepath.Join(actualPlatform.Folder, constants.FOLDER_LIBRARIES))
6565
}
6666

67+
sortedLibrariesFolders = appendPathToLibrariesFolders(sortedLibrariesFolders, filepath.Join(platform.Folder, constants.FOLDER_LIBRARIES))
68+
69+
librariesFolders := []string{}
70+
if utils.MapHas(context, constants.CTX_OTHER_LIBRARIES_FOLDERS) {
71+
librariesFolders = context[constants.CTX_OTHER_LIBRARIES_FOLDERS].([]string)
72+
}
6773
librariesFolders, err = utils.AbsolutizePaths(librariesFolders)
6874
if err != nil {
6975
return utils.WrapError(err)
7076
}
77+
sortedLibrariesFolders = utils.AppendIfNotPresent(sortedLibrariesFolders, librariesFolders...)
7178

72-
context[constants.CTX_LIBRARIES_FOLDERS] = librariesFolders
79+
context[constants.CTX_LIBRARIES_FOLDERS] = sortedLibrariesFolders
7380

7481
var libraries []*types.Library
75-
for _, libraryFolder := range librariesFolders {
82+
for _, libraryFolder := range sortedLibrariesFolders {
7683
subFolders, err := utils.ReadDirFiltered(libraryFolder, utils.FilterDirs)
7784
if err != nil {
7885
return utils.WrapError(err)
@@ -208,14 +215,10 @@ func makeLegacyLibrary(libraryFolder string) (*types.Library, error) {
208215
return library, nil
209216
}
210217

211-
func prependPathToLibrariesFolders(librariesFolders []string, newLibrariesFolder string) []string {
218+
func appendPathToLibrariesFolders(librariesFolders []string, newLibrariesFolder string) []string {
212219
if stat, err := os.Stat(newLibrariesFolder); os.IsNotExist(err) || !stat.IsDir() {
213220
return librariesFolders
214221
}
215222

216-
if utils.SliceContains(librariesFolders, newLibrariesFolder) {
217-
return librariesFolders
218-
}
219-
220-
return append([]string{newLibrariesFolder}, librariesFolders...)
223+
return utils.AppendIfNotPresent(librariesFolders, newLibrariesFolder)
221224
}

Diff for: src/arduino.cc/builder/test/builder_test.go

+16-8
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ func TestBuilderEmptySketch(t *testing.T) {
5050
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
5151
context[constants.CTX_FQBN] = "arduino:avr:uno"
5252
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch1", "sketch.ino")
53-
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
53+
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
54+
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
5455
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
5556
// context[constants.CTX_VERBOSE] = true
5657
// context[constants.CTX_DEBUG_LEVEL] = 10
@@ -83,7 +84,8 @@ func TestBuilderBridge(t *testing.T) {
8384
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
8485
context[constants.CTX_FQBN] = "arduino:avr:leonardo"
8586
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("downloaded_libraries", "Bridge", "examples", "Bridge", "Bridge.ino")
86-
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
87+
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
88+
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
8789
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
8890

8991
command := builder.Builder{}
@@ -116,7 +118,8 @@ func TestBuilderSketchWithConfig(t *testing.T) {
116118
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
117119
context[constants.CTX_FQBN] = "arduino:avr:leonardo"
118120
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch_with_config", "sketch_with_config.ino")
119-
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
121+
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
122+
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
120123
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
121124

122125
command := builder.Builder{}
@@ -149,7 +152,8 @@ func TestBuilderBridgeTwice(t *testing.T) {
149152
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
150153
context[constants.CTX_FQBN] = "arduino:avr:leonardo"
151154
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("downloaded_libraries", "Bridge", "examples", "Bridge", "Bridge.ino")
152-
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
155+
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
156+
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
153157
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
154158

155159
command := builder.Builder{}
@@ -186,7 +190,8 @@ func TestBuilderBridgeSAM(t *testing.T) {
186190
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
187191
context[constants.CTX_FQBN] = "arduino:sam:arduino_due_x_dbg"
188192
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("downloaded_libraries", "Bridge", "examples", "Bridge", "Bridge.ino")
189-
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
193+
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
194+
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
190195
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
191196
context[constants.CTX_WARNINGS_LEVEL] = "all"
192197

@@ -224,7 +229,8 @@ func TestBuilderBridgeRedBearLab(t *testing.T) {
224229
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools", "downloaded_board_manager_stuff"}
225230
context[constants.CTX_FQBN] = "RedBearLab:avr:blend"
226231
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("downloaded_libraries", "Bridge", "examples", "Bridge", "Bridge.ino")
227-
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
232+
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
233+
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
228234
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
229235

230236
command := builder.Builder{}
@@ -257,7 +263,8 @@ func TestBuilderSketchNoFunctions(t *testing.T) {
257263
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools", "downloaded_board_manager_stuff"}
258264
context[constants.CTX_FQBN] = "RedBearLab:avr:blend"
259265
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch_no_functions", "main.ino")
260-
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
266+
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
267+
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
261268
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
262269

263270
command := builder.Builder{}
@@ -277,7 +284,8 @@ func TestBuilderSketchWithBackup(t *testing.T) {
277284
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools", "downloaded_board_manager_stuff"}
278285
context[constants.CTX_FQBN] = "arduino:avr:uno"
279286
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch_with_backup_files", "sketch.ino")
280-
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
287+
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
288+
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
281289
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
282290

283291
command := builder.Builder{}

Diff for: src/arduino.cc/builder/test/create_build_options_map_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestCreateBuildOptionsMap(t *testing.T) {
4343
context[constants.CTX_BUILD_PATH] = "buildPath"
4444
context[constants.CTX_HARDWARE_FOLDERS] = []string{"hardware", "hardware2"}
4545
context[constants.CTX_TOOLS_FOLDERS] = []string{"tools"}
46-
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries"}
46+
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
4747
context[constants.CTX_FQBN] = "fqbn"
4848
context[constants.CTX_SKETCH_LOCATION] = "sketchLocation"
4949
context[constants.CTX_VERBOSE] = true
@@ -58,15 +58,15 @@ func TestCreateBuildOptionsMap(t *testing.T) {
5858
require.Equal(t, 6, len(utils.KeysOfMapOfString(buildOptions)))
5959
require.Equal(t, "hardware,hardware2", buildOptions[constants.CTX_HARDWARE_FOLDERS])
6060
require.Equal(t, "tools", buildOptions[constants.CTX_TOOLS_FOLDERS])
61-
require.Equal(t, "libraries", buildOptions[constants.CTX_LIBRARIES_FOLDERS])
61+
require.Equal(t, "libraries", buildOptions[constants.CTX_OTHER_LIBRARIES_FOLDERS])
6262
require.Equal(t, "fqbn", buildOptions[constants.CTX_FQBN])
6363
require.Equal(t, "sketchLocation", buildOptions[constants.CTX_SKETCH_LOCATION])
6464
require.Equal(t, "ideVersion", buildOptions[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION])
6565

6666
require.Equal(t, "{\n"+
6767
" \"fqbn\": \"fqbn\",\n"+
6868
" \"hardwareFolders\": \"hardware,hardware2\",\n"+
69-
" \"librariesFolders\": \"libraries\",\n"+
69+
" \"otherLibrariesFolders\": \"libraries\",\n"+
7070
" \"runtime.ide.version\": \"ideVersion\",\n"+
7171
" \"sketchLocation\": \"sketchLocation\",\n"+
7272
" \"toolsFolders\": \"tools\"\n"+

0 commit comments

Comments
 (0)