Hard-wire the path to xcrun as /usr/bin/xcrun. am: 21d5c7aaa9 am: 8f23c72f9e

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1626516

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I438f4b45ca2e5665ce4b234bafec763893356ce4
This commit is contained in:
Lukacs T. Berki 2021-03-11 11:57:06 +00:00 committed by Automerger Merge Worker
commit 177e95d4d6
3 changed files with 1 additions and 28 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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"))