Skip to content

Commit 12b4c0b

Browse files
committed
Rename variables for clarity
1 parent 257b306 commit 12b4c0b

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

commands/service_compile.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,6 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
219219
return err
220220
}
221221

222-
actualPlatform := buildPlatform
223-
otherLibrariesDirs := paths.NewPathList(req.GetLibraries()...)
224-
otherLibrariesDirs.Add(s.settings.LibrariesDir())
225-
226222
var libsManager *librariesmanager.LibrariesManager
227223
if pme.GetProfile() != nil {
228224
libsManager = lm
@@ -252,6 +248,11 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
252248
if req.GetVerbose() {
253249
verbosity = logger.VerbosityVerbose
254250
}
251+
252+
librariesDirs := paths.NewPathList(req.GetLibraries()...) // Array of collection of libraries directories
253+
librariesDirs.Add(s.settings.LibrariesDir())
254+
libraryDirs := paths.NewPathList(req.GetLibrary()...) // Array of single-library directories
255+
255256
sketchBuilder, err := builder.NewBuilder(
256257
ctx,
257258
sk,
@@ -263,16 +264,16 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
263264
int(req.GetJobs()),
264265
req.GetBuildProperties(),
265266
s.settings.HardwareDirectories(),
266-
otherLibrariesDirs,
267+
librariesDirs,
267268
s.settings.IDEBuiltinLibrariesDir(),
268269
fqbn,
269270
req.GetClean(),
270271
req.GetSourceOverride(),
271272
req.GetCreateCompilationDatabaseOnly(),
272-
targetPlatform, actualPlatform,
273+
targetPlatform, buildPlatform,
273274
req.GetSkipLibrariesDiscovery(),
274275
libsManager,
275-
paths.NewPathList(req.GetLibrary()...),
276+
libraryDirs,
276277
outStream, errStream, verbosity, req.GetWarnings(),
277278
progressCB,
278279
pme.GetEnvVarsForSpawnedProcess(),

internal/arduino/builder/builder.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ type Builder struct {
8989
lineOffset int
9090

9191
targetPlatform *cores.PlatformRelease
92-
actualPlatform *cores.PlatformRelease
92+
buildPlatform *cores.PlatformRelease
9393

9494
buildArtifacts *buildArtifacts
9595

@@ -126,18 +126,19 @@ func NewBuilder(
126126
extraCoreBuildCachePaths paths.PathList,
127127
jobs int,
128128
requestBuildProperties []string,
129-
hardwareDirs, otherLibrariesDirs paths.PathList,
129+
hardwareDirs paths.PathList,
130+
librariesDirs paths.PathList,
130131
builtInLibrariesDirs *paths.Path,
131132
fqbn *fqbn.FQBN,
132133
clean bool,
133134
sourceOverrides map[string]string,
134135
onlyUpdateCompilationDatabase bool,
135-
targetPlatform, actualPlatform *cores.PlatformRelease,
136+
targetPlatform, buildPlatform *cores.PlatformRelease,
136137
useCachedLibrariesResolution bool,
137138
librariesManager *librariesmanager.LibrariesManager,
138-
libraryDirs paths.PathList,
139+
customLibraryDirs paths.PathList,
139140
stdout, stderr io.Writer, verbosity logger.Verbosity, warningsLevel string,
140-
progresCB rpc.TaskProgressCB,
141+
progressCB rpc.TaskProgressCB,
141142
toolEnv []string,
142143
) (*Builder, error) {
143144
buildProperties := properties.NewMap()
@@ -192,8 +193,8 @@ func NewBuilder(
192193
log := logger.New(stdout, stderr, verbosity, warningsLevel)
193194
libsResolver, verboseOut, err := detector.LibrariesLoader(
194195
useCachedLibrariesResolution, librariesManager,
195-
builtInLibrariesDirs, libraryDirs, otherLibrariesDirs,
196-
actualPlatform, targetPlatform,
196+
builtInLibrariesDirs, customLibraryDirs, librariesDirs,
197+
buildPlatform, targetPlatform,
197198
)
198199
if err != nil {
199200
return nil, err
@@ -220,14 +221,14 @@ func NewBuilder(
220221
sourceOverrides: sourceOverrides,
221222
onlyUpdateCompilationDatabase: onlyUpdateCompilationDatabase,
222223
compilationDatabase: compilation.NewDatabase(buildPath.Join("compile_commands.json")),
223-
Progress: progress.New(progresCB),
224+
Progress: progress.New(progressCB),
224225
executableSectionsSize: []ExecutableSectionSize{},
225226
buildArtifacts: &buildArtifacts{},
226227
targetPlatform: targetPlatform,
227-
actualPlatform: actualPlatform,
228+
buildPlatform: buildPlatform,
228229
toolEnv: toolEnv,
229230
buildOptions: newBuildOptions(
230-
hardwareDirs, otherLibrariesDirs,
231+
hardwareDirs, librariesDirs,
231232
builtInLibrariesDirs, buildPath,
232233
sk,
233234
customBuildPropertiesArgs,

internal/arduino/builder/core.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (b *Builder) compileCore() (*paths.Path, paths.PathList, error) {
164164
b.logger.Info(i18n.Tr("Archiving built core (caching) in: %[1]s", targetArchivedCore))
165165
} else if os.IsNotExist(err) {
166166
b.logger.Info(i18n.Tr("Unable to cache built core, please tell %[1]s maintainers to follow %[2]s",
167-
b.actualPlatform,
167+
b.buildPlatform,
168168
"https://arduino.github.io/arduino-cli/latest/platform-specification/#recipes-to-build-the-corea-archive-file"))
169169
} else {
170170
b.logger.Info(i18n.Tr("Error archiving built core (caching) in %[1]s: %[2]s", targetArchivedCore, err))

0 commit comments

Comments
 (0)