@@ -24,8 +24,8 @@ import (
24
24
25
25
"github.com/arduino/arduino-cli/arduino"
26
26
"github.com/arduino/arduino-cli/arduino/cores/packagemanager"
27
- "github.com/arduino/arduino-cli/arduino/sketch"
28
27
"github.com/arduino/arduino-cli/commands"
28
+ sk "github.com/arduino/arduino-cli/commands/sketch"
29
29
"github.com/arduino/arduino-cli/commands/upload"
30
30
"github.com/arduino/arduino-cli/i18n"
31
31
"github.com/arduino/arduino-cli/internal/cli/arguments"
@@ -90,7 +90,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
90
90
arguments .WarnDeprecatedFiles (sketchPath )
91
91
}
92
92
93
- sk , err := sketch . New ( sketchPath )
93
+ sketch , err := sk . LoadSketch ( context . Background (), & rpc. LoadSketchRequest { SketchPath : sketchPath . String ()} )
94
94
if err != nil && importDir == "" && importFile == "" {
95
95
feedback .Fatal (tr ("Error during Upload: %v" , err ), feedback .ErrGeneric )
96
96
}
@@ -99,7 +99,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
99
99
var profile * rpc.Profile
100
100
101
101
if profileArg .Get () == "" {
102
- inst , profile = instance .CreateAndInitWithProfile (sk . Project . DefaultProfile , sketchPath )
102
+ inst , profile = instance .CreateAndInitWithProfile (sketch . GetDefaultProfile (). GetName () , sketchPath )
103
103
} else {
104
104
inst , profile = instance .CreateAndInitWithProfile (profileArg .Get (), sketchPath )
105
105
}
@@ -108,8 +108,9 @@ func runUploadCommand(command *cobra.Command, args []string) {
108
108
fqbnArg .Set (profile .GetFqbn ())
109
109
}
110
110
111
- defaultFQBN := sk .GetDefaultFQBN ()
112
- defaultAddress , defaultProtocol := sk .GetDefaultPortAddressAndProtocol ()
111
+ defaultFQBN := sketch .GetDefaultFqbn ()
112
+ defaultAddress := sketch .GetDefaultPort ()
113
+ defaultProtocol := sketch .GetDefaultProtocol ()
113
114
fqbn , port := arguments .CalculateFQBNAndPort (& portArgs , & fqbnArg , inst , defaultFQBN , defaultAddress , defaultProtocol )
114
115
115
116
userFieldRes , err := upload .SupportedUserFields (context .Background (), & rpc.SupportedUserFieldsRequest {
0 commit comments