Bug 1527796 - Part 5. Add python.exe path of mozilla-build to call mach command from gradle. r=nalexander

Since gradle doesn't run on sh.exe, it requires python path to run mach command.
But gradle doesn't have a way to detect python.exe.

When using MozillaBuild, it sets MOZILLABUILD environment value, so we can
detect python path in MozillaBuild using it if available.

Differential Revision: https://phabricator.services.mozilla.com/D20454

--HG--
extra : rebase_source : bba5ae6b8b53c408e8f80db3202458e177eecca4
This commit is contained in:
Makoto Kato 2019-03-29 18:11:09 +09:00
Родитель 2a4158c8eb
Коммит 4efd6396b0
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -3,6 +3,16 @@
def topsrcdir = rootProject.projectDir.absolutePath
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
if (mozillabuild) {
commandLine.addAll(0, ["${mozillabuild}/python/python.exe"])
}
}
}
def proc = commandLine.execute(null, new File(topsrcdir))
def standardOutput = new ByteArrayOutputStream()
proc.consumeProcessOutput(standardOutput, standardOutput)