``` modified build/moz.configure/toolchain.configure @@ -767,22 +767,24 @@ def toolchain_search_path_for(host_or_ta host: host_vc_compiler_path, target: vc_compiler_path, }[host_or_target] - @depends(vc_path, original_path) + @depends(vc_path, original_path, 'MOZ_AUTOMATION') @imports('os') @imports(_from='os', _import='environ') - def toolchain_search_path(vc_compiler_path, original_path): - result = list(original_path) + def toolchain_search_path(vc_compiler_path, original_path, automation): + vc_result = list(original_path) if vc_compiler_path: # The second item, if there is one, is necessary to have in $PATH for # Windows to load the required DLLs from there. if len(vc_compiler_path) > 1: - environ['PATH'] = os.pathsep.join(result + vc_compiler_path[1:]) + environ['PATH'] = os.pathsep.join(vc_result + vc_compiler_path[1:]) # The first item is where the programs are going to be - result.append(vc_compiler_path[0]) + vc_result.append(vc_compiler_path[0]) + + result = list() # Also add in the location to which `mach bootstrap` or # `mach artifact toolchain` installs clang. mozbuild_state_dir = environ.get('MOZBUILD_STATE_PATH', @@ -796,9 +798,17 @@ def toolchain_search_path_for(host_or_ta # Also add the rustup install directory for cargo/rustc. rustup_path = os.path.expanduser(os.path.join('~', '.cargo', 'bin')) result.append(rustup_path) - return result + if not automation: + # Prefer ~/.mozbuild/clang for local developer builds. + return result + vc_result + else: + return vc_result + result + return toolchain_search_path ```
Bug 1519954 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
```diff modified build/moz.configure/toolchain.configure @@ -767,22 +767,24 @@ def toolchain_search_path_for(host_or_ta host: host_vc_compiler_path, target: vc_compiler_path, }[host_or_target] - @depends(vc_path, original_path) + @depends(vc_path, original_path, 'MOZ_AUTOMATION') @imports('os') @imports(_from='os', _import='environ') - def toolchain_search_path(vc_compiler_path, original_path): - result = list(original_path) + def toolchain_search_path(vc_compiler_path, original_path, automation): + vc_result = list(original_path) if vc_compiler_path: # The second item, if there is one, is necessary to have in $PATH for # Windows to load the required DLLs from there. if len(vc_compiler_path) > 1: - environ['PATH'] = os.pathsep.join(result + vc_compiler_path[1:]) + environ['PATH'] = os.pathsep.join(vc_result + vc_compiler_path[1:]) # The first item is where the programs are going to be - result.append(vc_compiler_path[0]) + vc_result.append(vc_compiler_path[0]) + + result = list() # Also add in the location to which `mach bootstrap` or # `mach artifact toolchain` installs clang. mozbuild_state_dir = environ.get('MOZBUILD_STATE_PATH', @@ -796,9 +798,17 @@ def toolchain_search_path_for(host_or_ta # Also add the rustup install directory for cargo/rustc. rustup_path = os.path.expanduser(os.path.join('~', '.cargo', 'bin')) result.append(rustup_path) - return result + if not automation: + # Prefer ~/.mozbuild/clang for local developer builds. + return result + vc_result + else: + return vc_result + result + return toolchain_search_path ```