Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
3193b7c4
Commit
3193b7c4
authored
Mar 18, 2024
by
Cristian Maglie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made utility functions private and put them in their own file
parent
0bdc07ab
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
22 additions
and
22 deletions
+22
-22
commands/service_board_listall.go
commands/service_board_listall.go
+2
-2
commands/service_board_search.go
commands/service_board_search.go
+4
-4
commands/service_library_download.go
commands/service_library_download.go
+1
-1
commands/service_library_install.go
commands/service_library_install.go
+1
-1
commands/service_library_resolve_deps.go
commands/service_library_resolve_deps.go
+1
-1
commands/service_library_uninstall.go
commands/service_library_uninstall.go
+1
-1
commands/service_platform_download.go
commands/service_platform_download.go
+1
-1
commands/service_platform_install.go
commands/service_platform_install.go
+1
-1
commands/service_platform_search.go
commands/service_platform_search.go
+2
-2
commands/service_platform_upgrade.go
commands/service_platform_upgrade.go
+2
-2
commands/utility_core.go
commands/utility_core.go
+4
-4
commands/utility_grpc_streaming.go
commands/utility_grpc_streaming.go
+0
-0
commands/utility_libraries_index_search_matcher.go
commands/utility_libraries_index_search_matcher.go
+0
-0
commands/utility_version.go
commands/utility_version.go
+2
-2
No files found.
commands/service_board_listall.go
View file @
3193b7c4
...
...
@@ -46,8 +46,8 @@ func (s *arduinoCoreServerImpl) BoardListAll(ctx context.Context, req *rpc.Board
}
rpcPlatform
:=
&
rpc
.
Platform
{
Metadata
:
P
latformToRPCPlatformMetadata
(
platform
),
Release
:
P
latformReleaseToRPC
(
installedPlatformRelease
),
Metadata
:
p
latformToRPCPlatformMetadata
(
platform
),
Release
:
p
latformReleaseToRPC
(
installedPlatformRelease
),
}
toTest
:=
[]
string
{
...
...
commands/service_board_search.go
View file @
3193b7c4
...
...
@@ -67,8 +67,8 @@ func (s *arduinoCoreServerImpl) BoardSearch(ctx context.Context, req *rpc.BoardS
Fqbn
:
board
.
FQBN
(),
IsHidden
:
board
.
IsHidden
(),
Platform
:
&
rpc
.
Platform
{
Metadata
:
P
latformToRPCPlatformMetadata
(
platform
),
Release
:
P
latformReleaseToRPC
(
installedPlatformRelease
),
Metadata
:
p
latformToRPCPlatformMetadata
(
platform
),
Release
:
p
latformReleaseToRPC
(
installedPlatformRelease
),
},
})
}
...
...
@@ -82,8 +82,8 @@ func (s *arduinoCoreServerImpl) BoardSearch(ctx context.Context, req *rpc.BoardS
foundBoards
=
append
(
foundBoards
,
&
rpc
.
BoardListItem
{
Name
:
strings
.
Trim
(
board
.
Name
,
"
\n
"
),
Platform
:
&
rpc
.
Platform
{
Metadata
:
P
latformToRPCPlatformMetadata
(
platform
),
Release
:
P
latformReleaseToRPC
(
latestPlatformRelease
),
Metadata
:
p
latformToRPCPlatformMetadata
(
platform
),
Release
:
p
latformReleaseToRPC
(
latestPlatformRelease
),
},
})
}
...
...
commands/service_library_download.go
View file @
3193b7c4
...
...
@@ -56,7 +56,7 @@ func (s *arduinoCoreServerImpl) LibraryDownload(req *rpc.LibraryDownloadRequest,
return
err
}
version
,
err
:=
P
arseVersion
(
req
.
GetVersion
())
version
,
err
:=
p
arseVersion
(
req
.
GetVersion
())
if
err
!=
nil
{
return
err
}
...
...
commands/service_library_install.go
View file @
3193b7c4
...
...
@@ -109,7 +109,7 @@ func (s *arduinoCoreServerImpl) LibraryInstall(req *rpc.LibraryInstallRequest, s
libReleasesToInstall
:=
map
[
*
librariesindex
.
Release
]
*
librariesmanager
.
LibraryInstallPlan
{}
installLocation
:=
libraries
.
FromRPCLibraryInstallLocation
(
req
.
GetInstallLocation
())
for
_
,
lib
:=
range
toInstall
{
version
,
err
:=
P
arseVersion
(
lib
.
GetVersionRequired
())
version
,
err
:=
p
arseVersion
(
lib
.
GetVersionRequired
())
if
err
!=
nil
{
return
err
}
...
...
commands/service_library_resolve_deps.go
View file @
3193b7c4
...
...
@@ -47,7 +47,7 @@ func (s *arduinoCoreServerImpl) LibraryResolveDependencies(ctx context.Context,
func
libraryResolveDependencies
(
lme
*
librariesmanager
.
Explorer
,
li
*
librariesindex
.
Index
,
reqName
,
reqVersion
string
,
noOverwrite
bool
)
(
*
rpc
.
LibraryResolveDependenciesResponse
,
error
)
{
version
,
err
:=
P
arseVersion
(
reqVersion
)
version
,
err
:=
p
arseVersion
(
reqVersion
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
commands/service_library_uninstall.go
View file @
3193b7c4
...
...
@@ -47,7 +47,7 @@ func (s *arduinoCoreServerImpl) LibraryUninstall(req *rpc.LibraryUninstallReques
return
err
}
version
,
err
:=
P
arseVersion
(
req
.
GetVersion
())
version
,
err
:=
p
arseVersion
(
req
.
GetVersion
())
if
err
!=
nil
{
return
err
}
...
...
commands/service_platform_download.go
View file @
3193b7c4
...
...
@@ -48,7 +48,7 @@ func (s *arduinoCoreServerImpl) PlatformDownload(req *rpc.PlatformDownloadReques
}
defer
release
()
version
,
err
:=
P
arseVersion
(
req
.
GetVersion
())
version
,
err
:=
p
arseVersion
(
req
.
GetVersion
())
if
err
!=
nil
{
return
&
cmderrors
.
InvalidVersionError
{
Cause
:
err
}
}
...
...
commands/service_platform_install.go
View file @
3193b7c4
...
...
@@ -53,7 +53,7 @@ func (s *arduinoCoreServerImpl) PlatformInstall(req *rpc.PlatformInstallRequest,
}
defer
release
()
version
,
err
:=
P
arseVersion
(
req
.
GetVersion
())
version
,
err
:=
p
arseVersion
(
req
.
GetVersion
())
if
err
!=
nil
{
return
&
cmderrors
.
InvalidVersionError
{
Cause
:
err
}
}
...
...
commands/service_platform_search.go
View file @
3193b7c4
...
...
@@ -82,7 +82,7 @@ func (s *arduinoCoreServerImpl) PlatformSearch(_ context.Context, req *rpc.Platf
out
:=
[]
*
rpc
.
PlatformSummary
{}
for
_
,
platform
:=
range
res
{
rpcPlatformSummary
:=
&
rpc
.
PlatformSummary
{
Metadata
:
P
latformToRPCPlatformMetadata
(
platform
),
Metadata
:
p
latformToRPCPlatformMetadata
(
platform
),
Releases
:
map
[
string
]
*
rpc
.
PlatformRelease
{},
}
if
installed
:=
pme
.
GetInstalledPlatformRelease
(
platform
);
installed
!=
nil
{
...
...
@@ -92,7 +92,7 @@ func (s *arduinoCoreServerImpl) PlatformSearch(_ context.Context, req *rpc.Platf
rpcPlatformSummary
.
LatestVersion
=
latestCompatible
.
Version
.
String
()
}
for
_
,
platformRelease
:=
range
platform
.
GetAllReleases
()
{
rpcPlatformRelease
:=
P
latformReleaseToRPC
(
platformRelease
)
rpcPlatformRelease
:=
p
latformReleaseToRPC
(
platformRelease
)
rpcPlatformSummary
.
Releases
[
rpcPlatformRelease
.
GetVersion
()]
=
rpcPlatformRelease
}
out
=
append
(
out
,
rpcPlatformSummary
)
...
...
commands/service_platform_upgrade.go
View file @
3193b7c4
...
...
@@ -76,8 +76,8 @@ func (s *arduinoCoreServerImpl) PlatformUpgrade(req *rpc.PlatformUpgradeRequest,
if
platformRelease
!=
nil
{
syncSend
.
Send
(
&
rpc
.
PlatformUpgradeResponse
{
Platform
:
&
rpc
.
Platform
{
Metadata
:
P
latformToRPCPlatformMetadata
(
platformRelease
.
Platform
),
Release
:
P
latformReleaseToRPC
(
platformRelease
),
Metadata
:
p
latformToRPCPlatformMetadata
(
platformRelease
.
Platform
),
Release
:
p
latformReleaseToRPC
(
platformRelease
),
},
})
}
...
...
commands/core.go
→
commands/
utility_
core.go
View file @
3193b7c4
...
...
@@ -20,8 +20,8 @@ import (
rpc
"github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
)
//
P
latformToRPCPlatformMetadata converts our internal structure to the RPC structure.
func
P
latformToRPCPlatformMetadata
(
platform
*
cores
.
Platform
)
*
rpc
.
PlatformMetadata
{
//
p
latformToRPCPlatformMetadata converts our internal structure to the RPC structure.
func
p
latformToRPCPlatformMetadata
(
platform
*
cores
.
Platform
)
*
rpc
.
PlatformMetadata
{
return
&
rpc
.
PlatformMetadata
{
Id
:
platform
.
String
(),
Maintainer
:
platform
.
Package
.
Maintainer
,
...
...
@@ -33,10 +33,10 @@ func PlatformToRPCPlatformMetadata(platform *cores.Platform) *rpc.PlatformMetada
}
}
//
P
latformReleaseToRPC converts our internal structure to the RPC structure.
//
p
latformReleaseToRPC converts our internal structure to the RPC structure.
// Note: this function does not touch the "Installed" field of rpc.Platform as it's not always clear that the
// platformRelease we're currently converting is actually installed.
func
P
latformReleaseToRPC
(
platformRelease
*
cores
.
PlatformRelease
)
*
rpc
.
PlatformRelease
{
func
p
latformReleaseToRPC
(
platformRelease
*
cores
.
PlatformRelease
)
*
rpc
.
PlatformRelease
{
// If the boards are not installed yet, the `platformRelease.Boards` will be a zero length slice.
// In such case, we have to use the `platformRelease.BoardsManifest` instead.
// So that we can retrieve the name of the boards at least.
...
...
commands/
grpc_streaming_helpers
.go
→
commands/
utility_grpc_streaming
.go
View file @
3193b7c4
File moved
commands/libraries_index_search_matcher.go
→
commands/
utility_
libraries_index_search_matcher.go
View file @
3193b7c4
File moved
commands/version.go
→
commands/
utility_
version.go
View file @
3193b7c4
...
...
@@ -20,10 +20,10 @@ import (
semver
"go.bug.st/relaxed-semver"
)
//
P
arseVersion returns the parsed version or nil if the version is
//
p
arseVersion returns the parsed version or nil if the version is
// the empty string. An error is returned if the version is not valid
// semver.
func
P
arseVersion
(
version
string
)
(
*
semver
.
Version
,
error
)
{
func
p
arseVersion
(
version
string
)
(
*
semver
.
Version
,
error
)
{
if
version
==
""
{
return
nil
,
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment