This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


The following commit(s) were added to refs/heads/master by this push:
     new 33cae11  Add MYNEWT_PROJECT_ROOT env variable
33cae11 is described below

commit 33cae11f5c4d9120413840d129680a9fa274f6da
Author: Naveen Kaje <naveen.k...@juul.com>
AuthorDate: Fri Aug 9 13:32:41 2019 -0500

    Add MYNEWT_PROJECT_ROOT env variable
    
    This variable defines a standard way to access
    the root of the project.
---
 newt/builder/load.go  | 2 ++
 newt/builder/paths.go | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/newt/builder/load.go b/newt/builder/load.go
index ddfe36c..0f0eeff 100644
--- a/newt/builder/load.go
+++ b/newt/builder/load.go
@@ -77,6 +77,7 @@ func Load(binBaseName string, bspPkg *pkg.BspPackage,
        env = append(env, fmt.Sprintf("BSP_PATH=%s", bspPath))
        env = append(env, fmt.Sprintf("BIN_BASENAME=%s", binBaseName))
        env = append(env, fmt.Sprintf("BIN_ROOT=%s", BinRoot()))
+       env = append(env, fmt.Sprintf("MYNEWT_PROJECT_ROOT=%s", ProjectRoot()))
 
        // bspPath, binBaseName are passed in command line for backwards
        // compatibility
@@ -192,6 +193,7 @@ func (b *Builder) debugBin(binPath string, extraJtagCmd 
string, reset bool,
                fmt.Sprintf("BSP_PATH=%s", bspPath),
                fmt.Sprintf("BIN_BASENAME=%s", binBaseName),
                fmt.Sprintf("FEATURES=%s", featureString),
+               fmt.Sprintf("MYNEWT_PROJECT_ROOT=%s", ProjectRoot()),
        }
        if extraJtagCmd != "" {
                envSettings = append(envSettings,
diff --git a/newt/builder/paths.go b/newt/builder/paths.go
index 17995fe..68b75b2 100644
--- a/newt/builder/paths.go
+++ b/newt/builder/paths.go
@@ -31,6 +31,10 @@ import (
 const BUILD_NAME_APP = "app"
 const BUILD_NAME_LOADER = "loader"
 
+func ProjectRoot() string {
+       return project.GetProject().Path()
+}
+
 func BinRoot() string {
        return project.GetProject().Path() + "/bin"
 }

Reply via email to