Kotlin: This might fix building on Windows

This commit is contained in:
Ian Lynagh
2022-03-17 17:00:53 +00:00
parent 967619f26a
commit 62d9b85b46
2 changed files with 12 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
import argparse
import kotlin_plugin_versions
import glob
import platform
import re
import subprocess
import shutil
@@ -24,10 +25,19 @@ kotlinc = 'kotlinc'
javac = 'javac'
kotlin_dependency_folder = args.dependencies
def is_windows():
'''Whether we appear to be running on Windows'''
if platform.system() == 'Windows':
return True
if platform.system().startswith('CYGWIN'):
return True
return False
def run_process(cmd):
try:
# print("Running command: " + shlex.join(cmd))
return subprocess.run(cmd, check=True, capture_output=True)
# TODO: `shell=True` is a workaround to get CI working on Windows. It breaks the build on Linux.
return subprocess.run(cmd, check=True, capture_output=True, shell=is_windows())
except subprocess.CalledProcessError as e:
print("In: " + os.getcwd(), file=sys.stderr)
print("Command failed: " + shlex.join(cmd), file=sys.stderr)

View File

@@ -13,7 +13,7 @@ def is_windows():
many_versions = [ '1.4.32', '1.5.31', '1.6.10' ]
def get_single_version():
# TODO: `shell=True` is a workaround to get CI working on Windows. It break the build on Linux.
# TODO: `shell=True` is a workaround to get CI working on Windows. It breaks the build on Linux.
versionOutput = subprocess.run(['kotlinc', '-version'], capture_output=True, text=True, shell=is_windows())
m = re.match(r'.* kotlinc-jvm ([0-9]+\.[0-9]+\.)[0-9]+ .*', versionOutput.stderr)
if m is None: