Skip to content

Commit bb7d413

Browse files
committed
Use ctx.PackageManager.GetInstalledPlatformRelease instead of PlatformRelease.GetInstalled
1 parent 48454f7 commit bb7d413

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

hardware_loader.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ import (
3838
type HardwareLoader struct{}
3939

4040
func (s *HardwareLoader) Run(ctx *types.Context) error {
41-
pm := packagemanager.NewPackageManager(nil, nil, nil, nil)
42-
if err := pm.LoadHardwareFromDirectories(ctx.HardwareDirs); err != nil {
43-
return i18n.WrapError(err)
41+
if ctx.PackageManager == nil {
42+
pm := packagemanager.NewPackageManager(nil, nil, nil, nil)
43+
if err := pm.LoadHardwareFromDirectories(ctx.HardwareDirs); err != nil {
44+
return i18n.WrapError(err)
45+
}
46+
ctx.PackageManager = pm
4447
}
45-
ctx.PackageManager = pm
46-
ctx.Hardware = pm.GetPackages()
48+
ctx.Hardware = ctx.PackageManager.GetPackages()
4749
return nil
4850
}

setup_build_properties.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,16 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
8787
if variant == "" {
8888
buildProperties["build.variant.path"] = ""
8989
} else {
90-
var variantPlatform *cores.PlatformRelease
90+
var variantPlatformRelease *cores.PlatformRelease
9191
variantParts := strings.Split(variant, ":")
9292
if len(variantParts) > 1 {
93-
variantPlatform = packages.Packages[variantParts[0]].Platforms[targetPlatform.Platform.Architecture].GetInstalled()
93+
variantPlatform := packages.Packages[variantParts[0]].Platforms[targetPlatform.Platform.Architecture]
94+
variantPlatformRelease = ctx.PackageManager.GetInstalledPlatformRelease(variantPlatform)
9495
variant = variantParts[1]
9596
} else {
96-
variantPlatform = targetPlatform
97+
variantPlatformRelease = targetPlatform
9798
}
98-
buildProperties["build.variant.path"] = variantPlatform.InstallDir.Join("variants", variant).String()
99+
buildProperties["build.variant.path"] = variantPlatformRelease.InstallDir.Join("variants", variant).String()
99100
}
100101

101102
for _, tool := range ctx.AllTools {

0 commit comments

Comments
 (0)