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
ca0e468b
Commit
ca0e468b
authored
Dec 24, 2018
by
Cristian Maglie
Committed by
Cristian Maglie
Jan 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Property upload.tool refers to the pattern/recipe not the tool name
parent
443717fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
30 deletions
+17
-30
commands/upload/upload.go
commands/upload/upload.go
+17
-30
No files found.
commands/upload/upload.go
View file @
ca0e468b
...
...
@@ -112,43 +112,30 @@ func run(command *cobra.Command, args []string) {
}
// Load programmer tool
uploadTool
ID
,
have
:=
boardProperties
.
GetOk
(
"upload.tool"
)
if
!
have
||
uploadTool
ID
==
""
{
formatter
.
PrintErrorMessage
(
"The board d
efines an invalid 'upload.tool': "
+
uploadToolID
)
uploadTool
Pattern
,
have
:=
boardProperties
.
GetOk
(
"upload.tool"
)
if
!
have
||
uploadTool
Pattern
==
""
{
formatter
.
PrintErrorMessage
(
"The board d
oes not define an 'upload.tool' property."
)
os
.
Exit
(
commands
.
ErrGeneric
)
}
var
referencedPackage
*
cores
.
Package
var
referencedPlatform
*
cores
.
Platform
var
referencedPlatformRelease
*
cores
.
PlatformRelease
var
uploadTool
*
cores
.
Tool
if
split
:=
strings
.
Split
(
uploadToolID
,
":"
);
len
(
split
)
==
1
{
uploadTool
=
board
.
PlatformRelease
.
Platform
.
Package
.
Tools
[
uploadToolID
]
if
split
:=
strings
.
Split
(
uploadToolPattern
,
":"
);
len
(
split
)
>
2
{
formatter
.
PrintErrorMessage
(
"The board defines an invalid 'upload.tool' property: "
+
uploadToolPattern
)
os
.
Exit
(
commands
.
ErrGeneric
)
}
else
if
len
(
split
)
==
2
{
referencedPackage
=
pm
.
GetPackages
()
.
Packages
[
split
[
0
]]
if
referencedPackage
==
nil
{
formatter
.
PrintErrorMessage
(
"The board requires a tool from package '"
+
split
[
0
]
+
"' that is not installed: "
+
uploadToolID
)
os
.
Exit
(
commands
.
ErrGeneric
)
}
uploadTool
=
referencedPackage
.
Tools
[
split
[
1
]]
referencedPackageName
:=
split
[
0
]
uploadToolPattern
=
split
[
1
]
architecture
:=
board
.
PlatformRelease
.
Platform
.
Architecture
referencedPlatform
=
referencedPackage
.
Platforms
[
board
.
PlatformRelease
.
Platform
.
Architecture
]
if
referencedPlatform
!=
nil
{
if
referencedPackage
:=
pm
.
GetPackages
()
.
Packages
[
referencedPackageName
];
referencedPackage
==
nil
{
formatter
.
PrintErrorMessage
(
"The board requires platform '"
+
referencedPackageName
+
":"
+
architecture
+
"' that is not installed."
)
os
.
Exit
(
commands
.
ErrGeneric
)
}
else
if
referencedPlatform
:=
referencedPackage
.
Platforms
[
architecture
];
referencedPlatform
==
nil
{
formatter
.
PrintErrorMessage
(
"The board requires platform '"
+
referencedPackageName
+
":"
+
architecture
+
"' that is not installed."
)
os
.
Exit
(
commands
.
ErrGeneric
)
}
else
{
referencedPlatformRelease
=
pm
.
GetInstalledPlatformRelease
(
referencedPlatform
)
}
}
else
{
formatter
.
PrintErrorMessage
(
"The board defines an invalid 'upload.tool': "
+
uploadToolID
)
os
.
Exit
(
commands
.
ErrGeneric
)
}
if
uploadTool
==
nil
{
formatter
.
PrintErrorMessage
(
"Upload tool '"
+
uploadToolID
+
"' not found."
)
os
.
Exit
(
commands
.
ErrGeneric
)
}
// FIXME: Look into index if the platform requires a specific version
uploadToolRelease
:=
uploadTool
.
GetLatestInstalled
()
if
uploadToolRelease
==
nil
{
formatter
.
PrintErrorMessage
(
"Upload tool '"
+
uploadToolID
+
"' not installed."
)
os
.
Exit
(
commands
.
ErrGeneric
)
}
// Build configuration for upload
...
...
@@ -160,7 +147,7 @@ func run(command *cobra.Command, args []string) {
uploadProperties
.
Merge
(
board
.
PlatformRelease
.
RuntimeProperties
())
uploadProperties
.
Merge
(
boardProperties
)
uploadToolProperties
:=
uploadProperties
.
SubTree
(
"tools."
+
uploadTool
.
Name
)
uploadToolProperties
:=
uploadProperties
.
SubTree
(
"tools."
+
uploadTool
Pattern
)
uploadProperties
.
Merge
(
uploadToolProperties
)
if
requiredTools
,
err
:=
pm
.
FindToolsRequiredForBoard
(
board
);
err
==
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