Teach Soong to use a custom Delve binary.

If SOONG_DELVE_PATH=<path> is set, Soong will use that as the path to
dlv. Otherwise, it will use the one on $PATH as usual.

Test: Manual.
Change-Id: Id4334f05d077a911750f601865bd3096d852d69c
This commit is contained in:
Lukacs T. Berki
2020-11-06 10:42:50 +01:00
parent 1a3922bf09
commit 848e00edc0

View File

@@ -41,7 +41,10 @@ func init() {
// access originalEnv with dependencies. Store the value where soong_build can find it, it will manually
// ensure the dependencies are created.
soongDelveListen = os.Getenv("SOONG_DELVE")
soongDelvePath, _ = exec.LookPath("dlv")
soongDelvePath = os.Getenv("SOONG_DELVE_PATH")
if soongDelvePath == "" {
soongDelvePath, _ = exec.LookPath("dlv")
}
originalEnv = make(map[string]string)
soongDelveEnv = []string{}
@@ -49,7 +52,7 @@ func init() {
idx := strings.IndexRune(env, '=')
if idx != -1 {
originalEnv[env[:idx]] = env[idx+1:]
if env[:idx] != "SOONG_DELVE" {
if env[:idx] != "SOONG_DELVE" && env[:idx] != "SOONG_DELVE_PATH" {
soongDelveEnv = append(soongDelveEnv, env)
}
}