Kotlin/Bazel: use kotlinc.bat instead of kotlinc.exe on Windows

This commit is contained in:
Paolo Tranquilli
2024-04-12 12:15:26 +02:00
parent 65df2bb16d
commit 0ad8ed3822

View File

@@ -76,9 +76,8 @@ def _get_default_version(repository_ctx):
kotlinc = repository_ctx.which("kotlinc")
if not kotlinc:
return DEFAULT_VERSION
if repository_ctx.os.name == "windows" and not kotlinc.basename.endswith(".exe"):
# for some reason the result from `which` can fail to have exe
kotlinc = repository_ctx.path("%s.exe" % kotlinc)
if repository_ctx.os.name == "windows" and not kotlinc.basename.endswith(".bat"):
kotlinc = repository_ctx.path("%s.bat" % kotlinc)
res = repository_ctx.execute([kotlinc, "-version"])
if not res:
fail("kotlinc -version failed: %s" % res.stderr)