Hard-wire the path to xcrun as /usr/bin/xcrun.
This lets us not leak $PATH to soong_build. It was only needed for Darwin tests anyway. Test: Will ask jingwen@ who has a Mac. Change-Id: I4647e41275b323fe6283580f8f92718c6229f23e
This commit is contained in:
parent
dfa33be445
commit
21d5c7aaa9
|
@ -527,25 +527,6 @@ func (c *config) HostJavaToolPath(ctx PathContext, path string) Path {
|
|||
return PathForOutput(ctx, "host", c.PrebuiltOS(), "framework", path)
|
||||
}
|
||||
|
||||
// NonHermeticHostSystemTool looks for non-hermetic tools from the system we're
|
||||
// running on. These tools are not checked-in to AOSP, and therefore could lead
|
||||
// to reproducibility problems. Should not be used for other than finding the
|
||||
// XCode SDK (xcrun, sw_vers), etc. See ui/build/paths/config.go for the
|
||||
// allowlist of host system tools.
|
||||
func (c *config) NonHermeticHostSystemTool(name string) string {
|
||||
for _, dir := range filepath.SplitList(c.Getenv("PATH")) {
|
||||
path := filepath.Join(dir, name)
|
||||
if s, err := os.Stat(path); err != nil {
|
||||
continue
|
||||
} else if m := s.Mode(); !s.IsDir() && m&0111 != 0 {
|
||||
return path
|
||||
}
|
||||
}
|
||||
panic(fmt.Errorf(
|
||||
"Cannot find non-hermetic system tool '%s' on path '%s'",
|
||||
name, c.Getenv("PATH")))
|
||||
}
|
||||
|
||||
// PrebuiltOS returns the name of the host OS used in prebuilts directories.
|
||||
func (c *config) PrebuiltOS() string {
|
||||
switch runtime.GOOS {
|
||||
|
|
|
@ -136,7 +136,7 @@ var macTools = &macPlatformTools{}
|
|||
|
||||
func getMacTools(ctx android.PackageVarContext) *macPlatformTools {
|
||||
macTools.once.Do(func() {
|
||||
xcrunTool := ctx.Config().NonHermeticHostSystemTool("xcrun")
|
||||
xcrunTool := "/usr/bin/xcrun"
|
||||
|
||||
xcrun := func(args ...string) string {
|
||||
if macTools.err != nil {
|
||||
|
|
|
@ -177,14 +177,6 @@ func runSoong(ctx Context, config Config) {
|
|||
ninjaEnv.Set("TOP", os.Getenv("TOP"))
|
||||
ninjaEnv.Set("SOONG_OUTDIR", config.SoongOutDir())
|
||||
|
||||
// Needed for NonHermeticHostSystemTool() and that, only in tests. We should
|
||||
// probably find a better way of running tests other than making $PATH
|
||||
// available also to production builds. Note that this is not get same as
|
||||
// os.Getenv("PATH"): config.Environment() contains the $PATH that redirects
|
||||
// every binary through the path interposer.
|
||||
configPath, _ := config.Environment().Get("PATH")
|
||||
ninjaEnv.Set("PATH", configPath)
|
||||
|
||||
// For debugging
|
||||
if os.Getenv("SOONG_DELVE") != "" {
|
||||
ninjaEnv.Set("SOONG_DELVE", os.Getenv("SOONG_DELVE"))
|
||||
|
|
Loading…
Reference in New Issue