Skip to content

Commit c00b637

Browse files
committed
Rename variables for clarity
1 parent a75945a commit c00b637

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
@@ -220,10 +220,6 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
220220
return err
221221
}
222222

223-
actualPlatform := buildPlatform
224-
otherLibrariesDirs := paths.NewPathList(req.GetLibraries()...)
225-
otherLibrariesDirs.Add(s.settings.LibrariesDir())
226-
227223
var libsManager *librariesmanager.LibrariesManager
228224
if profile != nil {
229225
libsManager = lm
@@ -253,6 +249,11 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
253249
if req.GetVerbose() {
254250
verbosity = logger.VerbosityVerbose
255251
}
252+
253+
librariesDirs := paths.NewPathList(req.GetLibraries()...) // Array of collection of libraries directories
254+
librariesDirs.Add(s.settings.LibrariesDir())
255+
libraryDirs := paths.NewPathList(req.GetLibrary()...) // Array of single-library directories
256+
256257
sketchBuilder, err := builder.NewBuilder(
257258
ctx,
258259
sk,
@@ -264,16 +265,16 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
264265
int(req.GetJobs()),
265266
req.GetBuildProperties(),
266267
s.settings.HardwareDirectories(),
267-
otherLibrariesDirs,
268+
librariesDirs,
268269
s.settings.IDEBuiltinLibrariesDir(),
269270
fqbn,
270271
req.GetClean(),
271272
req.GetSourceOverride(),
272273
req.GetCreateCompilationDatabaseOnly(),
273-
targetPlatform, actualPlatform,
274+
targetPlatform, buildPlatform,
274275
req.GetSkipLibrariesDiscovery(),
275276
libsManager,
276-
paths.NewPathList(req.GetLibrary()...),
277+
libraryDirs,
277278
outStream, errStream, verbosity, req.GetWarnings(),
278279
progressCB,
279280
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
libsManager, 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)