You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/09/30 22:03:27 UTC

incubator-mynewt-newt git commit: newt - Allow "clean unittest"

Repository: incubator-mynewt-newt
Updated Branches:
  refs/heads/develop 81c930327 -> 23179e28e


newt - Allow "clean unittest"


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/23179e28
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/23179e28
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/23179e28

Branch: refs/heads/develop
Commit: 23179e28e162517b246d36924deba63ec1af4abf
Parents: 81c9303
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Sep 30 15:03:11 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Sep 30 15:03:11 2016 -0700

----------------------------------------------------------------------
 newt/builder/build.go       |  8 --------
 newt/builder/buildutil.go   |  5 +++++
 newt/builder/targetbuild.go | 19 +++++++++----------
 3 files changed, 14 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/23179e28/newt/builder/build.go
----------------------------------------------------------------------
diff --git a/newt/builder/build.go b/newt/builder/build.go
index 606e5ff..271372c 100644
--- a/newt/builder/build.go
+++ b/newt/builder/build.go
@@ -630,14 +630,6 @@ func (b *Builder) Test(p *pkg.LocalPackage) error {
 	return nil
 }
 
-func (b *Builder) Clean() error {
-	path := b.BinDir()
-	util.StatusMessage(util.VERBOSITY_VERBOSE, "Cleaning directory %s\n",
-		path)
-	err := os.RemoveAll(path)
-	return err
-}
-
 func (b *Builder) FetchSymbolMap() (error, *symbol.SymbolMap) {
 	loader_sm := symbol.NewSymbolMap()
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/23179e28/newt/builder/buildutil.go
----------------------------------------------------------------------
diff --git a/newt/builder/buildutil.go b/newt/builder/buildutil.go
index bc68212..be87509 100644
--- a/newt/builder/buildutil.go
+++ b/newt/builder/buildutil.go
@@ -29,6 +29,7 @@ import (
 
 	"mynewt.apache.org/newt/newt/pkg"
 	"mynewt.apache.org/newt/newt/project"
+	"mynewt.apache.org/newt/newt/target"
 	"mynewt.apache.org/newt/util"
 )
 
@@ -36,6 +37,10 @@ func BinRoot() string {
 	return project.GetProject().Path() + "/bin"
 }
 
+func TargetBinDir(target *target.Target) string {
+	return BinRoot() + "/" + target.Name()
+}
+
 func (b *Builder) BinDir() string {
 	return BinRoot() + "/" + b.target.target.Name() + "/" + b.buildName
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/23179e28/newt/builder/targetbuild.go
----------------------------------------------------------------------
diff --git a/newt/builder/targetbuild.go b/newt/builder/targetbuild.go
index 5e16139..0ca8154 100644
--- a/newt/builder/targetbuild.go
+++ b/newt/builder/targetbuild.go
@@ -21,6 +21,7 @@ package builder
 
 import (
 	"fmt"
+	"os"
 	"strings"
 
 	"mynewt.apache.org/newt/newt/interfaces"
@@ -428,17 +429,15 @@ func (t *TargetBuilder) resolveCompiler() *pkg.LocalPackage {
 }
 
 func (t *TargetBuilder) Clean() error {
-	var err error
-
-	err = t.PrepBuild()
-
-	if err == nil && t.App != nil {
-		err = t.App.Clean()
-	}
-	if err == nil && t.Loader != nil {
-		err = t.Loader.Clean()
+	path := TargetBinDir(t.target)
+	util.StatusMessage(util.VERBOSITY_VERBOSE, "Cleaning directory %s\n",
+		path)
+	err := os.RemoveAll(path)
+	if err != nil {
+		return util.NewNewtError(err.Error())
 	}
-	return err
+
+	return nil
 }
 
 func (t *TargetBuilder) GetTarget() *target.Target {