Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 61728e6

Browse files
committed
Kotlin: Tweak kotlin_plugin_versions.py
1 parent 0610917 commit 61728e6

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1+
import platform
12
import re
23
import subprocess
34

5+
def is_windows():
6+
'''Whether we appear to be running on Windows'''
7+
if platform.system() == 'Windows':
8+
return True
9+
if platform.system().startswith('CYGWIN'):
10+
return True
11+
return False
12+
413
many_versions = [ '1.4.32', '1.5.31', '1.6.10' ]
514

615
def get_single_version():
7-
# TODO: "shell=True" is a workaround to get CI working on Windows
8-
versionOutput = subprocess.run(['kotlinc', '-version'], capture_output=True, text=True, shell=True)
16+
# TODO: `shell=True` is a workaround to get CI working on Windows. It break the build on Linux.
17+
versionOutput = subprocess.run(['kotlinc', '-version'], capture_output=True, text=True, shell=is_windows())
918
m = re.match(r'.* kotlinc-jvm ([0-9]+\.[0-9]+\.)[0-9]+ .*', versionOutput.stderr)
1019
if m is None:
11-
raise Exception('Cannot detect version of kotlinc')
20+
raise Exception('Cannot detect version of kotlinc (got ' + str(versionOutput) + ')')
1221
prefix = m.group(1)
1322
for version in many_versions:
1423
if version.startswith(prefix):
1524
return version
16-
raise Exception('No suitable kotlinc version found for ' + prefix)
25+
raise Exception('No suitable kotlinc version found for ' + prefix + ' (got ' + str(versionOutput) + '; know about ' + str(many_versions) + ')')

0 commit comments

Comments
 (0)