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/11/04 22:40:41 UTC

incubator-mynewt-newt git commit: MYNEWT-470 - newt: delete old bld artifacts

Repository: incubator-mynewt-newt
Updated Branches:
  refs/heads/develop 67dc62ae9 -> 035421ea9


MYNEWT-470 - newt: delete old bld artifacts

// Deletes files that should never be reused for a subsequent build.
// This list includes:
//     <app>.img
//     <app>.elf.bin
//     manifest.json
func (b *Builder) CleanArtifacts() {
    // ...
}


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

Branch: refs/heads/develop
Commit: 035421ea967f4e33d477edc6612621f530d59ce4
Parents: 67dc62a
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Nov 4 15:39:12 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Nov 4 15:39:12 2016 -0700

----------------------------------------------------------------------
 newt/builder/build.go | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/035421ea/newt/builder/build.go
----------------------------------------------------------------------
diff --git a/newt/builder/build.go b/newt/builder/build.go
index b5f0352..b01e78c 100644
--- a/newt/builder/build.go
+++ b/newt/builder/build.go
@@ -351,6 +351,8 @@ func (b *Builder) PrepBuild() error {
 
 	b.logDepInfo()
 
+	b.CleanArtifacts()
+
 	// Populate the base set of compiler flags.  Flags from the following
 	// packages get applied to every source file:
 	//     * target
@@ -667,3 +669,21 @@ func (b *Builder) CreateImage(version string,
 
 	return img, nil
 }
+
+// Deletes files that should never be reused for a subsequent build.  This
+// list includes:
+//     <app>.img
+//     <app>.elf.bin
+//     manifest.json
+func (b *Builder) CleanArtifacts() {
+	paths := []string{
+		b.AppImgPath(),
+		b.AppBinPath(),
+		b.ManifestPath(),
+	}
+
+	// Attempt to delete each artifact, ignoring errors.
+	for _, p := range paths {
+		os.Remove(p)
+	}
+}