Skip to content

Commit 47a01ac

Browse files
committed
Rename variables for clarity
1 parent eff390d commit 47a01ac

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

221-
actualPlatform := buildPlatform
222-
otherLibrariesDirs := paths.NewPathList(req.GetLibraries()...)
223-
otherLibrariesDirs.Add(s.settings.LibrariesDir())
224-
225221
var libsManager *librariesmanager.LibrariesManager
226222
if pme.GetProfile() != nil {
227223
libsManager = lm
@@ -244,6 +240,11 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
244240
Message: &rpc.CompileResponse_Progress{Progress: p},
245241
})
246242
}
243+
244+
librariesDirs := paths.NewPathList(req.GetLibraries()...) // Array of collection of libraries directories
245+
librariesDirs.Add(s.settings.LibrariesDir())
246+
libraryDirs := paths.NewPathList(req.GetLibrary()...) // Array of single-library directories
247+
247248
sketchBuilder, err := builder.NewBuilder(
248249
ctx,
249250
sk,
@@ -255,16 +256,16 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
255256
int(req.GetJobs()),
256257
req.GetBuildProperties(),
257258
s.settings.HardwareDirectories(),
258-
otherLibrariesDirs,
259+
librariesDirs,
259260
s.settings.IDEBuiltinLibrariesDir(),
260261
fqbn,
261262
req.GetClean(),
262263
req.GetSourceOverride(),
263264
req.GetCreateCompilationDatabaseOnly(),
264-
targetPlatform, actualPlatform,
265+
targetPlatform, buildPlatform,
265266
req.GetSkipLibrariesDiscovery(),
266267
libsManager,
267-
paths.NewPathList(req.GetLibrary()...),
268+
libraryDirs,
268269
outStream, errStream, req.GetVerbose(), req.GetWarnings(),
269270
progressCB,
270271
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, verbose bool, 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
logger := logger.New(stdout, stderr, verbose, 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
@@ -163,7 +163,7 @@ func (b *Builder) compileCore() (*paths.Path, paths.PathList, error) {
163163
b.logger.Info(i18n.Tr("Archiving built core (caching) in: %[1]s", targetArchivedCore))
164164
} else if os.IsNotExist(err) {
165165
b.logger.Info(i18n.Tr("Unable to cache built core, please tell %[1]s maintainers to follow %[2]s",
166-
b.actualPlatform,
166+
b.buildPlatform,
167167
"https://arduino.github.io/arduino-cli/latest/platform-specification/#recipes-to-build-the-corea-archive-file"))
168168
} else {
169169
b.logger.Info(i18n.Tr("Error archiving built core (caching) in %[1]s: %[2]s", targetArchivedCore, err))

0 commit comments

Comments
 (0)