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
a32d52fa
Commit
a32d52fa
authored
Nov 08, 2018
by
Cristian Maglie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Config about 3rd party URLs is no more a singleton
parent
5a02ce4f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
35 deletions
+16
-35
commands/commands.go
commands/commands.go
+1
-1
commands/core/update_index.go
commands/core/update_index.go
+1
-2
configs/boards_manager.go
configs/boards_manager.go
+0
-25
configs/configuration.go
configs/configuration.go
+10
-3
configs/preferences_txt_serializer.go
configs/preferences_txt_serializer.go
+1
-1
configs/yaml_serializer.go
configs/yaml_serializer.go
+3
-3
No files found.
commands/commands.go
View file @
a32d52fa
...
...
@@ -90,7 +90,7 @@ func InitPackageManager() *packagemanager.PackageManager {
Config
.
DownloadsDir
(),
Config
.
DataDir
.
Join
(
"tmp"
))
for
_
,
URL
:=
range
configs
.
BoardManagerAdditionalUrls
{
for
_
,
URL
:=
range
Config
.
BoardManagerAdditionalUrls
{
if
err
:=
pm
.
LoadPackageIndex
(
URL
);
err
!=
nil
{
formatter
.
PrintError
(
err
,
"Failed to load "
+
URL
.
String
()
+
" package index.
\n
"
+
"Try updating all indexes with `"
+
AppName
+
" core update-index`."
)
...
...
commands/core/update_index.go
View file @
a32d52fa
...
...
@@ -28,7 +28,6 @@ import (
"github.com/arduino/arduino-cli/arduino/cores/packageindex"
"github.com/arduino/arduino-cli/commands"
"github.com/arduino/arduino-cli/common/formatter"
"github.com/arduino/arduino-cli/configs"
"github.com/arduino/go-paths-helper"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
...
...
@@ -51,7 +50,7 @@ func runUpdateIndexCommand(cmd *cobra.Command, args []string) {
}
func
updateIndexes
()
{
for
_
,
URL
:=
range
co
nfigs
.
BoardManagerAdditionalUrls
{
for
_
,
URL
:=
range
co
mmands
.
Config
.
BoardManagerAdditionalUrls
{
updateIndex
(
URL
)
}
}
...
...
configs/boards_manager.go
deleted
100644 → 0
View file @
5a02ce4f
/*
* This file is part of arduino-cli.
*
* Copyright 2018 ARDUINO SA (http://www.arduino.cc/)
*
* This software is released under the GNU General Public License version 3,
* which covers the main part of arduino-cli.
* The terms of this license can be found at:
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* You can be released from the requirements of the above licenses by purchasing
* a commercial license. Buying such a license is mandatory if you want to modify or
* otherwise use the software for commercial activities involving the Arduino
* software without disclosing the source code of your own applications. To purchase
* a commercial license, send an email to license@arduino.cc.
*/
package
configs
import
"net/url"
var
defaultPackageIndexURL
,
_
=
url
.
Parse
(
"https://downloads.arduino.cc/packages/package_index.json"
)
// BoardManagerAdditionalUrls contains the additional URL for 3rd party packages
var
BoardManagerAdditionalUrls
=
[]
*
url
.
URL
{
defaultPackageIndexURL
}
configs/configuration.go
View file @
a32d52fa
...
...
@@ -20,6 +20,7 @@ package configs
import
(
"fmt"
"net/url"
"github.com/arduino/go-paths-helper"
)
...
...
@@ -42,8 +43,13 @@ type Configuration struct {
// the field is true if the CLI is bundled with the Arduino IDE, false if the CLI is running
// standalone or nil if the detection has not been performed.
IDEBundledCheckResult
*
bool
// BoardManagerAdditionalUrls contains the additional URL for 3rd party packages
BoardManagerAdditionalUrls
[]
*
url
.
URL
}
var
defaultPackageIndexURL
,
_
=
url
.
Parse
(
"https://downloads.arduino.cc/packages/package_index.json"
)
// NewConfiguration returns a new Configuration with the default values
func
NewConfiguration
()
(
*
Configuration
,
error
)
{
dataDir
,
err
:=
getDefaultArduinoDataDir
()
...
...
@@ -56,9 +62,10 @@ func NewConfiguration() (*Configuration, error) {
}
return
&
Configuration
{
ConfigFile
:
getDefaultConfigFilePath
(),
DataDir
:
dataDir
,
SketchbookDir
:
sketchbookDir
,
ConfigFile
:
getDefaultConfigFilePath
(),
DataDir
:
dataDir
,
SketchbookDir
:
sketchbookDir
,
BoardManagerAdditionalUrls
:
[]
*
url
.
URL
{
defaultPackageIndexURL
},
},
nil
}
...
...
configs/preferences_txt_serializer.go
View file @
a32d52fa
...
...
@@ -87,7 +87,7 @@ func (config *Configuration) LoadFromDesktopIDEPreferences() error {
if
URLs
,
has
:=
props
.
GetOk
(
"boardsmanager.additional.urls"
);
has
{
for
_
,
URL
:=
range
strings
.
Split
(
URLs
,
","
)
{
if
newURL
,
err
:=
url
.
Parse
(
URL
);
err
==
nil
{
BoardManagerAdditionalUrls
=
append
(
BoardManagerAdditionalUrls
,
newURL
)
config
.
BoardManagerAdditionalUrls
=
append
(
config
.
BoardManagerAdditionalUrls
,
newURL
)
}
}
}
...
...
configs/yaml_serializer.go
View file @
a32d52fa
...
...
@@ -81,7 +81,7 @@ func (config *Configuration) LoadFromYAML(path *paths.Path) error {
logrus
.
WithError
(
err
)
.
Warn
(
"Error parsing config"
)
continue
}
BoardManagerAdditionalUrls
=
append
(
BoardManagerAdditionalUrls
,
url
)
config
.
BoardManagerAdditionalUrls
=
append
(
config
.
BoardManagerAdditionalUrls
,
url
)
}
}
return
nil
...
...
@@ -104,9 +104,9 @@ func (config *Configuration) SerializeToYAML() ([]byte, error) {
Password
:
ProxyPassword
,
}
}
if
len
(
BoardManagerAdditionalUrls
)
>
1
{
if
len
(
config
.
BoardManagerAdditionalUrls
)
>
1
{
c
.
BoardsManager
=
&
yamlBoardsManagerConfig
{
AdditionalURLS
:
[]
string
{}}
for
_
,
URL
:=
range
BoardManagerAdditionalUrls
[
1
:
]
{
for
_
,
URL
:=
range
config
.
BoardManagerAdditionalUrls
[
1
:
]
{
c
.
BoardsManager
.
AdditionalURLS
=
append
(
c
.
BoardsManager
.
AdditionalURLS
,
URL
.
String
())
}
}
...
...
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