From c8e51b0e53909aa79077ccd9d82c226f6bdacc1a Mon Sep 17 00:00:00 2001 From: Michael Muller Date: Wed, 6 Oct 2021 10:09:13 -0400 Subject: [PATCH] Defer python discovery until presubmit task (#1352) * Customize LGTM build command Our presubmit requires a version of python that is more recent than what lgtm.com's build environments have installed. Instead of trying to upgrade them or downgrade our python version, just do the steps of the build that LGTM needs (i.e. just build the main classes and test classes). --- build.gradle | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 6e5465623..3c17d6f20 100644 --- a/build.gradle +++ b/build.gradle @@ -209,19 +209,22 @@ rootProject.ext { task runPresubmits(type: Exec) { - // Find a python version greater than 3.7.3 (this is somewhat arbitrary, we - // know we'd like at least 3.6, but 3.7.3 is the latest that ships with - // Debian so it seems like that should be available anywhere). - def MIN_PY_VER = 0x3070300 - if (pyver('python') >= MIN_PY_VER) { - executable 'python' - } else if (pyver('/usr/bin/python3') >= MIN_PY_VER) { - executable '/usr/bin/python3' - } else { - throw new GradleException("No usable Python version found (build " + - "requires at least python 3.7.3)"); - } args('config/presubmits.py') + + doFirst { + // Find a python version greater than 3.7.3 (this is somewhat arbitrary, we + // know we'd like at least 3.6, but 3.7.3 is the latest that ships with + // Debian so it seems like that should be available anywhere). + def MIN_PY_VER = 0x3070300 + if (pyver('python') >= MIN_PY_VER) { + executable 'python' + } else if (pyver('/usr/bin/python3') >= MIN_PY_VER) { + executable '/usr/bin/python3' + } else { + throw new GradleException("No usable Python version found (build " + + "requires at least python 3.7.3)"); + } + } } def javadocSource = []