Merge pull request #13187 from github/mbg/java/fix-java-version-too-old-more

Java: Use empty toolchains.xml for the `java-version-too-old` test
This commit is contained in:
Michael B. Gale
2023-05-16 19:26:07 +01:00
committed by GitHub
2 changed files with 12 additions and 1 deletions

View File

@@ -13,6 +13,12 @@ for k in ["JAVA_HOME_11_X64", "JAVA_HOME_17_X64"]:
if k in os.environ:
del os.environ[k]
run_codeql_database_create([], lang="java", runFunction = runUnsuccessfully, db = None)
# Use a custom, empty toolchains.xml file so the autobuilder doesn't see any Java versions that may be
# in a system-level toolchains file
toolchains_path = os.path.join(os.getcwd(), 'toolchains.xml')
run_codeql_database_create([], lang="java", runFunction = runUnsuccessfully, db = None, extra_env={
'LGTM_INDEX_MAVEN_TOOLCHAINS_FILE': toolchains_path
})
check_diagnostics()

View File

@@ -0,0 +1,5 @@
<?xml version="1.0"?>
<toolchains xmlns="https://maven.apache.org/TOOLCHAINS/1.1.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
</toolchains>