Skip to content

Commit 3f302d1

Browse files
committed
Rename variables for clarity
1 parent cbea8af commit 3f302d1

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

commands/service_compile.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,6 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
214214
return err
215215
}
216216

217-
actualPlatform := buildPlatform
218-
otherLibrariesDirs := paths.NewPathList(req.GetLibraries()...)
219-
otherLibrariesDirs.Add(s.settings.LibrariesDir())
220-
221217
var libsManager *librariesmanager.LibrariesManager
222218
if pme.GetProfile() != nil {
223219
libsManager = lm
@@ -240,6 +236,11 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
240236
Message: &rpc.CompileResponse_Progress{Progress: p},
241237
})
242238
}
239+
240+
librariesDirs := paths.NewPathList(req.GetLibraries()...) // Array of collection of libraries directories
241+
librariesDirs.Add(s.settings.LibrariesDir())
242+
libraryDirs := paths.NewPathList(req.GetLibrary()...) // Array of single-library directories
243+
243244
sketchBuilder, err := builder.NewBuilder(
244245
ctx,
245246
sk,
@@ -251,16 +252,16 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
251252
int(req.GetJobs()),
252253
req.GetBuildProperties(),
253254
s.settings.HardwareDirectories(),
254-
otherLibrariesDirs,
255+
librariesDirs,
255256
s.settings.IDEBuiltinLibrariesDir(),
256257
fqbn,
257258
req.GetClean(),
258259
req.GetSourceOverride(),
259260
req.GetCreateCompilationDatabaseOnly(),
260-
targetPlatform, actualPlatform,
261+
targetPlatform, buildPlatform,
261262
req.GetSkipLibrariesDiscovery(),
262263
libsManager,
263-
paths.NewPathList(req.GetLibrary()...),
264+
libraryDirs,
264265
outStream, errStream, req.GetVerbose(), req.GetWarnings(),
265266
progressCB,
266267
pme.GetEnvVarsForSpawnedProcess(),

internal/arduino/builder/builder.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ type Builder struct {
8888
lineOffset int
8989

9090
targetPlatform *cores.PlatformRelease
91-
actualPlatform *cores.PlatformRelease
91+
buildPlatform *cores.PlatformRelease
9292

9393
buildArtifacts *buildArtifacts
9494

@@ -125,18 +125,19 @@ func NewBuilder(
125125
extraCoreBuildCachePaths paths.PathList,
126126
jobs int,
127127
requestBuildProperties []string,
128-
hardwareDirs, otherLibrariesDirs paths.PathList,
128+
hardwareDirs paths.PathList,
129+
librariesDirs paths.PathList,
129130
builtInLibrariesDirs *paths.Path,
130131
fqbn *cores.FQBN,
131132
clean bool,
132133
sourceOverrides map[string]string,
133134
onlyUpdateCompilationDatabase bool,
134-
targetPlatform, actualPlatform *cores.PlatformRelease,
135+
targetPlatform, buildPlatform *cores.PlatformRelease,
135136
useCachedLibrariesResolution bool,
136137
librariesManager *librariesmanager.LibrariesManager,
137-
libraryDirs paths.PathList,
138+
customLibraryDirs paths.PathList,
138139
stdout, stderr io.Writer, verbose bool, warningsLevel string,
139-
progresCB rpc.TaskProgressCB,
140+
progressCB rpc.TaskProgressCB,
140141
toolEnv []string,
141142
) (*Builder, error) {
142143
buildProperties := properties.NewMap()
@@ -191,8 +192,8 @@ func NewBuilder(
191192
logger := logger.New(stdout, stderr, verbose, warningsLevel)
192193
libsResolver, verboseOut, err := detector.LibrariesLoader(
193194
useCachedLibrariesResolution, librariesManager,
194-
builtInLibrariesDirs, libraryDirs, otherLibrariesDirs,
195-
actualPlatform, targetPlatform,
195+
builtInLibrariesDirs, customLibraryDirs, librariesDirs,
196+
buildPlatform, targetPlatform,
196197
)
197198
if err != nil {
198199
return nil, err
@@ -219,14 +220,14 @@ func NewBuilder(
219220
sourceOverrides: sourceOverrides,
220221
onlyUpdateCompilationDatabase: onlyUpdateCompilationDatabase,
221222
compilationDatabase: compilation.NewDatabase(buildPath.Join("compile_commands.json")),
222-
Progress: progress.New(progresCB),
223+
Progress: progress.New(progressCB),
223224
executableSectionsSize: []ExecutableSectionSize{},
224225
buildArtifacts: &buildArtifacts{},
225226
targetPlatform: targetPlatform,
226-
actualPlatform: actualPlatform,
227+
buildPlatform: buildPlatform,
227228
toolEnv: toolEnv,
228229
buildOptions: newBuildOptions(
229-
hardwareDirs, otherLibrariesDirs,
230+
hardwareDirs, librariesDirs,
230231
builtInLibrariesDirs, buildPath,
231232
sk,
232233
customBuildPropertiesArgs,

internal/arduino/builder/core.go

+1-1
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)