mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Kotlin: Build the appropriate single version, rather than always 1.5
This commit is contained in:
@@ -173,4 +173,4 @@ if args.many:
|
||||
compile_standalone(version)
|
||||
compile_embeddable(version)
|
||||
else:
|
||||
compile_standalone(kotlin_plugin_versions.single_version)
|
||||
compile_standalone(kotlin_plugin_versions.get_single_version())
|
||||
|
||||
@@ -1,2 +1,15 @@
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
many_versions = [ '1.4.32', '1.5.31', '1.6.0-RC2' ]
|
||||
single_version = '1.5.31'
|
||||
|
||||
def get_single_version():
|
||||
versionOutput = subprocess.run(['kotlinc', '-version'], capture_output=True, text=True)
|
||||
m = re.match(r'.* kotlinc-jvm ([0-9]+\.[0-9]+\.)[0-9]+ .*', versionOutput.stderr)
|
||||
if m is None:
|
||||
raise Exception('Cannot detect version of kotlinc')
|
||||
prefix = m.group(1)
|
||||
for version in many_versions:
|
||||
if version.startswith(prefix):
|
||||
return version
|
||||
raise Exception('No suitable kotlinc version found for ' + prefix)
|
||||
|
||||
Reference in New Issue
Block a user