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
c1dcf018
Unverified
Commit
c1dcf018
authored
Feb 12, 2020
by
Cristian Maglie
Committed by
GitHub
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce priority for IDE-bundled platform releases (#579)
Fix
https://github.com/arduino/Arduino/issues/9724
parent
553b7be3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
arduino/cores/cores.go
arduino/cores/cores.go
+1
-0
arduino/cores/packagemanager/loader.go
arduino/cores/packagemanager/loader.go
+7
-0
arduino/cores/packagemanager/package_manager.go
arduino/cores/packagemanager/package_manager.go
+20
-1
No files found.
arduino/cores/cores.go
View file @
c1dcf018
...
...
@@ -47,6 +47,7 @@ type PlatformRelease struct {
Programmers
map
[
string
]
*
properties
.
Map
`json:"-"`
Menus
*
properties
.
Map
`json:"-"`
InstallDir
*
paths
.
Path
`json:"-"`
IsIDEBundled
bool
`json:"-"`
}
// BoardManifest contains information about a board. These metadata are usually
...
...
arduino/cores/packagemanager/loader.go
View file @
c1dcf018
...
...
@@ -179,6 +179,7 @@ func (pm *PackageManager) loadPlatforms(targetPackage *cores.Package, packageDir
}
// check if package_bundled_index.json exists
isIDEBundled
:=
false
packageBundledIndexPath
:=
packageDir
.
Parent
()
.
Join
(
"package_index_bundled.json"
)
if
packageBundledIndexPath
.
Exist
()
{
// particular case: ARCHITECTURE/boards.txt with package_bundled_index.json
...
...
@@ -204,6 +205,8 @@ func (pm *PackageManager) loadPlatforms(targetPackage *cores.Package, packageDir
}
else
{
version
=
tmpPlatformRelease
.
Version
}
isIDEBundled
=
true
}
platform
:=
targetPackage
.
GetOrCreatePlatform
(
architecture
)
...
...
@@ -211,6 +214,10 @@ func (pm *PackageManager) loadPlatforms(targetPackage *cores.Package, packageDir
if
err
!=
nil
{
return
fmt
.
Errorf
(
"loading platform release: %s"
,
err
)
}
release
.
IsIDEBundled
=
isIDEBundled
if
isIDEBundled
{
pm
.
Log
.
Infof
(
"Package is built-in"
)
}
if
err
:=
pm
.
loadPlatformRelease
(
release
,
platformPath
);
err
!=
nil
{
return
fmt
.
Errorf
(
"loading platform release: %s"
,
err
)
}
...
...
arduino/cores/packagemanager/package_manager.go
View file @
c1dcf018
...
...
@@ -323,16 +323,34 @@ func (tr *ToolReleaseActions) Get() (*cores.ToolRelease, error) {
// GetInstalledPlatformRelease returns the PlatformRelease installed (it is chosen)
func
(
pm
*
PackageManager
)
GetInstalledPlatformRelease
(
platform
*
cores
.
Platform
)
*
cores
.
PlatformRelease
{
pm
.
Log
.
Infof
(
"Selecting installed platform release for %s"
,
platform
)
releases
:=
platform
.
GetAllInstalled
()
if
len
(
releases
)
==
0
{
return
nil
}
log
:=
func
(
msg
string
,
pl
*
cores
.
PlatformRelease
)
{
pm
.
Log
.
WithField
(
"bundle"
,
pl
.
IsIDEBundled
)
.
WithField
(
"version"
,
pl
.
Version
)
.
WithField
(
"managed"
,
pm
.
IsManagedPlatformRelease
(
pl
))
.
Infof
(
"%s: %s"
,
msg
,
pl
)
}
best
:=
releases
[
0
]
bestIsManaged
:=
pm
.
IsManagedPlatformRelease
(
best
)
log
(
"current best"
,
best
)
for
_
,
candidate
:=
range
releases
[
1
:
]
{
candidateIsManaged
:=
pm
.
IsManagedPlatformRelease
(
candidate
)
log
(
"candidate"
,
candidate
)
// TODO: Disentangle this algorithm and make it more straightforward
if
bestIsManaged
==
candidateIsManaged
{
if
candidate
.
Version
.
GreaterThan
(
best
.
Version
)
{
if
best
.
IsIDEBundled
==
candidate
.
IsIDEBundled
{
if
candidate
.
Version
.
GreaterThan
(
best
.
Version
)
{
best
=
candidate
}
}
if
best
.
IsIDEBundled
&&
!
candidate
.
IsIDEBundled
{
best
=
candidate
}
}
...
...
@@ -340,6 +358,7 @@ func (pm *PackageManager) GetInstalledPlatformRelease(platform *cores.Platform)
best
=
candidate
bestIsManaged
=
true
}
log
(
"current best"
,
best
)
}
return
best
}
...
...
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