You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/03/09 00:06:04 UTC
incubator-mynewt-newt git commit: Get compiler package from BSP's
pkg.yml, instead of target variable.
Repository: incubator-mynewt-newt
Updated Branches:
refs/heads/rename_project_app 1be80b876 -> 9468c1bc5
Get compiler package from BSP's pkg.yml, instead of target variable.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/9468c1bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/9468c1bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/9468c1bc
Branch: refs/heads/rename_project_app
Commit: 9468c1bc5219a5608eda5a28a46cb4ccabb45f15
Parents: 1be80b8
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Mar 8 15:05:18 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Mar 8 15:05:18 2016 -0800
----------------------------------------------------------------------
newt/builder/build.go | 7 +++----
newt/builder/buildutil.go | 10 ++++++++++
newt/pkg/bsp_package.go | 11 ++++++++---
newt/target/target.go | 7 -------
4 files changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/9468c1bc/newt/builder/build.go
----------------------------------------------------------------------
diff --git a/newt/builder/build.go b/newt/builder/build.go
index 185ec37..1f149af 100644
--- a/newt/builder/build.go
+++ b/newt/builder/build.go
@@ -20,7 +20,6 @@
package builder
import (
- "fmt"
"os"
"path/filepath"
@@ -274,7 +273,8 @@ func (b *Builder) PrepBuild() error {
return util.NewNewtError("bsp package not specified")
}
- compilerPkg := b.target.Compiler()
+ b.Bsp = pkg.NewBspPackage(bspPkg)
+ compilerPkg := b.resolveCompiler()
if compilerPkg == nil {
return util.NewNewtError("compiler package not specified")
}
@@ -352,7 +352,7 @@ func (b *Builder) PrepBuild() error {
// Read the BSP configuration. These settings are necessary for the link
// step.
- b.Bsp = pkg.NewBspPackage(bspPkg, b.Features())
+ b.Bsp.Reload(b.Features())
b.compilerPkg = compilerPkg
b.compilerInfo = baseCi
@@ -362,7 +362,6 @@ func (b *Builder) PrepBuild() error {
func (b *Builder) Build() error {
if b.target.App() == nil {
- fmt.Println(b.target)
return util.NewNewtError("app package not specified")
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/9468c1bc/newt/builder/buildutil.go
----------------------------------------------------------------------
diff --git a/newt/builder/buildutil.go b/newt/builder/buildutil.go
index 1db97b2..83ed623 100644
--- a/newt/builder/buildutil.go
+++ b/newt/builder/buildutil.go
@@ -23,6 +23,7 @@ import (
"bytes"
"path/filepath"
+ "mynewt.apache.org/newt/newt/pkg"
"mynewt.apache.org/newt/newt/project"
"mynewt.apache.org/newt/util"
)
@@ -75,6 +76,15 @@ func (b *Builder) featureString() string {
return buffer.String()
}
+func (b *Builder) resolveCompiler() *pkg.LocalPackage {
+ if b.Bsp.CompilerName == "" {
+ return nil
+ }
+ dep, _ := pkg.NewDependency(b.Bsp.Repo(), b.Bsp.CompilerName)
+ mypkg := project.GetProject().ResolveDependency(dep).(*pkg.LocalPackage)
+ return mypkg
+}
+
// Makes sure all packages with required APIs have been augmented with a
// dependency that satisfies that requirement. If there are any unsatisfied
// requirements, an error is returned.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/9468c1bc/newt/pkg/bsp_package.go
----------------------------------------------------------------------
diff --git a/newt/pkg/bsp_package.go b/newt/pkg/bsp_package.go
index ced518c..e744a74 100644
--- a/newt/pkg/bsp_package.go
+++ b/newt/pkg/bsp_package.go
@@ -25,12 +25,15 @@ import (
type BspPackage struct {
*LocalPackage
+ CompilerName string
LinkerScript string
DownloadScript string
DebugScript string
}
-func (bsp *BspPackage) load(features map[string]bool) {
+func (bsp *BspPackage) Reload(features map[string]bool) {
+ bsp.CompilerName = cli.GetStringFeatures(bsp.LocalPackage.Viper, features,
+ "pkg.compiler")
bsp.LinkerScript = cli.GetStringFeatures(bsp.LocalPackage.Viper, features,
"pkg.linkerscript")
bsp.DownloadScript = cli.GetStringFeatures(bsp.LocalPackage.Viper, features,
@@ -39,13 +42,15 @@ func (bsp *BspPackage) load(features map[string]bool) {
"pkg.debugscript")
}
-func NewBspPackage(lpkg *LocalPackage, features map[string]bool) *BspPackage {
+func NewBspPackage(lpkg *LocalPackage) *BspPackage {
bsp := &BspPackage{
+ CompilerName: "",
LinkerScript: "",
DownloadScript: "",
DebugScript: "",
}
+ lpkg.Load()
bsp.LocalPackage = lpkg
- bsp.load(features)
+ bsp.Reload(nil)
return bsp
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/9468c1bc/newt/target/target.go
----------------------------------------------------------------------
diff --git a/newt/target/target.go b/newt/target/target.go
index 62b0b5f..19e55ac 100644
--- a/newt/target/target.go
+++ b/newt/target/target.go
@@ -114,13 +114,6 @@ func (target *Target) ShortName() string {
return filepath.Base(target.Name())
}
-func (target *Target) Compiler() *pkg.LocalPackage {
- dep, _ := pkg.NewDependency(nil, target.CompilerName)
- mypkg := project.GetProject().ResolveDependency(dep).(*pkg.LocalPackage)
-
- return mypkg
-}
-
func (target *Target) App() *pkg.LocalPackage {
dep, err := pkg.NewDependency(nil, target.AppName)
if err != nil {