Skip to content

Commit a2fc690

Browse files
Use LoadSketch in runUploadCommand
1 parent 24acaa8 commit a2fc690

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: internal/cli/upload/upload.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"strings"
2424

2525
"github.com/arduino/arduino-cli/arduino"
26-
"github.com/arduino/arduino-cli/arduino/sketch"
2726
"github.com/arduino/arduino-cli/commands"
2827
sk "github.com/arduino/arduino-cli/commands/sketch"
2928
"github.com/arduino/arduino-cli/commands/upload"
@@ -90,7 +89,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
9089
feedback.Warning(msg)
9190
}
9291

93-
sk, err := sketch.New(sketchPath)
92+
sketch, err := sk.LoadSketch(context.Background(), &rpc.LoadSketchRequest{SketchPath: sketchPath.String()})
9493
if err != nil && importDir == "" && importFile == "" {
9594
feedback.Fatal(tr("Error during Upload: %v", err), feedback.ErrGeneric)
9695
}
@@ -99,7 +98,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
9998
var profile *rpc.Profile
10099

101100
if profileArg.Get() == "" {
102-
inst, profile = instance.CreateAndInitWithProfile(sk.Project.DefaultProfile, sketchPath)
101+
inst, profile = instance.CreateAndInitWithProfile(sketch.GetDefaultProfile().GetName(), sketchPath)
103102
} else {
104103
inst, profile = instance.CreateAndInitWithProfile(profileArg.Get(), sketchPath)
105104
}
@@ -108,8 +107,9 @@ func runUploadCommand(command *cobra.Command, args []string) {
108107
fqbnArg.Set(profile.GetFqbn())
109108
}
110109

111-
defaultFQBN := sk.GetDefaultFQBN()
112-
defaultAddress, defaultProtocol := sk.GetDefaultPortAddressAndProtocol()
110+
defaultFQBN := sketch.GetDefaultFqbn()
111+
defaultAddress := sketch.GetDefaultPort()
112+
defaultProtocol := sketch.GetDefaultProtocol()
113113
fqbn, port := arguments.CalculateFQBNAndPort(&portArgs, &fqbnArg, inst, defaultFQBN, defaultAddress, defaultProtocol)
114114

115115
userFieldRes, err := upload.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{

0 commit comments

Comments
 (0)