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 db229b2  Remove "final-atom" target specifier type
db229b2 is described below

commit db229b26d5f81779d3bf9e78a2d776fc247cb9df
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Mon Mar 2 15:12:28 2020 -0800

    Remove "final-atom" target specifier type
    
    Prior to this commit, newt allowed a target to be specified in any of
    three ways:
    
    1. Fully qualified name:
        `@myrepo/targets/blinky`
    
    2. Implicit `targets` directory in local repo:
        `blinky` (resolves to `targets/blinky`)
    
    3. Final atom in target package name:
        `slinky_sim` (could resolve to `extra/my_stuff/slinky_sim`)
    
    This commit removes support for the third type of specifier.
    
    This third type of specifies is actually just a buggy attempt to support
    something else.  The intent was to allow the name of a target in a
    different repo without requiring the `@repo-name` prefix.  The
    implementation is buggy because it allows the user to omit more than
    just the repo name.  It also applies to the top-level project when it is
    only intended for targets in other repos.
    
    Allowing this type of specifier is bad because it can lead to
    ambiguities.  For example, if a project contains two targets:
    
        targets/arch1/blinky
        targets/arch2/blinky
    
    then the command `newt build blinky` is ambiguous.  Currently, newt just
    selects the target whose name comes first in a lexicographic sort
    (arch1).
    
    Rather than detect ambiguities, this commit just removes support for
    this type of target specifier entirely.
---
 newt/cli/util.go | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/newt/cli/util.go b/newt/cli/util.go
index 4346659..75f6028 100644
--- a/newt/cli/util.go
+++ b/newt/cli/util.go
@@ -24,7 +24,6 @@ import (
        "bytes"
        "fmt"
        "os"
-       "path/filepath"
        "regexp"
        "strings"
 
@@ -101,17 +100,6 @@ func ResolveTarget(name string) *target.Target {
                return t
        }
 
-       // Check each repo alphabetically.
-       fullNames := []string{}
-       for fullName, _ := range targetMap {
-               fullNames = append(fullNames, fullName)
-       }
-       for _, fullName := range util.SortFields(fullNames...) {
-               if name == filepath.Base(fullName) {
-                       return targetMap[fullName]
-               }
-       }
-
        return nil
 }
 

Reply via email to