You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2019/03/14 18:46:06 UTC

[mynewt-newt] branch master updated: Allow @repo/cfg.yml style import paths

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

utzig 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 c5632c2  Allow @repo/cfg.yml style import paths
c5632c2 is described below

commit c5632c20daf367a4be012c48fe2922ca5c20c706
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Thu Mar 14 09:21:12 2019 -0700

    Allow @repo/cfg.yml style import paths
    
    Prior to this commit, paths specified in `$import` were either:
        * absolute path
        * relative path (relative to project base).
    
    Now, a third type of import path is supported:
        * repo path (e.g., "@apache-mynewt-core/myconfigs/cfg.yml")
---
 newt/config/config.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/newt/config/config.go b/newt/config/config.go
index b35ff8d..29831ea 100644
--- a/newt/config/config.go
+++ b/newt/config/config.go
@@ -130,7 +130,12 @@ func readLineage(path string) ([]FileEntry, error) {
 	iter = func(path string, parent *util.FileInfo) error {
 		// Relative paths are relative to the project base.
 		if !filepath.IsAbs(path) {
-			path = filepath.Join(interfaces.GetProject().Path(), path)
+			proj := interfaces.GetProject()
+			newPath, err := proj.ResolvePath(proj.Path(), path)
+			if err != nil {
+				return err
+			}
+			path = newPath
 		}
 
 		// Only operate on absolute paths to ensure each file has a unique ID.