forked from mirrors/gecko-dev
Bug 1844838 - Use default python3 outside MozillaBuild on Windows r=m_kato,geckoview-reviewers
The current method fails when Mach is called outside MozillaBuild (https://firefox-source-docs.mozilla.org/mach/windows-usage-outside-mozillabuild.html), as `./mach environment` called inside gradle uses different Python and causes conflict in `~/.mozbuild`. Differential Revision: https://phabricator.services.mozilla.com/D184255
This commit is contained in:
parent
7a807d1ea2
commit
d2a61d9c63
2 changed files with 5 additions and 9 deletions
|
|
@ -5,6 +5,7 @@
|
|||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import mozpack.path as mozpath
|
||||
from mach.decorators import Command, CommandArgument, SubCommand
|
||||
|
|
@ -492,6 +493,8 @@ def gradle(command_context, args, verbose=False):
|
|||
"GRADLE_OPTS": "-Dfile.encoding=utf-8",
|
||||
"JAVA_HOME": java_home,
|
||||
"JAVA_TOOL_OPTIONS": "-Dfile.encoding=utf-8",
|
||||
# Let Gradle get the right Python path on Windows
|
||||
"GRADLE_MACH_PYTHON": sys.executable,
|
||||
}
|
||||
)
|
||||
# Set ANDROID_SDK_ROOT if --with-android-sdk was set.
|
||||
|
|
|
|||
|
|
@ -5,15 +5,8 @@ def topsrcdir = rootProject.projectDir.absolutePath
|
|||
apply from: "${topsrcdir}/mobile/android/gradle/mach_env.gradle"
|
||||
|
||||
def commandLine = ["${topsrcdir}/mach", "environment", "--format", "json", "--verbose"]
|
||||
if (System.properties['os.name'].toLowerCase().contains('windows')) {
|
||||
// gradle is called before parsing config.status, we cannot use PYTHON
|
||||
// value.
|
||||
if (System.env.MOZILLABUILD) {
|
||||
def mozillabuild = System.env.MOZILLABUILD.toLowerCase()
|
||||
if (mozillabuild) {
|
||||
commandLine.addAll(0, ["${mozillabuild}/python3/python3.exe"])
|
||||
}
|
||||
}
|
||||
if (System.env.GRADLE_MACH_PYTHON) {
|
||||
commandLine.addAll(0, [System.env.GRADLE_MACH_PYTHON])
|
||||
}
|
||||
|
||||
def proc = commandLine.execute(machEnv(topsrcdir), new File(topsrcdir))
|
||||
|
|
|
|||
Loading…
Reference in a new issue