Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 831472de authored by Orion Hodson's avatar Orion Hodson
Browse files

Update finding go files

Add gogrep for grepping golang files.

Extend mgrep to search for files in subfolders of build and soong
directories.

Test: source build/envsetup.sh && gogrep DepsMutators
Test: source build/envsetup.sh && mgrep ProductPrivateSepolicyDirs

Change-Id: I26fd9ba5ba0b81b202154aa527ed4a0aa60c1c54
parent e8d9df12
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
- provision:  Flash device with all required partitions. Options will be passed on to fastboot.
- provision:  Flash device with all required partitions. Options will be passed on to fastboot.
- cgrep:      Greps on all local C/C++ files.
- cgrep:      Greps on all local C/C++ files.
- ggrep:      Greps on all local Gradle files.
- ggrep:      Greps on all local Gradle files.
- gogrep:     Greps on all local Go files.
- jgrep:      Greps on all local Java files.
- jgrep:      Greps on all local Java files.
- resgrep:    Greps on all local res/*.xml files.
- resgrep:    Greps on all local res/*.xml files.
- mangrep:    Greps on all local AndroidManifest.xml files.
- mangrep:    Greps on all local AndroidManifest.xml files.
@@ -968,6 +969,12 @@ function ggrep()
        -exec grep --color -n "$@" {} +
        -exec grep --color -n "$@" {} +
}
}


function gogrep()
{
    find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.go" \
        -exec grep --color -n "$@" {} +
}

function jgrep()
function jgrep()
{
{
    find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.java" \
    find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.java" \
@@ -1016,7 +1023,7 @@ case `uname -s` in
    Darwin)
    Darwin)
        function mgrep()
        function mgrep()
        {
        {
            find -E . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o \( -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' -o -regex '(.*/)?soong/[^/]*.go' \) -type f \
            find -E . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o \( -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' -o -regex '(.*/)?(build|soong)/.*[^/]*\.go' \) -type f \
                -exec grep --color -n "$@" {} +
                -exec grep --color -n "$@" {} +
        }
        }


@@ -1030,7 +1037,7 @@ case `uname -s` in
    *)
    *)
        function mgrep()
        function mgrep()
        {
        {
            find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o \( -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' -o -regextype posix-extended -regex '(.*/)?soong/[^/]*.go' \) -type f \
            find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o \( -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' -o -regextype posix-extended -regex '(.*/)?(build|soong)/.*[^/]*\.go' \) -type f \
                -exec grep --color -n "$@" {} +
                -exec grep --color -n "$@" {} +
        }
        }