Merge "Ensure environment dependencies are correct"
This commit is contained in:
commit
6a76b144a9
|
@ -289,7 +289,7 @@ func (c *config) Getenv(key string) string {
|
|||
if c.envFrozen {
|
||||
panic("Cannot access new environment variables after envdeps are frozen")
|
||||
}
|
||||
val = os.Getenv(key)
|
||||
val, _ = originalEnv[key]
|
||||
c.envDeps[key] = val
|
||||
}
|
||||
return val
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
package android
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"android/soong/env"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
|
@ -27,6 +30,19 @@ import (
|
|||
// compare the contents of the environment variables, rewriting the file if necessary to cause
|
||||
// a manifest regeneration.
|
||||
|
||||
var originalEnv map[string]string
|
||||
|
||||
func init() {
|
||||
originalEnv = make(map[string]string)
|
||||
for _, env := range os.Environ() {
|
||||
idx := strings.IndexRune(env, '=')
|
||||
if idx != -1 {
|
||||
originalEnv[env[:idx]] = env[idx+1:]
|
||||
}
|
||||
}
|
||||
os.Clearenv()
|
||||
}
|
||||
|
||||
func EnvSingleton() blueprint.Singleton {
|
||||
return &envSingleton{}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue