Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc8b0fc7

Browse files
committed
draft
1 parentf34fe8a commitc8b0fc7

File tree

16 files changed

+230
-163
lines changed

16 files changed

+230
-163
lines changed

‎commands/instances.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
320320
// Load libraries
321321
for_,pack:=rangepme.GetPackages() {
322322
for_,platform:=rangepack.Platforms {
323-
ifplatformRelease:=pme.GetInstalledPlatformRelease(platform);platformRelease!=nil {
323+
ifplatformRelease:=pme.GetBestInstalledPlatformRelease(platform);platformRelease!=nil {
324324
lmb.AddLibrariesDir(librariesmanager.LibrariesDir{
325325
PlatformRelease:platformRelease,
326326
Path:platformRelease.GetLibrariesDir(),

‎commands/service_board_listall.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (s *arduinoCoreServerImpl) BoardListAll(ctx context.Context, req *rpc.Board
3939
list:=&rpc.BoardListAllResponse{Boards: []*rpc.BoardListItem{}}
4040
for_,targetPackage:=rangetoSortedPackageArray(pme.GetPackages()) {
4141
for_,platform:=rangetoSortedPlatformArray(targetPackage.Platforms) {
42-
installedPlatformRelease:=pme.GetInstalledPlatformRelease(platform)
42+
installedPlatformRelease:=pme.GetBestInstalledPlatformRelease(platform)
4343
// We only want to list boards for installed platforms
4444
ifinstalledPlatformRelease==nil {
4545
continue

‎commands/service_board_search.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (s *arduinoCoreServerImpl) BoardSearch(ctx context.Context, req *rpc.BoardS
4040
for_,targetPackage:=rangepme.GetPackages() {
4141
for_,platform:=rangetargetPackage.Platforms {
4242
latestPlatformRelease:=platform.GetLatestCompatibleRelease()
43-
installedPlatformRelease:=pme.GetInstalledPlatformRelease(platform)
43+
installedPlatformRelease:=pme.GetBestInstalledPlatformRelease(platform)
4444

4545
iflatestPlatformRelease==nil&&installedPlatformRelease==nil {
4646
continue

‎commands/service_platform_install.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,20 @@ func (s *arduinoCoreServerImpl) PlatformInstall(req *rpc.PlatformInstallRequest,
7676
PlatformArchitecture:req.GetArchitecture(),
7777
PlatformVersion:version,
7878
}
79+
fmt.Println(ref)
7980
platformRelease,tools,err:=pme.FindPlatformReleaseDependencies(ref)
8081
iferr!=nil {
8182
return&cmderrors.PlatformNotFoundError{Platform:ref.String(),Cause:err}
8283
}
8384

8485
// Prerequisite checks before install
86+
fmt.Println("A")
8587
ifplatformRelease.IsInstalled() {
8688
taskCB(&rpc.TaskProgress{Name:i18n.Tr("Platform %s already installed",platformRelease),Completed:true})
8789
returnnil
8890
}
8991

92+
fmt.Println("B")
9093
ifreq.GetNoOverwrite() {
9194
ifinstalled:=pme.GetInstalledPlatformRelease(platformRelease.Platform);installed!=nil {
9295
returnfmt.Errorf("%s: %s",

‎commands/service_platform_search.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (s *arduinoCoreServerImpl) PlatformSearch(_ context.Context, req *rpc.Platf
4141
res=pme.FindPlatformReleaseProvidingBoardsWithVidPid(vid,pid)
4242
}else {
4343
searchArgs:=utils.SearchTermsFromQueryString(req.GetSearchArgs())
44-
for_,targetPackage:=rangepme.GetPackages() {
44+
for_,targetPackage:=rangepme.AllPackages() {
4545
for_,platform:=rangetargetPackage.Platforms {
4646
ifplatform==nil {
4747
continue
@@ -91,6 +91,9 @@ func (s *arduinoCoreServerImpl) PlatformSearch(_ context.Context, req *rpc.Platf
9191
iflatestCompatible:=platform.GetLatestCompatibleRelease();latestCompatible!=nil {
9292
rpcPlatformSummary.LatestVersion=latestCompatible.Version.String()
9393
}
94+
if_,has:=platform.GetManuallyInstalledRelease();has {
95+
rpcPlatformSummary.HasManuallyInstalledRelease=true
96+
}
9497
for_,platformRelease:=rangeplatform.GetAllReleases() {
9598
rpcPlatformRelease:=platformReleaseToRPC(platformRelease)
9699
rpcPlatformSummary.Releases[rpcPlatformRelease.GetVersion()]=rpcPlatformRelease

‎commands/service_platform_uninstall.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func platformUninstall(_ context.Context, req *rpc.PlatformUninstallRequest, tas
7777
ifplatform==nil {
7878
return&cmderrors.PlatformNotFoundError{Platform:ref.String()}
7979
}
80-
platformRelease:=pme.GetInstalledPlatformRelease(platform)
80+
platformRelease:=pme.GetBestInstalledPlatformRelease(platform)
8181
ifplatformRelease==nil {
8282
return&cmderrors.PlatformNotFoundError{Platform:ref.String()}
8383
}

‎commands/service_upload.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ func (s *arduinoCoreServerImpl) runProgramAction(ctx context.Context, pme *packa
362362
returnnil,&cmderrors.PlatformNotFoundError{Platform:split[0]+":"+boardPlatform.Platform.Architecture}
363363
}
364364
uploadToolID=split[1]
365-
uploadToolPlatform=pme.GetInstalledPlatformRelease(p)
365+
uploadToolPlatform=pme.GetBestInstalledPlatformRelease(p)
366366
ifuploadToolPlatform==nil {
367367
returnnil,&cmderrors.PlatformNotFoundError{Platform:split[0]+":"+boardPlatform.Platform.Architecture}
368368
}

‎internal/arduino/cores/cores.go‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type Platform struct {
4040
Architecturestring// The name of the architecture of this package.
4141
Releasesmap[semver.NormalizedString]*PlatformRelease// The Releases of this platform, labeled by version.
4242
Package*Package`json:"-"`
43-
ManuallyInstalledbool// true if the Platformhas been installed without the CLI
43+
ManuallyInstalledbool// true if the Platformexists due to a manually installed release
4444
Deprecatedbool// true if the latest PlatformRelease of this Platform has been deprecated
4545
Indexedbool// true if the Platform has been indexed from additional-urls
4646
Latest*semver.Version`json:"-"`
@@ -238,10 +238,10 @@ func (d *MonitorDependency) String() string {
238238
// GetOrCreateRelease returns the specified release corresponding the provided version,
239239
// or creates a new one if not found.
240240
func (platform*Platform)GetOrCreateRelease(version*semver.Version)*PlatformRelease {
241-
vartag semver.NormalizedString
242-
ifversion!=nil {
243-
tag=version.NormalizedString()
241+
ifversion==nil {
242+
version=semver.MustParse("")
244243
}
244+
tag:=version.NormalizedString()
245245
ifrelease,ok:=platform.Releases[tag];ok {
246246
returnrelease
247247
}
@@ -257,6 +257,13 @@ func (platform *Platform) GetOrCreateRelease(version *semver.Version) *PlatformR
257257
returnrelease
258258
}
259259

260+
// GetManuallyInstalledRelease returns (*PlatformRelease, true) if the Platform has
261+
// a manually installed release or (nil, false) otherwise.
262+
func (platform*Platform)GetManuallyInstalledRelease() (*PlatformRelease,bool) {
263+
res,ok:=platform.Releases[semver.MustParse("").NormalizedString()]
264+
returnres,ok
265+
}
266+
260267
// FindReleaseWithVersion returns the specified release corresponding the provided version,
261268
// or nil if not found.
262269
func (platform*Platform)FindReleaseWithVersion(version*semver.Version)*PlatformRelease {

‎internal/arduino/cores/packageindex/index.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ func (inPlatformRelease indexPlatformRelease) extractPlatformIn(outPackage *core
265265
outPlatform:=outPackage.GetOrCreatePlatform(inPlatformRelease.Architecture)
266266
// If the variable `isInstallJSON` is false it means that the index we're reading is coming from the additional-urls.
267267
// Therefore, the `outPlatform.Indexed` will be set at `true`.
268-
outPlatform.Indexed=outPlatform.Indexed||!isInstallJSON
268+
if!isInstallJSON {
269+
outPlatform.Indexed=true
270+
outPlatform.ManuallyInstalled=false
271+
}
269272

270273
// If the latest platform release is deprecated, then deprecate the whole platform.
271274
ifoutPlatform.Latest==nil||outPlatform.Latest.LessThan(inPlatformRelease.Version) {

‎internal/arduino/cores/packagemanager/install_uninstall.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"encoding/json"
2222
"errors"
23+
"fmt"
2324
"runtime"
2425

2526
"github.com/arduino/arduino-cli/commands/cmderrors"
@@ -41,6 +42,7 @@ func (pme *Explorer) DownloadAndInstallPlatformUpgrades(
4142
skipPostInstallbool,
4243
skipPreUninstallbool,
4344
) (*cores.PlatformRelease,error) {
45+
fmt.Println("D")
4446
ifplatformRef.PlatformVersion!=nil {
4547
returnnil,&cmderrors.InvalidArgumentError{Message:i18n.Tr("Upgrade doesn't accept parameters with version")}
4648
}
@@ -439,7 +441,7 @@ func (pme *Explorer) IsToolRequired(toolRelease *cores.ToolRelease) bool {
439441
// Search in all installed platforms
440442
for_,targetPackage:=rangepme.packages {
441443
for_,platform:=rangetargetPackage.Platforms {
442-
ifplatformRelease:=pme.GetInstalledPlatformRelease(platform);platformRelease!=nil {
444+
ifplatformRelease:=pme.GetBestInstalledPlatformRelease(platform);platformRelease!=nil {
443445
ifplatformRelease.RequiresToolRelease(toolRelease) {
444446
returntrue
445447
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp