зеркало из https://github.com/github/codeql.git
Expose toolchains to some Android tests, which would otherwise now try to upgrade to JDK17
This commit is contained in:
Родитель
c328957bf3
Коммит
9c823d708d
|
@ -0,0 +1,42 @@
|
|||
import os.path
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
def actions_expose_all_toolchains():
|
||||
|
||||
# On actions, expose all usable toolchains so that we can test version-selection logic.
|
||||
|
||||
toolchains_dir = tempfile.mkdtemp(prefix="integration-tests-toolchains-")
|
||||
toolchains_file = os.path.join(toolchains_dir, "toolchains.xml")
|
||||
|
||||
def none_or_blank(s):
|
||||
return s is None or s == ""
|
||||
|
||||
with open(toolchains_file, "w") as f:
|
||||
f.write('<?xml version="1.0" encoding="UTF-8"?>\n<toolchains>\n')
|
||||
|
||||
for v in [8, 11, 17, 21]:
|
||||
homedir = os.getenv("JAVA_HOME_%d_X64" % v)
|
||||
if none_or_blank(homedir):
|
||||
homedir = os.getenv("JAVA_HOME_%d_arm64" % v)
|
||||
if none_or_blank(homedir) and v == 8 and not none_or_blank(os.getenv("JAVA_HOME_11_arm64")):
|
||||
print("Mocking a toolchain entry using Java 11 install as a fake Java 8 entry, so this test behaves the same on x64 and arm64 runners", file = sys.stderr)
|
||||
homedir = os.getenv("JAVA_HOME_11_arm64")
|
||||
if homedir is not None and homedir != "":
|
||||
f.write("""
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
<version>%d</version>
|
||||
<vendor>oracle</vendor>
|
||||
</provides>
|
||||
<configuration>
|
||||
<jdkHome>%s</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
""" % (v, homedir))
|
||||
|
||||
f.write("</toolchains>")
|
||||
|
||||
return toolchains_file
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
import sys
|
||||
from create_database_utils import *
|
||||
from toolchains_test_utils import *
|
||||
|
||||
try_use_java11()
|
||||
|
||||
run_codeql_database_create([], lang="java")
|
||||
toolchains_file = actions_expose_all_toolchains()
|
||||
|
||||
run_codeql_database_create([], lang="java", extra_env={"LGTM_INDEX_MAVEN_TOOLCHAINS_FILE": toolchains_file})
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import sys
|
||||
|
||||
from create_database_utils import *
|
||||
from toolchains_test_utils import *
|
||||
|
||||
try_use_java11()
|
||||
|
||||
run_codeql_database_create([], lang="java")
|
||||
toolchains_file = actions_expose_all_toolchains()
|
||||
|
||||
run_codeql_database_create([], lang="java", extra_env={"LGTM_INDEX_MAVEN_TOOLCHAINS_FILE": toolchains_file})
|
||||
|
|
|
@ -1,47 +1,12 @@
|
|||
from create_database_utils import *
|
||||
from diagnostics_test_utils import *
|
||||
from buildless_test_utils import *
|
||||
|
||||
import tempfile
|
||||
import os.path
|
||||
import sys
|
||||
from toolchains_test_utils import *
|
||||
|
||||
#The version of gradle used doesn't work on java 17
|
||||
try_use_java11()
|
||||
|
||||
# On actions, expose all usable toolchains so that we can test version-selection logic.
|
||||
|
||||
toolchains_dir = tempfile.mkdtemp(prefix="integration-tests-toolchains-")
|
||||
toolchains_file = os.path.join(toolchains_dir, "toolchains.xml")
|
||||
|
||||
def none_or_blank(s):
|
||||
return s is None or s == ""
|
||||
|
||||
with open(toolchains_file, "w") as f:
|
||||
f.write('<?xml version="1.0" encoding="UTF-8"?>\n<toolchains>\n')
|
||||
|
||||
for v in [8, 11, 17, 21]:
|
||||
homedir = os.getenv("JAVA_HOME_%d_X64" % v)
|
||||
if none_or_blank(homedir):
|
||||
homedir = os.getenv("JAVA_HOME_%d_arm64" % v)
|
||||
if none_or_blank(homedir) and v == 8 and not none_or_blank(os.getenv("JAVA_HOME_11_arm64")):
|
||||
print("Mocking a toolchain entry using Java 11 install as a fake Java 8 entry, so this test behaves the same on x64 and arm64 runners", file = sys.stderr)
|
||||
homedir = os.getenv("JAVA_HOME_11_arm64")
|
||||
if homedir is not None and homedir != "":
|
||||
f.write("""
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
<version>%d</version>
|
||||
<vendor>oracle</vendor>
|
||||
</provides>
|
||||
<configuration>
|
||||
<jdkHome>%s</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
""" % (v, homedir))
|
||||
|
||||
f.write("</toolchains>")
|
||||
toolchains_file = actions_expose_all_toolchains()
|
||||
|
||||
run_codeql_database_create([], lang="java", extra_env={"CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS": "true", "CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS_CLASSPATH_FROM_BUILD_FILES": "true", "LGTM_INDEX_MAVEN_TOOLCHAINS_FILE": toolchains_file})
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче