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
928e5343
Commit
928e5343
authored
Aug 13, 2018
by
Cristian Maglie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added function PlatformRelease.RequiresToolRelease
This function will be usefult for cleanup during uninstall
parent
50ebe37a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
arduino/cores/cores.go
arduino/cores/cores.go
+13
-0
arduino/cores/packagemanager/install_uninstall.go
arduino/cores/packagemanager/install_uninstall.go
+16
-0
No files found.
arduino/cores/cores.go
View file @
928e5343
...
...
@@ -184,6 +184,19 @@ func (release *PlatformRelease) GetOrCreateBoard(boardID string) *Board {
return
board
}
// RequiresToolRelease returns true if the PlatformRelease requires the
// toolReleased passed as parameter
func
(
release
*
PlatformRelease
)
RequiresToolRelease
(
toolRelease
*
ToolRelease
)
bool
{
for
_
,
toolDep
:=
range
release
.
Dependencies
{
if
toolDep
.
ToolName
==
toolRelease
.
Tool
.
Name
&&
toolDep
.
ToolPackager
==
toolRelease
.
Tool
.
Package
.
Name
&&
toolDep
.
ToolVersion
==
toolRelease
.
Version
{
return
true
}
}
return
false
}
// RuntimeProperties returns the runtime properties for this PlatformRelease
func
(
release
*
PlatformRelease
)
RuntimeProperties
()
properties
.
Map
{
return
properties
.
Map
{
...
...
arduino/cores/packagemanager/install_uninstall.go
View file @
928e5343
...
...
@@ -46,3 +46,19 @@ func (pm *PackageManager) InstallTool(toolRelease *cores.ToolRelease) error {
toolRelease
.
Version
.
String
())
return
toolResource
.
Install
(
pm
.
DownloadDir
,
pm
.
TempDir
,
destDir
)
}
// IsToolRequired returns true if any of the installed platforms requires the toolRelease
// passed as parameter
func
(
pm
*
PackageManager
)
IsToolRequired
(
toolRelease
*
cores
.
ToolRelease
)
bool
{
// Search in all installed platforms
for
_
,
targetPackage
:=
range
pm
.
packages
.
Packages
{
for
_
,
platform
:=
range
targetPackage
.
Platforms
{
if
platformRelease
:=
platform
.
GetInstalled
();
platformRelease
!=
nil
{
if
platformRelease
.
RequiresToolRelease
(
toolRelease
)
{
return
true
}
}
}
}
return
false
}
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